@visactor/vseed 0.0.38 → 0.0.39

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/dist/builder/builder/builder.d.ts +16 -0
  2. package/dist/index.cjs +36 -16
  3. package/dist/index.cjs.map +1 -1
  4. package/dist/index.js +36 -16
  5. package/dist/index.js.map +1 -1
  6. package/dist/pipeline/spec/chart/pipes/color/color.d.ts +3 -0
  7. package/dist/pipeline/spec/chart/pipes/series/series.d.ts +4 -0
  8. package/dist/types/advancedVSeed.d.ts +8 -0
  9. package/dist/types/chartType/area/area.d.ts +2 -8
  10. package/dist/types/chartType/area/zArea.d.ts +6 -0
  11. package/dist/types/chartType/areaPercent/zAreaPercent.d.ts +6 -0
  12. package/dist/types/chartType/areaRange/zAreaRange.d.ts +6 -0
  13. package/dist/types/chartType/bar/zBar.d.ts +2 -0
  14. package/dist/types/chartType/barParallel/zBarParallel.d.ts +2 -0
  15. package/dist/types/chartType/barPercent/zBarPercent.d.ts +2 -0
  16. package/dist/types/chartType/column/zColumn.d.ts +2 -0
  17. package/dist/types/chartType/columnParallel/zColumnParallel.d.ts +2 -0
  18. package/dist/types/chartType/columnPercent/zColumnPercent.d.ts +2 -0
  19. package/dist/types/chartType/dualAxis/zDualAxis.d.ts +8 -0
  20. package/dist/types/chartType/line/zLine.d.ts +4 -0
  21. package/dist/types/chartType/radar/radar.d.ts +25 -1
  22. package/dist/types/chartType/scatter/zScatter.d.ts +2 -0
  23. package/dist/types/properties/annotation/annotationArea.d.ts +17 -17
  24. package/dist/types/properties/markStyle/areaStyle.d.ts +5 -76
  25. package/dist/types/properties/markStyle/barStyle.d.ts +11 -12
  26. package/dist/types/properties/markStyle/index.d.ts +2 -1
  27. package/dist/types/properties/markStyle/lineStyle.d.ts +11 -17
  28. package/dist/types/properties/markStyle/markStyle.d.ts +8 -0
  29. package/dist/types/properties/markStyle/pointStyle.d.ts +5 -6
  30. package/dist/types/properties/markStyle/zAreaStyle.d.ts +75 -0
  31. package/dist/types/vseed.d.ts +44 -0
  32. package/dist/umd/index.js +36 -16
  33. package/dist/umd/index.js.map +1 -1
  34. package/package.json +1 -1
@@ -1765,6 +1765,7 @@ export declare class Builder implements VSeedBuilder {
1765
1765
  operator?: "in" | "not in" | null | undefined;
1766
1766
  op?: "in" | "not in" | null | undefined;
1767
1767
  })[] | null | undefined;
1768
+ barVisible?: boolean | null | undefined;
1768
1769
  barColor?: string | null | undefined;
1769
1770
  barColorOpacity?: number | null | undefined;
1770
1771
  barBorderColor?: string | null | undefined;
@@ -1793,6 +1794,7 @@ export declare class Builder implements VSeedBuilder {
1793
1794
  operator?: "in" | "not in" | null | undefined;
1794
1795
  op?: "in" | "not in" | null | undefined;
1795
1796
  })[] | null | undefined;
1797
+ barVisible?: boolean | null | undefined;
1796
1798
  barColor?: string | null | undefined;
1797
1799
  barColorOpacity?: number | null | undefined;
1798
1800
  barBorderColor?: string | null | undefined;
@@ -1822,6 +1824,7 @@ export declare class Builder implements VSeedBuilder {
1822
1824
  operator?: "in" | "not in" | null | undefined;
1823
1825
  op?: "in" | "not in" | null | undefined;
1824
1826
  })[] | null | undefined;
1827
+ pointVisible?: boolean | null | undefined;
1825
1828
  pointSize?: number | null | undefined;
1826
1829
  pointColor?: string | null | undefined;
1827
1830
  pointColorOpacity?: number | null | undefined;
@@ -1850,6 +1853,7 @@ export declare class Builder implements VSeedBuilder {
1850
1853
  operator?: "in" | "not in" | null | undefined;
1851
1854
  op?: "in" | "not in" | null | undefined;
1852
1855
  })[] | null | undefined;
1856
+ pointVisible?: boolean | null | undefined;
1853
1857
  pointSize?: number | null | undefined;
1854
1858
  pointColor?: string | null | undefined;
1855
1859
  pointColorOpacity?: number | null | undefined;
@@ -1879,6 +1883,7 @@ export declare class Builder implements VSeedBuilder {
1879
1883
  operator?: "in" | "not in" | null | undefined;
1880
1884
  op?: "in" | "not in" | null | undefined;
1881
1885
  })[] | null | undefined;
1886
+ lineVisible?: boolean | null | undefined;
1882
1887
  lineSmooth?: boolean | null | undefined;
1883
1888
  lineColor?: string | null | undefined;
1884
1889
  lineColorOpacity?: number | null | undefined;
@@ -1906,6 +1911,7 @@ export declare class Builder implements VSeedBuilder {
1906
1911
  operator?: "in" | "not in" | null | undefined;
1907
1912
  op?: "in" | "not in" | null | undefined;
1908
1913
  })[] | null | undefined;
1914
+ lineVisible?: boolean | null | undefined;
1909
1915
  lineSmooth?: boolean | null | undefined;
1910
1916
  lineColor?: string | null | undefined;
1911
1917
  lineColorOpacity?: number | null | undefined;
@@ -1934,6 +1940,7 @@ export declare class Builder implements VSeedBuilder {
1934
1940
  operator?: "in" | "not in" | null | undefined;
1935
1941
  op?: "in" | "not in" | null | undefined;
1936
1942
  })[] | null | undefined;
1943
+ areaVisible?: boolean | null | undefined;
1937
1944
  areaColor?: string | null | undefined;
1938
1945
  areaColorOpacity?: number | null | undefined;
1939
1946
  } | {
@@ -1958,6 +1965,7 @@ export declare class Builder implements VSeedBuilder {
1958
1965
  operator?: "in" | "not in" | null | undefined;
1959
1966
  op?: "in" | "not in" | null | undefined;
1960
1967
  })[] | null | undefined;
1968
+ areaVisible?: boolean | null | undefined;
1961
1969
  areaColor?: string | null | undefined;
1962
1970
  areaColorOpacity?: number | null | undefined;
1963
1971
  }[] | null | undefined;
@@ -5647,6 +5655,7 @@ export declare class Builder implements VSeedBuilder {
5647
5655
  operator?: "in" | "not in" | null | undefined;
5648
5656
  op?: "in" | "not in" | null | undefined;
5649
5657
  })[] | null | undefined;
5658
+ barVisible?: boolean | null | undefined;
5650
5659
  barColor?: string | null | undefined;
5651
5660
  barColorOpacity?: number | null | undefined;
5652
5661
  barBorderColor?: string | null | undefined;
@@ -5675,6 +5684,7 @@ export declare class Builder implements VSeedBuilder {
5675
5684
  operator?: "in" | "not in" | null | undefined;
5676
5685
  op?: "in" | "not in" | null | undefined;
5677
5686
  })[] | null | undefined;
5687
+ barVisible?: boolean | null | undefined;
5678
5688
  barColor?: string | null | undefined;
5679
5689
  barColorOpacity?: number | null | undefined;
5680
5690
  barBorderColor?: string | null | undefined;
@@ -5704,6 +5714,7 @@ export declare class Builder implements VSeedBuilder {
5704
5714
  operator?: "in" | "not in" | null | undefined;
5705
5715
  op?: "in" | "not in" | null | undefined;
5706
5716
  })[] | null | undefined;
5717
+ pointVisible?: boolean | null | undefined;
5707
5718
  pointSize?: number | null | undefined;
5708
5719
  pointColor?: string | null | undefined;
5709
5720
  pointColorOpacity?: number | null | undefined;
@@ -5732,6 +5743,7 @@ export declare class Builder implements VSeedBuilder {
5732
5743
  operator?: "in" | "not in" | null | undefined;
5733
5744
  op?: "in" | "not in" | null | undefined;
5734
5745
  })[] | null | undefined;
5746
+ pointVisible?: boolean | null | undefined;
5735
5747
  pointSize?: number | null | undefined;
5736
5748
  pointColor?: string | null | undefined;
5737
5749
  pointColorOpacity?: number | null | undefined;
@@ -5761,6 +5773,7 @@ export declare class Builder implements VSeedBuilder {
5761
5773
  operator?: "in" | "not in" | null | undefined;
5762
5774
  op?: "in" | "not in" | null | undefined;
5763
5775
  })[] | null | undefined;
5776
+ lineVisible?: boolean | null | undefined;
5764
5777
  lineSmooth?: boolean | null | undefined;
5765
5778
  lineColor?: string | null | undefined;
5766
5779
  lineColorOpacity?: number | null | undefined;
@@ -5788,6 +5801,7 @@ export declare class Builder implements VSeedBuilder {
5788
5801
  operator?: "in" | "not in" | null | undefined;
5789
5802
  op?: "in" | "not in" | null | undefined;
5790
5803
  })[] | null | undefined;
5804
+ lineVisible?: boolean | null | undefined;
5791
5805
  lineSmooth?: boolean | null | undefined;
5792
5806
  lineColor?: string | null | undefined;
5793
5807
  lineColorOpacity?: number | null | undefined;
@@ -5816,6 +5830,7 @@ export declare class Builder implements VSeedBuilder {
5816
5830
  operator?: "in" | "not in" | null | undefined;
5817
5831
  op?: "in" | "not in" | null | undefined;
5818
5832
  })[] | null | undefined;
5833
+ areaVisible?: boolean | null | undefined;
5819
5834
  areaColor?: string | null | undefined;
5820
5835
  areaColorOpacity?: number | null | undefined;
5821
5836
  } | {
@@ -5840,6 +5855,7 @@ export declare class Builder implements VSeedBuilder {
5840
5855
  operator?: "in" | "not in" | null | undefined;
5841
5856
  op?: "in" | "not in" | null | undefined;
5842
5857
  })[] | null | undefined;
5858
+ areaVisible?: boolean | null | undefined;
5843
5859
  areaColor?: string | null | undefined;
5844
5860
  areaColorOpacity?: number | null | undefined;
5845
5861
  }[] | null | undefined;
package/dist/index.cjs CHANGED
@@ -2597,7 +2597,7 @@ const pointStyle_pointStyle = (spec, context)=>{
2597
2597
  pointStyle
2598
2598
  ];
2599
2599
  const customMap = pointStyles.reduce((result, style, index)=>{
2600
- const { pointBorderColor, pointBorderStyle, pointBorderWidth = 1, pointColor, pointColorOpacity, pointSize } = style;
2600
+ const { pointBorderColor, pointBorderStyle, pointBorderWidth = 1, pointColor, pointColorOpacity, pointSize, pointVisible = true } = style;
2601
2601
  const lineDash = 'dashed' === pointBorderStyle ? [
2602
2602
  5,
2603
2603
  2
@@ -2617,6 +2617,7 @@ const pointStyle_pointStyle = (spec, context)=>{
2617
2617
  return false;
2618
2618
  },
2619
2619
  style: {
2620
+ visible: pointVisible,
2620
2621
  size: pointSize,
2621
2622
  fill: pointColor,
2622
2623
  fillOpacity: pointColorOpacity,
@@ -2701,9 +2702,9 @@ const lineStyle_lineStyle = (spec, context)=>{
2701
2702
  const group = encoding[0]?.group?.[0];
2702
2703
  const lineGroups = (0, external_remeda_namespaceObject.groupBy)(dataset, (d)=>d[group ?? '']);
2703
2704
  const customMap = lineStyles.reduce((result, style, index)=>{
2704
- const { lineColor, lineColorOpacity, lineSmooth, lineStyle, lineWidth } = style;
2705
- const dashSegment = (lineWidth ?? 2) * 2;
2706
- const dashGap = lineWidth ?? 2;
2705
+ const { lineColor, lineColorOpacity, lineSmooth, lineStyle, lineWidth = 2, lineVisible = true } = style;
2706
+ const dashSegment = 2 * lineWidth;
2707
+ const dashGap = lineWidth;
2707
2708
  const lineDash = 'dashed' === lineStyle ? [
2708
2709
  dashSegment,
2709
2710
  dashSegment
@@ -2725,6 +2726,7 @@ const lineStyle_lineStyle = (spec, context)=>{
2725
2726
  return false;
2726
2727
  },
2727
2728
  style: {
2729
+ visible: lineVisible,
2728
2730
  curveType: curveType,
2729
2731
  strokeOpacity: lineColorOpacity,
2730
2732
  stroke: lineColor,
@@ -3272,13 +3274,14 @@ const pivotIndicators_pivotIndicators = (chartPipeline)=>(spec, context)=>{
3272
3274
  ...spec
3273
3275
  };
3274
3276
  const { advancedVSeed } = context;
3275
- const { measures, datasetReshapeInfo, encoding } = advancedVSeed;
3277
+ const { measures, datasetReshapeInfo, encoding, dataset } = advancedVSeed;
3276
3278
  const colorItems = (0, external_remeda_namespaceObject.unique)(datasetReshapeInfo.flatMap((d)=>d.unfoldInfo.colorItems));
3277
3279
  const indicators = datasetReshapeInfo.map((reshapeInfo, index)=>{
3278
3280
  const measure = measures?.find((d)=>d.id === reshapeInfo.id);
3279
3281
  const newEncoding = [
3280
3282
  encoding[index]
3281
3283
  ];
3284
+ const newDataset = dataset[index];
3282
3285
  const newDatasetReshapeInfo = [
3283
3286
  {
3284
3287
  ...reshapeInfo,
@@ -3293,6 +3296,7 @@ const pivotIndicators_pivotIndicators = (chartPipeline)=>(spec, context)=>{
3293
3296
  advancedVSeed: {
3294
3297
  ...advancedVSeed,
3295
3298
  datasetReshapeInfo: newDatasetReshapeInfo,
3299
+ dataset: newDataset,
3296
3300
  encoding: newEncoding
3297
3301
  }
3298
3302
  };
@@ -3401,7 +3405,8 @@ const pivotDiscreteLegend = (spec, context)=>{
3401
3405
  ...cur.unfoldInfo.colorIdMap
3402
3406
  }), {});
3403
3407
  const { legend, color } = baseConfig;
3404
- const { colorScheme } = color;
3408
+ const { colorScheme, colorMapping } = color;
3409
+ const colorSpecified = createSpecifiedForColorMapping(colorMapping, colorIdMap, colorItems);
3405
3410
  const { enable, position = 'bottom', labelFontColor, labelFontSize = 12, labelFontWeight = 400, maxSize = 1, border, shapeType = 'rectRound' } = legend || {};
3406
3411
  const orient = [
3407
3412
  'bottom',
@@ -3448,17 +3453,20 @@ const pivotDiscreteLegend = (spec, context)=>{
3448
3453
  position: legendPosition,
3449
3454
  maxCol: Math.max(1, maxSize),
3450
3455
  maxRow: Math.max(1, maxSize),
3451
- data: colorItems.map((d, index)=>({
3456
+ data: colorItems.map((d, index)=>{
3457
+ const color = colorSpecified?.[d] ?? colorScheme?.[index % colorScheme.length];
3458
+ return {
3452
3459
  label: d,
3453
3460
  shape: {
3454
3461
  outerBorder: border ? {
3455
- stroke: colorScheme?.[index % colorScheme.length],
3462
+ stroke: color,
3456
3463
  distance: 3,
3457
3464
  lineWidth: 1
3458
3465
  } : void 0,
3459
- fill: colorScheme?.[index % colorScheme.length]
3466
+ fill: color
3460
3467
  }
3461
- })),
3468
+ };
3469
+ }),
3462
3470
  item: {
3463
3471
  focus: true,
3464
3472
  maxWidth: '30%',
@@ -3808,7 +3816,7 @@ const barStyle_barStyle = (spec, context)=>{
3808
3816
  barStyle
3809
3817
  ];
3810
3818
  const customMap = barStyles.reduce((result, style, index)=>{
3811
- const { barBorderColor, barBorderStyle, barBorderWidth = 1, barColor, barColorOpacity, barRadius } = style;
3819
+ const { barBorderColor, barBorderStyle, barBorderWidth = 1, barColor, barColorOpacity, barRadius, barVisible = true } = style;
3812
3820
  const lineDash = 'dashed' === barBorderStyle ? [
3813
3821
  5,
3814
3822
  2
@@ -3828,6 +3836,7 @@ const barStyle_barStyle = (spec, context)=>{
3828
3836
  return false;
3829
3837
  },
3830
3838
  style: {
3839
+ visible: barVisible,
3831
3840
  fill: barColor,
3832
3841
  fillOpacity: barColorOpacity,
3833
3842
  cornerRadius: barRadius,
@@ -4806,7 +4815,12 @@ const areaStyle_areaStyle = (spec, context)=>{
4806
4815
  const { advancedVSeed } = context;
4807
4816
  const { markStyle, encoding, dataset } = advancedVSeed;
4808
4817
  const { areaStyle } = markStyle;
4809
- if (!areaStyle) return spec;
4818
+ if (!areaStyle) return {
4819
+ ...spec,
4820
+ area: {
4821
+ visible: true
4822
+ }
4823
+ };
4810
4824
  const result = {
4811
4825
  ...spec
4812
4826
  };
@@ -4814,19 +4828,20 @@ const areaStyle_areaStyle = (spec, context)=>{
4814
4828
  areaStyle
4815
4829
  ];
4816
4830
  const group = encoding[0]?.group?.[0];
4817
- const lineGroups = (0, external_remeda_namespaceObject.groupBy)(dataset, (d)=>d[group ?? '']);
4831
+ const areaGroups = (0, external_remeda_namespaceObject.groupBy)(dataset, (d)=>d[group ?? '']);
4818
4832
  const customMap = areaStyles.reduce((result, style, index)=>{
4819
- const { areaColor, areaColorOpacity } = style;
4833
+ const { areaColor, areaColorOpacity, areaVisible = true } = style;
4820
4834
  return {
4821
4835
  ...result,
4822
4836
  [`custom${index + 1}`]: {
4823
4837
  level: index + 1,
4824
4838
  filter: (datum)=>{
4825
- const lineData = lineGroups[datum[group ?? '']];
4839
+ const lineData = areaGroups[datum[group ?? '']];
4826
4840
  for (const d of lineData)if (selector_selector(d, style.selector)) return true;
4827
4841
  return false;
4828
4842
  },
4829
4843
  style: {
4844
+ visible: areaVisible,
4830
4845
  fill: areaColor,
4831
4846
  fillOpacity: areaColorOpacity
4832
4847
  }
@@ -4836,6 +4851,7 @@ const areaStyle_areaStyle = (spec, context)=>{
4836
4851
  return {
4837
4852
  ...result,
4838
4853
  area: {
4854
+ visible: true,
4839
4855
  state: {
4840
4856
  ...customMap
4841
4857
  }
@@ -6764,7 +6780,7 @@ const pivotDualAxis = [
6764
6780
  pivotIndicators_pivotIndicatorsAsRow,
6765
6781
  datasetPivot,
6766
6782
  pivotIndicators_pivotIndicators([
6767
- seriesDualAxis([
6783
+ series([
6768
6784
  initDualAxisPrimary,
6769
6785
  dualChartTypePrimary,
6770
6786
  datasetPrimary,
@@ -9301,6 +9317,7 @@ const zBarStyle = external_zod_namespaceObject.z.object({
9301
9317
  zSelector,
9302
9318
  zSelectors
9303
9319
  ]).nullish(),
9320
+ barVisible: external_zod_namespaceObject.z.boolean().nullish(),
9304
9321
  barColor: external_zod_namespaceObject.z.string().nullish(),
9305
9322
  barColorOpacity: external_zod_namespaceObject.z.number().nullish(),
9306
9323
  barBorderColor: external_zod_namespaceObject.z.string().nullish(),
@@ -9320,6 +9337,7 @@ const zPointStyle = external_zod_namespaceObject.z.object({
9320
9337
  zSelector,
9321
9338
  zSelectors
9322
9339
  ]).nullish(),
9340
+ pointVisible: external_zod_namespaceObject.z.boolean().nullish(),
9323
9341
  pointSize: external_zod_namespaceObject.z.number().nullish(),
9324
9342
  pointColor: external_zod_namespaceObject.z.string().nullish(),
9325
9343
  pointColorOpacity: external_zod_namespaceObject.z.number().nullish(),
@@ -9338,6 +9356,7 @@ const zLineStyle = external_zod_namespaceObject.z.object({
9338
9356
  zSelector,
9339
9357
  zSelectors
9340
9358
  ]).nullish(),
9359
+ lineVisible: external_zod_namespaceObject.z.boolean().nullish(),
9341
9360
  lineSmooth: external_zod_namespaceObject.z.boolean().nullish(),
9342
9361
  lineColor: external_zod_namespaceObject.z.string().nullish(),
9343
9362
  lineColorOpacity: external_zod_namespaceObject.z.number().nullish(),
@@ -9355,6 +9374,7 @@ const zAreaStyle = external_zod_namespaceObject.z.object({
9355
9374
  zSelector,
9356
9375
  zSelectors
9357
9376
  ]).nullish(),
9377
+ areaVisible: external_zod_namespaceObject.z.boolean().nullish(),
9358
9378
  areaColor: external_zod_namespaceObject.z.string().nullish(),
9359
9379
  areaColorOpacity: external_zod_namespaceObject.z.number().nullish()
9360
9380
  });