@visactor/vseed 0.0.32 → 0.0.34

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 (81) hide show
  1. package/dist/builder/builder/buildAdvanced.d.ts +1 -1
  2. package/dist/builder/builder/buildSpec.d.ts +1 -1
  3. package/dist/builder/builder/builder.d.ts +2795 -4888
  4. package/dist/builder/register/chartType/dualAxis.d.ts +1 -0
  5. package/dist/builder/register/chartType/index.d.ts +12 -11
  6. package/dist/dataReshape/constant.d.ts +3 -1
  7. package/dist/index.cjs +1392 -236
  8. package/dist/index.cjs.map +1 -1
  9. package/dist/index.js +1325 -196
  10. package/dist/index.js.map +1 -1
  11. package/dist/pipeline/advanced/chart/pipeline/dualAxis.d.ts +2 -0
  12. package/dist/pipeline/advanced/chart/pipeline/index.d.ts +1 -0
  13. package/dist/pipeline/advanced/chart/pipes/config/dualAxis.d.ts +2 -0
  14. package/dist/pipeline/advanced/chart/pipes/config/index.d.ts +1 -0
  15. package/dist/pipeline/advanced/chart/pipes/encoding/encodingAreaRange.d.ts +2 -0
  16. package/dist/pipeline/advanced/chart/pipes/encoding/index.d.ts +1 -0
  17. package/dist/pipeline/advanced/chart/pipes/init/autoDualMeasures.d.ts +2 -0
  18. package/dist/pipeline/advanced/chart/pipes/reshape/index.d.ts +2 -0
  19. package/dist/pipeline/advanced/chart/pipes/reshape/pivotReshapeTo2D2M.d.ts +8 -0
  20. package/dist/pipeline/advanced/chart/pipes/reshape/reshapeTo2D2M.d.ts +8 -0
  21. package/dist/pipeline/spec/chart/pipeline/dualAxis.d.ts +2 -0
  22. package/dist/pipeline/spec/chart/pipeline/index.d.ts +1 -0
  23. package/dist/pipeline/spec/chart/pipes/axes/index.d.ts +2 -0
  24. package/dist/pipeline/spec/chart/pipes/axes/yLinearPrimary.d.ts +2 -0
  25. package/dist/pipeline/spec/chart/pipes/axes/yLinearSecondary.d.ts +2 -0
  26. package/dist/pipeline/spec/chart/pipes/dataset/datasetDualAxis.d.ts +3 -0
  27. package/dist/pipeline/spec/chart/pipes/dataset/index.d.ts +1 -0
  28. package/dist/pipeline/spec/chart/pipes/dual/dualChartType.d.ts +3 -0
  29. package/dist/pipeline/spec/chart/pipes/dual/index.d.ts +1 -0
  30. package/dist/pipeline/spec/chart/pipes/index.d.ts +1 -0
  31. package/dist/pipeline/spec/chart/pipes/init/index.d.ts +1 -0
  32. package/dist/pipeline/spec/chart/pipes/init/initDualAxis.d.ts +3 -0
  33. package/dist/pipeline/spec/chart/pipes/label/index.d.ts +1 -0
  34. package/dist/pipeline/spec/chart/pipes/label/labelDualAxis.d.ts +3 -0
  35. package/dist/pipeline/spec/chart/pipes/tooltip/index.d.ts +1 -0
  36. package/dist/pipeline/spec/chart/pipes/tooltip/tooltipDualAxis.d.ts +3 -0
  37. package/dist/pipeline/utils/chatType.d.ts +2 -2
  38. package/dist/pipeline/utils/measures/depth.d.ts +8 -0
  39. package/dist/pipeline/utils/measures/index.d.ts +1 -0
  40. package/dist/types/advancedVSeed.d.ts +547 -54
  41. package/dist/types/builder/builder.d.ts +16 -15
  42. package/dist/types/chartType/area/area.d.ts +0 -1494
  43. package/dist/types/chartType/area/index.d.ts +2 -1
  44. package/dist/types/chartType/area/zArea.d.ts +1494 -0
  45. package/dist/types/chartType/areaPercent/areaPercent.d.ts +0 -1494
  46. package/dist/types/chartType/areaPercent/index.d.ts +2 -1
  47. package/dist/types/chartType/areaPercent/zAreaPercent.d.ts +1494 -0
  48. package/dist/types/chartType/areaRange/areaRange.d.ts +0 -1433
  49. package/dist/types/chartType/areaRange/index.d.ts +2 -1
  50. package/dist/types/chartType/areaRange/zAreaRange.d.ts +1433 -0
  51. package/dist/types/chartType/bar/bar.d.ts +40 -40
  52. package/dist/types/chartType/barParallel/barParallel.d.ts +40 -40
  53. package/dist/types/chartType/barPercent/barPercent.d.ts +40 -40
  54. package/dist/types/chartType/column/column.d.ts +40 -40
  55. package/dist/types/chartType/columnParallel/columnParallel.d.ts +40 -40
  56. package/dist/types/chartType/columnPercent/columnPercent.d.ts +40 -40
  57. package/dist/types/chartType/dualAxis/dualAxis.d.ts +123 -23
  58. package/dist/types/chartType/dualAxis/index.d.ts +1 -0
  59. package/dist/types/chartType/dualAxis/zDualAxis.d.ts +1963 -0
  60. package/dist/types/chartType/index.d.ts +1 -1
  61. package/dist/types/chartType/line/line.d.ts +40 -40
  62. package/dist/types/chartType/scatter/scatter.d.ts +40 -40
  63. package/dist/types/properties/annotation/annotation.d.ts +40 -40
  64. package/dist/types/properties/annotation/annotationArea.d.ts +27 -34
  65. package/dist/types/properties/annotation/annotationHorizontalLine.d.ts +7 -7
  66. package/dist/types/properties/annotation/annotationPoint.d.ts +24 -22
  67. package/dist/types/properties/annotation/annotationVerticalLine.d.ts +7 -7
  68. package/dist/types/properties/chartType/dualChartType.d.ts +22 -0
  69. package/dist/types/properties/chartType/index.d.ts +2 -0
  70. package/dist/types/properties/config/config.d.ts +493 -7
  71. package/dist/types/properties/datasetReshapeInfo/datasetReshapeInfo.d.ts +7 -0
  72. package/dist/types/properties/measures/dualMeasures.d.ts +8 -0
  73. package/dist/types/properties/measures/index.d.ts +4 -1
  74. package/dist/types/properties/measures/measures.d.ts +0 -107
  75. package/dist/types/properties/measures/zDualMeasures.d.ts +287 -0
  76. package/dist/types/properties/measures/zMeasures.d.ts +108 -0
  77. package/dist/types/properties/theme/customTheme.d.ts +500 -14
  78. package/dist/types/vseed.d.ts +2401 -440
  79. package/dist/umd/index.js +1316 -178
  80. package/dist/umd/index.js.map +1 -1
  81. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -8,11 +8,11 @@ const buildAdvanced = (builder)=>{
8
8
  const start = 'undefined' != typeof performance ? performance.now() : Date.now();
9
9
  const { chartType } = builder.vseed;
10
10
  if (!chartType) throw new Error('chartType is nil in buildAdvanced');
11
- const pipeline = builder.getAdvancedPipeline(chartType);
11
+ const pipeline = Builder.getAdvancedPipeline(chartType);
12
12
  if (!pipeline) throw new Error(`no advanced pipeline for chartType ${chartType}`);
13
13
  const context = {
14
14
  vseed: builder.vseed,
15
- customTheme: builder.getThemeMap()
15
+ customTheme: Builder.getThemeMap()
16
16
  };
17
17
  try {
18
18
  return execPipeline(pipeline, context);
@@ -28,7 +28,7 @@ const buildSpec = (builder, advancedVSeed)=>{
28
28
  const start = 'undefined' != typeof performance ? performance.now() : Date.now();
29
29
  const { chartType } = builder.vseed;
30
30
  if (!chartType) throw new Error('chartType is nil in buildSpec');
31
- const pipeline = builder.getSpecPipeline(chartType);
31
+ const pipeline = Builder.getSpecPipeline(chartType);
32
32
  if (!pipeline) throw new Error(`no spec pipeline for chartType ${chartType}`);
33
33
  const context = {
34
34
  vseed: builder.vseed,
@@ -111,20 +111,6 @@ class Builder {
111
111
  build = ()=>build(this);
112
112
  buildSpec = (advanced)=>buildSpec(this, advanced);
113
113
  buildAdvanced = ()=>buildAdvanced(this);
114
- getAdvancedPipeline = (chartType)=>{
115
- const customPipe = Builder._customAdvancedPipe[chartType];
116
- const pipeline = Builder._advancedPipelineMap[chartType];
117
- if (customPipe) pipeline.push(customPipe);
118
- return pipeline;
119
- };
120
- getSpecPipeline = (chartType)=>{
121
- const customPipe = Builder._customSpecPipe[chartType];
122
- const pipeline = Builder._specPipelineMap[chartType];
123
- if (customPipe) pipeline.push(customPipe);
124
- return pipeline;
125
- };
126
- getTheme = (themeKey)=>Builder._themeMap[themeKey];
127
- getThemeMap = ()=>Builder._themeMap;
128
114
  getColorItems = ()=>getColorItems(this);
129
115
  getColorIdMap = ()=>getColorIdMap(this);
130
116
  get vseed() {
@@ -151,12 +137,26 @@ class Builder {
151
137
  set performance(value) {
152
138
  this._performance = value;
153
139
  }
140
+ static getAdvancedPipeline = (chartType)=>{
141
+ const customPipe = Builder._customAdvancedPipe[chartType];
142
+ const pipeline = Builder._advancedPipelineMap[chartType];
143
+ if (customPipe) pipeline.push(customPipe);
144
+ return pipeline;
145
+ };
146
+ static getSpecPipeline = (chartType)=>{
147
+ const customPipe = Builder._customSpecPipe[chartType];
148
+ const pipeline = Builder._specPipelineMap[chartType];
149
+ if (customPipe) pipeline.push(customPipe);
150
+ return pipeline;
151
+ };
152
+ static getTheme = (themeKey)=>Builder._themeMap[themeKey];
153
+ static getThemeMap = ()=>Builder._themeMap;
154
+ static from = (vseed)=>new Builder(vseed);
154
155
  static _advancedPipelineMap = {};
155
156
  static _specPipelineMap = {};
156
157
  static _customAdvancedPipe = {};
157
158
  static _customSpecPipe = {};
158
159
  static _themeMap = {};
159
- static from = (vseed)=>new Builder(vseed);
160
160
  }
161
161
  const initAdvancedVSeed = (advancedVSeed, context)=>{
162
162
  const { vseed } = context;
@@ -175,7 +175,7 @@ const autoMeasures = (advancedVSeed, context)=>{
175
175
  const { measures, dataset } = vseed;
176
176
  if (!dataset) throw new Error('dataset is required');
177
177
  if (0 === dataset.length) return result;
178
- if (measures && measures.length > 0) {
178
+ if (measures) {
179
179
  result.measures = measures;
180
180
  return result;
181
181
  }
@@ -255,8 +255,11 @@ const autoDimensions = (advancedVSeed, context)=>{
255
255
  const measures = findAllMeasures(advancedVSeed.measures);
256
256
  if (!dataset) throw new Error('dataset is required');
257
257
  if (0 === dataset.length) return result;
258
- if (dimensions && dimensions.length > 0) {
259
- result.dimensions = dimensions;
258
+ if (dimensions) {
259
+ result.dimensions = dimensions.map((dim)=>({
260
+ location: 'dimension',
261
+ ...dim
262
+ }));
260
263
  return result;
261
264
  }
262
265
  const top100dataset = dataset.slice(0, 100);
@@ -552,7 +555,7 @@ const autoPivotMeasures = (advancedVSeed, context)=>{
552
555
  const measures = findAllMeasures(vseed.measures);
553
556
  if (!dataset) throw new Error('dataset is required');
554
557
  if (0 === dataset.length) return result;
555
- if (measures && measures.length > 0) {
558
+ if (vseed.measures) {
556
559
  result.measures = findAllMeasures(measures);
557
560
  return result;
558
561
  }
@@ -615,7 +618,7 @@ const autoPivotDimensions = (advancedVSeed, context)=>{
615
618
  const measures = findAllMeasures(advancedVSeed.measures);
616
619
  if (!dataset) throw new Error('dataset is required');
617
620
  if (0 === dataset.length) return result;
618
- if (dimensions && dimensions.length > 0) {
621
+ if (dimensions) {
619
622
  const newDimensions = findAllDimensions(dimensions);
620
623
  result.dimensions = newDimensions.map((item, index)=>{
621
624
  if ('rowDimension' === item.location || 'columnDimension' === item.location) return item;
@@ -850,6 +853,15 @@ const initAdvancedVSeed_initAdvancedVSeed = (advancedVSeed, context)=>{
850
853
  locale: locale || 'zh-CN'
851
854
  };
852
855
  };
856
+ const measureDepth = (measures = [])=>{
857
+ if (!measures) return 0;
858
+ let depth = 1;
859
+ preorderTraverse(measures, (node)=>{
860
+ if ('children' in node) depth = Math.max(depth, 1 + measureDepth(node.children));
861
+ return false;
862
+ });
863
+ return depth;
864
+ };
853
865
  const isTable = (vseed)=>'table' === vseed.chartType;
854
866
  const isPivotTable = (vseed)=>'pivotTable' === vseed.chartType;
855
867
  const isVTable = (vseed)=>[
@@ -859,9 +871,18 @@ const isVTable = (vseed)=>[
859
871
  const isVChart = (vseed)=>!isVTable(vseed);
860
872
  const isPivotChart = (vseed)=>{
861
873
  if (isVTable(vseed)) return false;
874
+ if ('dualAxis' === vseed.chartType) {
875
+ if (vseed.measures) {
876
+ const depth = measureDepth(vseed.measures);
877
+ if (3 === depth) return true;
878
+ return false;
879
+ }
880
+ if (vseed.dualMeasures && vseed.dualMeasures.length > 1) return true;
881
+ return false;
882
+ }
862
883
  const { measures = [], dimensions = [] } = vseed;
863
884
  const hasRowOrColumnDimension = dimensions && dimensions.some((dimension)=>'rowDimension' === dimension.location || 'columnDimension' === dimension.location);
864
- const hasMeasureGroup = measures && measures.find((measure)=>measure && measure.children);
885
+ const hasMeasureGroup = measures && measures.some((measure)=>measure && measure.children);
865
886
  return hasRowOrColumnDimension || hasMeasureGroup;
866
887
  };
867
888
  const autoMeasures_autoMeasures = (advancedVSeed, context)=>{
@@ -945,7 +966,10 @@ const autoDimensions_autoDimensions = (advancedVSeed, context)=>{
945
966
  if (!dataset) throw new Error('dataset is required');
946
967
  if (0 === dataset.length) return result;
947
968
  if (dimensions) {
948
- result.dimensions = dimensions;
969
+ result.dimensions = dimensions.map((dim)=>({
970
+ location: 'dimension',
971
+ ...dim
972
+ }));
949
973
  return result;
950
974
  }
951
975
  const top100dataset = dataset.slice(0, 100);
@@ -971,8 +995,10 @@ const pivotAdapter = (pipeline, pivotPipeline)=>(advancedVSeed, context)=>{
971
995
  return execPipeline(pipeline, context, advancedVSeed);
972
996
  };
973
997
  const FoldMeasureName = '__MeaName__';
974
- const FoldMeasureValue = '__MeaValue__';
975
998
  const FoldMeasureId = '__MeaId__';
999
+ const FoldMeasureValue = '__MeaValue__';
1000
+ const FoldPrimaryMeasureValue = '__MeaPrimaryValue__';
1001
+ const FoldSecondaryMeasureValue = '__MeaSecondaryValue__';
976
1002
  const UnfoldDimensionGroup = '__DimGroup__';
977
1003
  const UnfoldDimensionGroupId = '__DimGroupID__';
978
1004
  const Separator = '-';
@@ -1152,6 +1178,7 @@ const reshapeTo2D1M0Name = (advancedVSeed, context)=>{
1152
1178
  datasetReshapeInfo: [
1153
1179
  {
1154
1180
  id: '2D1M',
1181
+ index: 0,
1155
1182
  foldInfo,
1156
1183
  unfoldInfo
1157
1184
  }
@@ -1176,7 +1203,7 @@ const pivotReshapeTo2D1M0Name = (advancedVSeed, context)=>{
1176
1203
  const commonDimensions = dimensions.filter((dim)=>'dimension' === dim.location);
1177
1204
  const newDatasets = [];
1178
1205
  const datasetReshapeInfo = [];
1179
- measureGroups.forEach((measureGroup)=>{
1206
+ measureGroups.forEach((measureGroup, index)=>{
1180
1207
  const measures = measureGroup.children;
1181
1208
  if (!measures) return;
1182
1209
  const groupId = measureGroup.id;
@@ -1188,6 +1215,7 @@ const pivotReshapeTo2D1M0Name = (advancedVSeed, context)=>{
1188
1215
  });
1189
1216
  const reshapeInfo = {
1190
1217
  id: groupId,
1218
+ index,
1191
1219
  foldInfo,
1192
1220
  unfoldInfo
1193
1221
  };
@@ -1469,11 +1497,13 @@ const color_color = (spec, context)=>{
1469
1497
  const { unfoldInfo } = datasetReshapeInfo[0];
1470
1498
  const baseConfig = advancedVSeed.config[chartType];
1471
1499
  if (!baseConfig || !baseConfig.color) return result;
1500
+ const colorItems = unfoldInfo.colorItems;
1501
+ const colorIdMap = unfoldInfo.colorIdMap;
1472
1502
  const { color } = baseConfig;
1473
1503
  const { colorScheme, colorMapping } = color;
1474
1504
  const mappingList = [];
1475
1505
  if (colorMapping) Object.entries(colorMapping).sort((a, b)=>a[0].split(Separator).length - b[0].split(Separator).length).forEach(([key, value])=>{
1476
- const idMap = Object.entries(unfoldInfo.colorIdMap).filter(([_, v])=>v.includes(key));
1506
+ const idMap = Object.entries(colorIdMap).filter(([_, v])=>v.includes(key));
1477
1507
  for (const [colorId] of idMap)mappingList.push([
1478
1508
  colorId,
1479
1509
  value
@@ -1481,7 +1511,7 @@ const color_color = (spec, context)=>{
1481
1511
  });
1482
1512
  result.color = {
1483
1513
  type: 'ordinal',
1484
- domain: unfoldInfo.colorItems,
1514
+ domain: colorItems,
1485
1515
  range: colorScheme,
1486
1516
  specified: Object.fromEntries(mappingList)
1487
1517
  };
@@ -2303,7 +2333,7 @@ const annotationPoint_annotationPoint = (spec, context)=>{
2303
2333
  annotationPoint
2304
2334
  ];
2305
2335
  const markPoint = annotationPointList.flatMap((annotationPoint)=>{
2306
- const { selector: selectorPoint, text = '', textColor = '#ffffff', textFontSize = 12, textFontWeight = 400, textAlign = 'center', textBaseline = 'middle', backgroundBorderColor, backgroundBorderRadius = 4, backgroundBorderWidth = 1, backgroundColor = '#212121', backgroundPadding = 2, backgroundVisible = true, offsetX = 0, offsetY = 0 } = annotationPoint;
2336
+ const { selector: selectorPoint, text = '', textColor = '#ffffff', textFontSize = 12, textFontWeight = 400, textAlign = 'center', textBaseline = 'top', backgroundBorderColor, backgroundBorderRadius = 4, backgroundBorderWidth = 1, backgroundColor = '#212121', backgroundPadding = 2, backgroundVisible = true, offsetX = 0, offsetY = 0 } = annotationPoint;
2307
2337
  const dataset = advancedVSeed.dataset.flat();
2308
2338
  const selectedData = selectorPoint ? dataset.filter((datum)=>selector_selector(datum, selectorPoint)) : [];
2309
2339
  return selectedData.map((datum)=>({
@@ -2335,7 +2365,8 @@ const annotationPoint_annotationPoint = (spec, context)=>{
2335
2365
  stroke: backgroundColor,
2336
2366
  lineWidth: 1,
2337
2367
  fontSize: textFontSize,
2338
- fontWeight: textFontWeight
2368
+ fontWeight: textFontWeight,
2369
+ dy: textFontSize
2339
2370
  },
2340
2371
  labelBackground: {
2341
2372
  visible: backgroundVisible,
@@ -2344,7 +2375,8 @@ const annotationPoint_annotationPoint = (spec, context)=>{
2344
2375
  cornerRadius: backgroundBorderRadius ?? 4,
2345
2376
  fill: backgroundColor,
2346
2377
  stroke: backgroundBorderColor,
2347
- lineWidth: backgroundBorderWidth
2378
+ lineWidth: backgroundBorderWidth,
2379
+ dy: textFontSize
2348
2380
  }
2349
2381
  }
2350
2382
  }
@@ -2373,7 +2405,7 @@ const annotationVerticalLine_annotationVerticalLine = (spec, context)=>{
2373
2405
  insideEnd: 'insideEndTop'
2374
2406
  };
2375
2407
  const markLine = annotationVerticalLineList.flatMap((annotationVerticalLine)=>{
2376
- const { selector: selectorPoint, xValue, text = '', textPosition = 'insideEnd', textColor = '#ffffff', textFontSize = 12, textFontWeight = 400, textAlign = 'right', textBaseline = 'top', backgroundBorderColor, backgroundBorderRadius = 4, backgroundBorderWidth = 1, backgroundColor = '#212121', backgroundPadding = 2, backgroundVisible = true, lineColor = '#212121', lineStyle = 'dashed', lineVisible = true, lineWidth = 1, offsetX = 0, offsetY = 0 } = annotationVerticalLine;
2408
+ const { selector: selectorPoint, xValue, text = '', textPosition = 'insideEnd', textColor = '#ffffff', textFontSize = 12, textFontWeight = 400, textAlign = 'right', textBaseline = 'top', backgroundVisible = true, backgroundBorderColor = '#212121', backgroundColor = '#212121', backgroundBorderRadius = 4, backgroundBorderWidth = 1, backgroundPadding = 2, lineVisible = true, lineColor = '#212121', lineWidth = 1, lineStyle = 'dashed', offsetX = 0, offsetY = 0 } = annotationVerticalLine;
2377
2409
  const dataset = advancedVSeed.dataset.flat();
2378
2410
  const generateOneMarkLine = (x)=>({
2379
2411
  x: x,
@@ -2472,7 +2504,7 @@ const annotationHorizontalLine_annotationHorizontalLine = (spec, context)=>{
2472
2504
  insideEnd: 'insideEndTop'
2473
2505
  };
2474
2506
  const markLine = annotationVerticalLineList.flatMap((annotationVerticalLine)=>{
2475
- const { selector: selectorPoint, yValue, text = '', textPosition = 'insideEnd', textColor = '#ffffff', textFontSize = 12, textFontWeight = 400, textAlign = 'right', textBaseline = 'top', backgroundBorderColor, backgroundBorderRadius = 4, backgroundBorderWidth = 1, backgroundColor = '#212121', backgroundPadding = 2, backgroundVisible = true, lineColor = '#212121', lineStyle = 'dashed', lineVisible = true, lineWidth = 1, offsetX = 0, offsetY = 0 } = annotationVerticalLine;
2507
+ const { selector: selectorPoint, yValue, text = '', textPosition = 'insideEnd', textColor = '#ffffff', textFontSize = 12, textFontWeight = 400, textAlign = 'right', textBaseline = 'top', lineColor = '#212121', lineStyle = 'dashed', lineVisible = true, lineWidth = 1, backgroundVisible = true, backgroundColor = '#212121', backgroundBorderColor = '#212121', backgroundBorderRadius = 4, backgroundBorderWidth = 1, backgroundPadding = 2, offsetX = 0, offsetY = 0 } = annotationVerticalLine;
2476
2508
  const dataset = advancedVSeed.dataset.flat();
2477
2509
  const generateOneMarkLine = (y)=>({
2478
2510
  y,
@@ -2573,7 +2605,7 @@ const annotationArea_annotationArea = (spec, context)=>{
2573
2605
  right: 'insideRight'
2574
2606
  };
2575
2607
  const markArea = annotationAreaList.flatMap((annotationArea)=>{
2576
- const { selector: selectorPoint, text = '', textPosition = 'top', textColor = '#ffffff', textFontSize = 12, textFontWeight = 400, textAlign = 'center', textBaseline = 'top', backgroundBorderColor, backgroundBorderRadius = 4, backgroundBorderWidth = 1, backgroundColor = '#191d24', backgroundPadding = 10, backgroundVisible = true, outerPadding = 4, areaColor = '#888888', areaColorOpacity = 0.15, areaBorderColor, areaBorderRadius, areaBorderWidth, offsetX = 0, offsetY = 0 } = annotationArea;
2608
+ const { selector: selectorPoint, text = '', textPosition = 'top', textColor = '#ffffff', textFontSize = 12, textFontWeight = 400, textAlign = 'center', textBaseline = 'top', backgroundVisible = true, backgroundColor = '#191d24', backgroundBorderColor = '#191d24', backgroundBorderWidth = 1, backgroundBorderRadius = 4, backgroundPadding = 4, areaColor = '#888888', areaColorOpacity = 0.15, areaBorderColor = '#888888', areaBorderRadius = 4, areaBorderWidth = 1, outerPadding = 4, offsetX = 0, offsetY = 0 } = annotationArea;
2577
2609
  const dataset = advancedVSeed.dataset.flat();
2578
2610
  const selectedData = selectorPoint ? dataset.filter((datum)=>selector_selector(datum, selectorPoint)) : [];
2579
2611
  return {
@@ -2643,6 +2675,7 @@ const annotationArea_annotationArea = (spec, context)=>{
2643
2675
  visible: true,
2644
2676
  text: text,
2645
2677
  style: {
2678
+ dy: textFontSize,
2646
2679
  textAlign: textAlign,
2647
2680
  textBaseline: textBaseline,
2648
2681
  fill: textColor,
@@ -2655,6 +2688,7 @@ const annotationArea_annotationArea = (spec, context)=>{
2655
2688
  visible: backgroundVisible,
2656
2689
  padding: backgroundPadding,
2657
2690
  style: {
2691
+ dy: textFontSize,
2658
2692
  cornerRadius: backgroundBorderRadius ?? 4,
2659
2693
  fill: backgroundColor,
2660
2694
  stroke: backgroundBorderColor,
@@ -3187,6 +3221,7 @@ const reshapeTo2D1M = (advancedVSeed, context)=>{
3187
3221
  datasetReshapeInfo: [
3188
3222
  {
3189
3223
  id: '2D1M',
3224
+ index: 0,
3190
3225
  foldInfo,
3191
3226
  unfoldInfo
3192
3227
  }
@@ -3211,7 +3246,7 @@ const pivotReshapeTo2D1M = (advancedVSeed, context)=>{
3211
3246
  const commonDimensions = dimensions.filter((dim)=>'dimension' === dim.location);
3212
3247
  const newDatasets = [];
3213
3248
  const datasetReshapeInfo = [];
3214
- measureGroups.forEach((measureGroup)=>{
3249
+ measureGroups.forEach((measureGroup, index)=>{
3215
3250
  const measures = measureGroup.children;
3216
3251
  if (!measures) return;
3217
3252
  const groupId = measureGroup.id;
@@ -3223,6 +3258,7 @@ const pivotReshapeTo2D1M = (advancedVSeed, context)=>{
3223
3258
  });
3224
3259
  const reshapeInfo = {
3225
3260
  id: groupId,
3261
+ index,
3226
3262
  foldInfo,
3227
3263
  unfoldInfo
3228
3264
  };
@@ -3410,7 +3446,7 @@ const annotationAreaBand = (spec, context)=>{
3410
3446
  right: 'insideRight'
3411
3447
  };
3412
3448
  const markArea = annotationAreaList.flatMap((annotationArea)=>{
3413
- const { selector: selectorPoint, text = '', textPosition = 'top', textColor = '#ffffff', textFontSize = 12, textFontWeight = 400, textAlign = 'center', textBaseline = 'top', backgroundBorderColor, backgroundBorderRadius = 4, backgroundBorderWidth = 1, backgroundColor = '#191d24', backgroundPadding = 4, backgroundVisible = true, outerPadding = 8, areaColor = '#888888', areaColorOpacity = 0.15, areaBorderColor, areaBorderRadius, areaBorderWidth, offsetX, offsetY } = annotationArea;
3449
+ const { selector: selectorPoint, text = '', textPosition = 'top', textColor = '#ffffff', textFontSize = 12, textFontWeight = 400, textAlign = 'center', textBaseline = 'top', backgroundVisible = true, backgroundColor = '#191d24', backgroundBorderColor = '#191d24', backgroundBorderWidth = 1, backgroundBorderRadius = 4, backgroundPadding = 4, areaColor = '#888888', areaColorOpacity = 0.15, areaBorderColor = '#888888', areaBorderRadius = 4, areaBorderWidth = 1, outerPadding = 4, offsetX = 0, offsetY = 0 } = annotationArea;
3414
3450
  const dataset = advancedVSeed.dataset.flat();
3415
3451
  const selectedData = selectorPoint ? dataset.filter((datum)=>selector_selector(datum, selectorPoint)) : [];
3416
3452
  return {
@@ -3484,6 +3520,7 @@ const annotationAreaBand = (spec, context)=>{
3484
3520
  visible: true,
3485
3521
  text: text,
3486
3522
  style: {
3523
+ dy: textFontSize,
3487
3524
  textAlign: textAlign,
3488
3525
  textBaseline: textBaseline,
3489
3526
  stroke: backgroundColor,
@@ -3496,6 +3533,7 @@ const annotationAreaBand = (spec, context)=>{
3496
3533
  visible: backgroundVisible,
3497
3534
  padding: backgroundPadding,
3498
3535
  style: {
3536
+ dy: textFontSize,
3499
3537
  cornerRadius: backgroundBorderRadius ?? 4,
3500
3538
  fill: backgroundColor,
3501
3539
  stroke: backgroundBorderColor,
@@ -4627,6 +4665,7 @@ const reshapeTo1D = (advancedVSeed, context)=>{
4627
4665
  datasetReshapeInfo: [
4628
4666
  {
4629
4667
  id: '1D2M',
4668
+ index: 0,
4630
4669
  foldInfo,
4631
4670
  unfoldInfo
4632
4671
  }
@@ -4648,7 +4687,7 @@ const pivotReshapeTo1D = (advancedVSeed, context)=>{
4648
4687
  });
4649
4688
  const newDatasets = [];
4650
4689
  const datasetReshapeInfo = [];
4651
- measureGroups.forEach((measureGroup)=>{
4690
+ measureGroups.forEach((measureGroup, index)=>{
4652
4691
  const measures = measureGroup.children;
4653
4692
  if (!measures) return;
4654
4693
  const commonDimensions = dimensions.filter((dim)=>'dimension' === dim.location);
@@ -4661,6 +4700,7 @@ const pivotReshapeTo1D = (advancedVSeed, context)=>{
4661
4700
  });
4662
4701
  const reshapeInfo = {
4663
4702
  id: groupId,
4703
+ index,
4664
4704
  foldInfo,
4665
4705
  unfoldInfo
4666
4706
  };
@@ -4673,7 +4713,7 @@ const pivotReshapeTo1D = (advancedVSeed, context)=>{
4673
4713
  datasetReshapeInfo: datasetReshapeInfo
4674
4714
  };
4675
4715
  };
4676
- const encodingXYY = (advancedVSeed)=>{
4716
+ const encodingAreaRange = (advancedVSeed)=>{
4677
4717
  const result = {
4678
4718
  ...advancedVSeed
4679
4719
  };
@@ -4750,7 +4790,7 @@ const areaRangeAdvancedPipeline = [
4750
4790
  ], [
4751
4791
  pivotReshapeTo1D
4752
4792
  ]),
4753
- encodingXYY,
4793
+ encodingAreaRange,
4754
4794
  sortXBandAxis,
4755
4795
  areaConfig,
4756
4796
  theme_theme,
@@ -5072,6 +5112,7 @@ const reshapeTo1D2M = (advancedVSeed, context)=>{
5072
5112
  datasetReshapeInfo: [
5073
5113
  {
5074
5114
  id: '1D2M',
5115
+ index: 0,
5075
5116
  foldInfo,
5076
5117
  unfoldInfo
5077
5118
  }
@@ -5093,7 +5134,7 @@ const pivotReshapeTo1D2M = (advancedVSeed, context)=>{
5093
5134
  });
5094
5135
  const newDatasets = [];
5095
5136
  const datasetReshapeInfo = [];
5096
- measureGroups.forEach((measureGroup)=>{
5137
+ measureGroups.forEach((measureGroup, index)=>{
5097
5138
  const measures = measureGroup.children;
5098
5139
  if (!measures) return;
5099
5140
  const commonDimensions = dimensions.filter((dim)=>'dimension' === dim.location);
@@ -5106,6 +5147,7 @@ const pivotReshapeTo1D2M = (advancedVSeed, context)=>{
5106
5147
  });
5107
5148
  const reshapeInfo = {
5108
5149
  id: groupId,
5150
+ index,
5109
5151
  foldInfo,
5110
5152
  unfoldInfo
5111
5153
  };
@@ -5285,69 +5327,7 @@ const registerScatter = ()=>{
5285
5327
  Builder._advancedPipelineMap.scatter = scatterAdvancedPipeline;
5286
5328
  Builder._specPipelineMap.scatter = scatterSpecPipeline;
5287
5329
  };
5288
- const dataReshapeFor1D1M_emptyReshapeResult = {
5289
- dataset: [],
5290
- foldInfo: {
5291
- foldMap: {},
5292
- measureId: '',
5293
- measureName: '',
5294
- measureValue: ''
5295
- },
5296
- unfoldInfo: {
5297
- groupName: '',
5298
- groupId: '',
5299
- colorItems: [],
5300
- colorIdMap: {}
5301
- }
5302
- };
5303
- const dataReshapeFor1D1M = (dataset, dimensions, measures, options)=>{
5304
- const { foldMeasureId = FoldMeasureId, foldMeasureName = FoldMeasureName, foldMeasureValue = FoldMeasureValue, unfoldDimensionGroup = UnfoldDimensionGroup, unfoldDimensionGroupId = UnfoldDimensionGroupId } = options || {};
5305
- if (0 === dimensions.length && 0 === measures.length) return dataReshapeFor1D1M_emptyReshapeResult;
5306
- const { dataset: foldedDataset, foldInfo } = foldMeasures(dataset, measures, foldMeasureId, foldMeasureName, foldMeasureValue);
5307
- if (0 === dimensions.length) {
5308
- const { dataset: finalDataset, unfoldInfo } = unfoldDimensions(foldedDataset, [
5309
- {
5310
- id: foldMeasureName,
5311
- alias: i18n`指标名称`,
5312
- location: 'dimension'
5313
- }
5314
- ], [
5315
- {
5316
- id: foldMeasureValue,
5317
- alias: i18n`指标值`
5318
- }
5319
- ], 0, unfoldDimensionGroup, unfoldDimensionGroupId, foldMeasureId);
5320
- return {
5321
- dataset: finalDataset,
5322
- foldInfo,
5323
- unfoldInfo
5324
- };
5325
- }
5326
- {
5327
- const dims = 1 === measures.length ? [
5328
- ...dimensions
5329
- ] : [
5330
- ...dimensions,
5331
- {
5332
- id: foldMeasureName,
5333
- alias: i18n`指标名称`,
5334
- location: 'dimension'
5335
- }
5336
- ];
5337
- const { dataset: finalDataset, unfoldInfo } = unfoldDimensions(foldedDataset, dims, [
5338
- {
5339
- id: foldMeasureValue,
5340
- alias: i18n`指标值`
5341
- }
5342
- ], 0, unfoldDimensionGroup, unfoldDimensionGroupId, foldMeasureId);
5343
- return {
5344
- dataset: finalDataset,
5345
- foldInfo,
5346
- unfoldInfo
5347
- };
5348
- }
5349
- };
5350
- const reshapeTo1D1M = (advancedVSeed, context)=>{
5330
+ const reshapeTo2D2M = (advancedVSeed, context)=>{
5351
5331
  const result = {
5352
5332
  ...advancedVSeed
5353
5333
  };
@@ -5356,84 +5336,138 @@ const reshapeTo1D1M = (advancedVSeed, context)=>{
5356
5336
  const { dimensions, measures } = advancedVSeed;
5357
5337
  if (!measures || !dimensions || !dataset) return result;
5358
5338
  if (0 === measures.length) throw new Error('measures can not be empty');
5359
- const { dataset: newDatasets, foldInfo, unfoldInfo } = dataReshapeFor1D1M(dataset, dimensions, measures);
5339
+ if (measures.length > 2) throw new Error('measures can not be more than 2');
5340
+ const commonDimensions = dimensions.filter((dim)=>'dimension' === dim.location);
5341
+ const datasets = [];
5342
+ const foldInfoList = [];
5343
+ const unfoldInfoList = [];
5344
+ const primaryMeasures = measures[0];
5345
+ const secondaryMeasures = measures[1] || [];
5346
+ if (primaryMeasures && primaryMeasures.children) {
5347
+ const { dataset: newDatasets, foldInfo, unfoldInfo } = dataReshapeFor2D1M(dataset, commonDimensions, primaryMeasures.children, {
5348
+ foldMeasureValue: FoldPrimaryMeasureValue
5349
+ });
5350
+ datasets.push(newDatasets);
5351
+ foldInfoList.push(foldInfo);
5352
+ unfoldInfoList.push(unfoldInfo);
5353
+ }
5354
+ if (secondaryMeasures && secondaryMeasures.children) {
5355
+ const { dataset: newDatasets, foldInfo, unfoldInfo } = dataReshapeFor2D1M(dataset, commonDimensions, secondaryMeasures.children, {
5356
+ foldMeasureValue: FoldSecondaryMeasureValue
5357
+ });
5358
+ datasets.push(newDatasets);
5359
+ foldInfoList.push(foldInfo);
5360
+ unfoldInfoList.push(unfoldInfo);
5361
+ }
5362
+ const unfoldInfo = {
5363
+ groupName: unfoldInfoList[0].groupName,
5364
+ groupId: unfoldInfoList[0].groupId,
5365
+ colorItems: unfoldInfoList.flatMap((d)=>d.colorItems),
5366
+ colorIdMap: unfoldInfoList.reduce((prev, cur)=>({
5367
+ ...prev,
5368
+ ...cur.colorIdMap
5369
+ }), {})
5370
+ };
5360
5371
  return {
5361
5372
  ...result,
5362
- dataset: newDatasets,
5373
+ dataset: datasets,
5363
5374
  datasetReshapeInfo: [
5364
5375
  {
5365
- id: '1D1M',
5366
- foldInfo,
5367
- unfoldInfo
5376
+ id: '2D2M',
5377
+ index: 0,
5378
+ foldInfo: foldInfoList[0],
5379
+ foldInfoList: foldInfoList,
5380
+ unfoldInfo: unfoldInfo
5368
5381
  }
5369
5382
  ]
5370
5383
  };
5371
5384
  };
5372
- const pivotReshapeTo1D1M = (advancedVSeed, context)=>{
5385
+ const pivotReshapeTo2D2M = (advancedVSeed, context)=>{
5373
5386
  const result = {
5374
5387
  ...advancedVSeed
5375
5388
  };
5376
5389
  const { vseed } = context;
5377
5390
  const { dataset } = vseed;
5378
- const { measures } = advancedVSeed;
5379
- const dimensions = advancedVSeed.dimensions;
5380
- if (!measures || !dimensions) return result;
5381
- const measureGroups = [];
5382
- if (measures) measures.forEach((measure)=>{
5383
- if (measure.children && measure.children.length > 0) measureGroups.push(measure);
5384
- });
5385
- const newDatasets = [];
5391
+ const { dimensions, measures } = advancedVSeed;
5392
+ if (!measures || !dimensions || !dataset) return result;
5393
+ const commonDimensions = dimensions.filter((dim)=>'dimension' === dim.location);
5394
+ const datasetList = [];
5386
5395
  const datasetReshapeInfo = [];
5387
- measureGroups.forEach((measureGroup)=>{
5388
- const measures = measureGroup.children;
5389
- if (!measures) return;
5390
- const commonDimensions = dimensions.filter((dim)=>'dimension' === dim.location);
5391
- const groupId = measureGroup.id;
5392
- const { dataset: newSubDataset, foldInfo, unfoldInfo } = dataReshapeFor1D1M(dataset, commonDimensions, measures, {
5393
- foldMeasureId: FoldMeasureId,
5394
- foldMeasureName: FoldMeasureName,
5395
- foldMeasureValue: FoldMeasureValue + groupId,
5396
- unfoldDimensionGroup: UnfoldDimensionGroup
5397
- });
5396
+ measures.forEach((measureGroup, index)=>{
5397
+ const measures = measureGroup.children || [];
5398
+ if (0 === measures.length) throw new Error('measures can not be empty');
5399
+ if (measures.length > 2) throw new Error('measures can not be more than 2');
5400
+ const datasets = [];
5401
+ const foldInfoList = [];
5402
+ const unfoldInfoList = [];
5403
+ const primaryMeasures = measures[0];
5404
+ const secondaryMeasures = measures[1] || measures[0];
5405
+ if (primaryMeasures && primaryMeasures.children) {
5406
+ const { dataset: newDatasets, foldInfo, unfoldInfo } = dataReshapeFor2D1M(dataset, commonDimensions, primaryMeasures.children, {
5407
+ foldMeasureValue: `${FoldPrimaryMeasureValue}${index}`
5408
+ });
5409
+ datasets.push(newDatasets);
5410
+ foldInfoList.push(foldInfo);
5411
+ unfoldInfoList.push(unfoldInfo);
5412
+ }
5413
+ if (secondaryMeasures && secondaryMeasures.children) {
5414
+ const { dataset: newDatasets, foldInfo, unfoldInfo } = dataReshapeFor2D1M(dataset, commonDimensions, secondaryMeasures.children, {
5415
+ foldMeasureValue: `${FoldSecondaryMeasureValue}${index}`
5416
+ });
5417
+ datasets.push(newDatasets);
5418
+ foldInfoList.push(foldInfo);
5419
+ unfoldInfoList.push(unfoldInfo);
5420
+ }
5421
+ datasetList.push(datasets.flat(2));
5422
+ const unfoldInfo = {
5423
+ groupName: unfoldInfoList[0].groupName,
5424
+ groupId: unfoldInfoList[0].groupId,
5425
+ colorItems: unfoldInfoList.flatMap((d)=>d.colorItems),
5426
+ colorIdMap: unfoldInfoList.reduce((prev, cur)=>({
5427
+ ...prev,
5428
+ ...cur.colorIdMap
5429
+ }), {})
5430
+ };
5398
5431
  const reshapeInfo = {
5399
- id: groupId,
5400
- foldInfo,
5401
- unfoldInfo
5432
+ id: `2D2M-${index}`,
5433
+ index,
5434
+ foldInfo: foldInfoList[0],
5435
+ unfoldInfo: unfoldInfo,
5436
+ foldInfoList: foldInfoList
5402
5437
  };
5403
- newDatasets.push(newSubDataset);
5404
5438
  datasetReshapeInfo.push(reshapeInfo);
5405
5439
  });
5406
5440
  return {
5407
5441
  ...result,
5408
- dataset: newDatasets,
5409
- datasetReshapeInfo: datasetReshapeInfo
5442
+ dataset: datasetList,
5443
+ datasetReshapeInfo
5410
5444
  };
5411
5445
  };
5412
- const encodingPie = (advancedVSeed)=>{
5446
+ const encodingXYY = (advancedVSeed)=>{
5413
5447
  const result = {
5414
5448
  ...advancedVSeed
5415
5449
  };
5416
- const { datasetReshapeInfo } = advancedVSeed;
5417
- if (!datasetReshapeInfo) return result;
5450
+ const { datasetReshapeInfo, dimensions } = advancedVSeed;
5451
+ if (!datasetReshapeInfo || !dimensions) return result;
5452
+ const xDimension = dimensions.find((item)=>'rowDimension' !== item.location && 'columnDimension' !== item.location) || dimensions[0];
5453
+ const isZeroDimension = 0 === dimensions.length;
5418
5454
  const encoding = datasetReshapeInfo.reduce((prev, cur)=>{
5419
- const { foldInfo, unfoldInfo } = cur;
5420
- const radius = [
5421
- foldInfo.measureValue
5422
- ];
5423
- const angle = [
5424
- unfoldInfo.groupId
5455
+ const { foldInfoList, unfoldInfo } = cur;
5456
+ const x = [
5457
+ isZeroDimension ? foldInfoList[0].measureName : xDimension?.id
5425
5458
  ];
5459
+ const y = foldInfoList.map((d)=>d.measureValue);
5426
5460
  const group = [
5427
5461
  unfoldInfo.groupId
5428
5462
  ];
5429
5463
  const color = [
5430
- unfoldInfo.groupId
5464
+ foldInfoList[0].measureName
5431
5465
  ];
5432
5466
  return [
5433
5467
  ...prev,
5434
5468
  {
5435
- angle,
5436
- radius,
5469
+ x,
5470
+ y,
5437
5471
  group,
5438
5472
  color
5439
5473
  }
@@ -5444,36 +5478,1043 @@ const encodingPie = (advancedVSeed)=>{
5444
5478
  encoding
5445
5479
  };
5446
5480
  };
5447
- const pieAdvancedPipeline = [
5481
+ const dualAxisConfig = (advancedVSeed, context)=>{
5482
+ const { vseed } = context;
5483
+ const { chartType } = vseed;
5484
+ const result = {
5485
+ ...advancedVSeed
5486
+ };
5487
+ const config = pick(vseed, [
5488
+ 'backgroundColor',
5489
+ 'color',
5490
+ 'label',
5491
+ 'legend',
5492
+ 'tooltip',
5493
+ 'dualChartType',
5494
+ 'primaryYAxis',
5495
+ 'secondaryYAxis',
5496
+ 'crosshairLine'
5497
+ ]);
5498
+ result.config = {
5499
+ ...result.config || {},
5500
+ [chartType]: {
5501
+ ...config
5502
+ }
5503
+ };
5504
+ return result;
5505
+ };
5506
+ const autoDualMeasures = (advancedVSeed, context)=>{
5507
+ const result = {
5508
+ ...advancedVSeed
5509
+ };
5510
+ const { vseed } = context;
5511
+ const { dataset, dualMeasures, measures } = vseed;
5512
+ if (!dataset) throw new Error('dataset is required');
5513
+ if (0 === dataset.length) return result;
5514
+ if (dualMeasures) {
5515
+ result.measures = dualMeasuresToMeasureTree(dualMeasures);
5516
+ return result;
5517
+ }
5518
+ if (measures && measureDepth(measures) > 1) {
5519
+ result.measures = measures;
5520
+ return result;
5521
+ }
5522
+ const top100dataset = dataset.slice(0, 100);
5523
+ const sample = top100dataset.reduce((prev, cur)=>({
5524
+ ...prev,
5525
+ ...cur
5526
+ }), {});
5527
+ const newMeasures = measures || Object.keys(sample).filter((key)=>top100dataset.some((item)=>'number' == typeof item[key]) && ![
5528
+ '',
5529
+ null,
5530
+ void 0
5531
+ ].includes(key)).map((measure)=>({
5532
+ id: measure,
5533
+ alias: measure
5534
+ }));
5535
+ if (0 === newMeasures.length) result.measures = [];
5536
+ else if (1 === newMeasures.length) result.measures = [
5537
+ {
5538
+ id: 'primary',
5539
+ alias: 'primary',
5540
+ children: newMeasures
5541
+ }
5542
+ ];
5543
+ else if (newMeasures.length > 1) result.measures = [
5544
+ {
5545
+ id: 'primary',
5546
+ alias: 'primary',
5547
+ children: newMeasures.slice(0, 1)
5548
+ },
5549
+ {
5550
+ id: 'secondary',
5551
+ alias: 'secondary',
5552
+ children: newMeasures.slice(1)
5553
+ }
5554
+ ];
5555
+ return result;
5556
+ };
5557
+ const dualMeasuresToMeasureTree = (dualMeasures)=>{
5558
+ const measureTree = dualMeasures.map((item, index)=>{
5559
+ const { primaryMeasures, secondaryMeasures, primaryAlias, secondaryAlias } = item;
5560
+ const groupChildren = [];
5561
+ if (primaryMeasures) {
5562
+ const arrPrimaryMeasures = Array.isArray(primaryMeasures) ? primaryMeasures : [
5563
+ primaryMeasures
5564
+ ];
5565
+ groupChildren.push({
5566
+ id: `${index}-primary`,
5567
+ alias: primaryAlias || arrPrimaryMeasures.map((item)=>item.alias || item.id).toString(),
5568
+ children: arrPrimaryMeasures
5569
+ });
5570
+ }
5571
+ if (secondaryMeasures) {
5572
+ const arrSecondaryMeasures = Array.isArray(secondaryMeasures) ? secondaryMeasures : [
5573
+ secondaryMeasures
5574
+ ];
5575
+ groupChildren.push({
5576
+ id: `${index}-secondary`,
5577
+ alias: secondaryAlias || arrSecondaryMeasures.map((item)=>item.alias || item.id).toString(),
5578
+ children: arrSecondaryMeasures
5579
+ });
5580
+ }
5581
+ const id = [
5582
+ primaryAlias,
5583
+ secondaryAlias,
5584
+ index
5585
+ ].filter((d)=>!isNullish(d)).join('-');
5586
+ return {
5587
+ id,
5588
+ alias: id,
5589
+ children: groupChildren
5590
+ };
5591
+ });
5592
+ if (1 === dualMeasures.length) return measureTree[0].children || [];
5593
+ return measureTree;
5594
+ };
5595
+ const dualAxisAdvancedPipeline = [
5448
5596
  initAdvancedVSeed_initAdvancedVSeed,
5449
- autoMeasures_autoMeasures,
5597
+ autoDualMeasures,
5450
5598
  autoDimensions_autoDimensions,
5451
5599
  pivotAdapter([
5452
- reshapeTo1D1M
5600
+ reshapeTo2D2M
5453
5601
  ], [
5454
- pivotReshapeTo1D1M
5602
+ pivotReshapeTo2D2M
5455
5603
  ]),
5456
- encodingPie,
5457
- pieConfig,
5604
+ encodingXYY,
5605
+ sortXBandAxis,
5606
+ sort_sortLegend,
5607
+ dualAxisConfig,
5458
5608
  theme_theme,
5609
+ markStyle_markStyle,
5459
5610
  annotation_annotation
5460
5611
  ];
5461
- const initPie = (spec, context)=>{
5612
+ const initDualAxisPrimary = (spec, context)=>{
5462
5613
  const result = {
5463
5614
  ...spec
5464
5615
  };
5465
5616
  const { advancedVSeed } = context;
5466
- const { encoding, dataset } = advancedVSeed;
5467
- if (!encoding[0].angle || !encoding[0].radius || !encoding[0].group) return result;
5468
- const showStroke = dataset.length <= 30;
5469
- result.type = 'pie';
5470
- result.outerRadius = 0.8;
5471
- result.innerRadius = 0;
5472
- result.valueField = encoding[0].radius[0];
5473
- result.categoryField = encoding[0].angle[0];
5474
- result.seriesField = encoding[0].group[0];
5475
- result.padding = 0;
5476
- result.region = [
5617
+ const { encoding, datasetReshapeInfo } = advancedVSeed;
5618
+ if (!encoding[0].y || !encoding[0].x || !encoding[0].group) return result;
5619
+ result.id = `${datasetReshapeInfo[0].id}-primary-series`;
5620
+ result.type = 'bar';
5621
+ result.direction = 'vertical';
5622
+ result.xField = encoding[0].x[0];
5623
+ result.yField = encoding[0].y[0];
5624
+ result.seriesField = encoding[0].group[0];
5625
+ result.animation = true;
5626
+ return result;
5627
+ };
5628
+ const initDualAxisSecondary = (spec, context)=>{
5629
+ const result = {
5630
+ ...spec
5631
+ };
5632
+ const { advancedVSeed } = context;
5633
+ const { encoding, datasetReshapeInfo } = advancedVSeed;
5634
+ if (!encoding[0].y || !encoding[0].x || !encoding[0].group) return result;
5635
+ result.id = `${datasetReshapeInfo[0].id}-secondary-series`;
5636
+ result.type = 'line';
5637
+ result.direction = 'vertical';
5638
+ result.xField = encoding[0].x[0];
5639
+ result.yField = encoding[0].y[1];
5640
+ result.seriesField = encoding[0].group[0];
5641
+ result.animation = true;
5642
+ return result;
5643
+ };
5644
+ const dualChartTypePrimary = (spec, context)=>{
5645
+ const result = {
5646
+ ...spec
5647
+ };
5648
+ const { advancedVSeed, vseed } = context;
5649
+ const { chartType } = vseed;
5650
+ const { datasetReshapeInfo } = advancedVSeed;
5651
+ const config = advancedVSeed.config?.[chartType]?.dualChartType || {
5652
+ primary: 'column',
5653
+ secondary: 'line'
5654
+ };
5655
+ if (Array.isArray(config)) return result;
5656
+ switch(config.primary){
5657
+ case 'line':
5658
+ result.type = 'line';
5659
+ break;
5660
+ case 'column':
5661
+ result.type = 'bar';
5662
+ break;
5663
+ case 'columnParallel':
5664
+ {
5665
+ const columnSpec = result;
5666
+ if (Array.isArray(columnSpec.xField)) columnSpec.xField.push(datasetReshapeInfo[0].unfoldInfo.groupId);
5667
+ else if (columnSpec.xField) columnSpec.xField = [
5668
+ columnSpec.xField,
5669
+ datasetReshapeInfo[0].unfoldInfo.groupId
5670
+ ];
5671
+ columnSpec.type = 'bar';
5672
+ break;
5673
+ }
5674
+ case 'columnPercent':
5675
+ result.type = 'bar';
5676
+ result.percent = true;
5677
+ break;
5678
+ case 'area':
5679
+ result.type = 'area';
5680
+ break;
5681
+ case 'areaPercent':
5682
+ result.type = 'area';
5683
+ result.percent = true;
5684
+ break;
5685
+ case 'scatter':
5686
+ result.type = 'scatter';
5687
+ break;
5688
+ default:
5689
+ result.type = config.primary;
5690
+ }
5691
+ return result;
5692
+ };
5693
+ const dualChartTypeSecondary = (spec, context)=>{
5694
+ const result = {
5695
+ ...spec
5696
+ };
5697
+ const { advancedVSeed, vseed } = context;
5698
+ const { chartType } = vseed;
5699
+ const { datasetReshapeInfo } = advancedVSeed;
5700
+ const config = advancedVSeed.config?.[chartType]?.dualChartType || {
5701
+ primary: 'column',
5702
+ secondary: 'line'
5703
+ };
5704
+ if (Array.isArray(config)) return result;
5705
+ switch(config.secondary){
5706
+ case 'line':
5707
+ result.type = 'line';
5708
+ break;
5709
+ case 'column':
5710
+ result.type = 'bar';
5711
+ break;
5712
+ case 'columnParallel':
5713
+ {
5714
+ const columnSpec = result;
5715
+ if (Array.isArray(columnSpec.xField)) columnSpec.xField.push(datasetReshapeInfo[0].unfoldInfo.groupId);
5716
+ else if (columnSpec.xField) columnSpec.xField = [
5717
+ columnSpec.xField,
5718
+ datasetReshapeInfo[0].unfoldInfo.groupId
5719
+ ];
5720
+ columnSpec.type = 'bar';
5721
+ break;
5722
+ }
5723
+ case 'columnPercent':
5724
+ result.type = 'bar';
5725
+ result.percent = true;
5726
+ break;
5727
+ case 'area':
5728
+ result.type = 'area';
5729
+ break;
5730
+ case 'areaPercent':
5731
+ result.type = 'area';
5732
+ result.percent = true;
5733
+ break;
5734
+ case 'scatter':
5735
+ result.type = 'scatter';
5736
+ break;
5737
+ default:
5738
+ result.type = config.secondary;
5739
+ }
5740
+ return result;
5741
+ };
5742
+ const datasetPrimary = (spec, context)=>{
5743
+ const { advancedVSeed, vseed } = context;
5744
+ const { encoding, analysis, datasetReshapeInfo } = advancedVSeed;
5745
+ const { orderMapping = {} } = analysis ?? {};
5746
+ const x = encoding[0]?.x?.[0];
5747
+ const group = encoding[0]?.group?.[0];
5748
+ const id = datasetReshapeInfo[0].id;
5749
+ const fields = {};
5750
+ if (x) {
5751
+ const order = orderMapping[x];
5752
+ if (order) fields[x] = {
5753
+ sortIndex: 0,
5754
+ domain: order,
5755
+ lockStatisticsByDomain: true
5756
+ };
5757
+ else fields[x] = {
5758
+ sortIndex: 0
5759
+ };
5760
+ }
5761
+ if (group) {
5762
+ const order = orderMapping[group];
5763
+ if (order) fields[group] = {
5764
+ sortIndex: 0,
5765
+ domain: order,
5766
+ lockStatisticsByDomain: true
5767
+ };
5768
+ else fields[group] = {
5769
+ sortIndex: 0
5770
+ };
5771
+ }
5772
+ return {
5773
+ ...spec,
5774
+ data: {
5775
+ id: `${id}-primary-dataset`,
5776
+ values: isPivotChart(vseed) ? void 0 : advancedVSeed.dataset[0],
5777
+ fields: fields
5778
+ }
5779
+ };
5780
+ };
5781
+ const datasetSecondary = (spec, context)=>{
5782
+ const { advancedVSeed, vseed } = context;
5783
+ const { encoding, analysis, datasetReshapeInfo } = advancedVSeed;
5784
+ const { orderMapping = {} } = analysis ?? {};
5785
+ const x = encoding[0]?.x?.[0];
5786
+ const group = encoding[0]?.group?.[0];
5787
+ const id = datasetReshapeInfo[0].id;
5788
+ const fields = {};
5789
+ if (x) {
5790
+ const order = orderMapping[x];
5791
+ if (order) fields[x] = {
5792
+ sortIndex: 0,
5793
+ domain: order,
5794
+ lockStatisticsByDomain: true
5795
+ };
5796
+ else fields[x] = {
5797
+ sortIndex: 0
5798
+ };
5799
+ }
5800
+ if (group) {
5801
+ const order = orderMapping[group];
5802
+ if (order) fields[group] = {
5803
+ sortIndex: 0,
5804
+ domain: order,
5805
+ lockStatisticsByDomain: true
5806
+ };
5807
+ else fields[group] = {
5808
+ sortIndex: 0
5809
+ };
5810
+ }
5811
+ return {
5812
+ ...spec,
5813
+ data: {
5814
+ id: `${id}-secondary-dataset`,
5815
+ values: isPivotChart(vseed) ? void 0 : advancedVSeed.dataset[1],
5816
+ fields: fields
5817
+ }
5818
+ };
5819
+ };
5820
+ const labelPrimary = (spec, context)=>{
5821
+ const result = {
5822
+ ...spec
5823
+ };
5824
+ const { advancedVSeed } = context;
5825
+ const { measures, datasetReshapeInfo, locale } = advancedVSeed;
5826
+ const { chartType } = advancedVSeed;
5827
+ const baseConfig = advancedVSeed.config[chartType];
5828
+ if (!baseConfig || !baseConfig.label) return result;
5829
+ const foldInfoList = datasetReshapeInfo[0].foldInfoList;
5830
+ const { measureId, measureValue } = foldInfoList[0];
5831
+ const { label } = baseConfig;
5832
+ const { enable } = label;
5833
+ result.label = {
5834
+ visible: enable,
5835
+ formatMethod: (value, datum)=>{
5836
+ const result = [];
5837
+ const formatValue = (value)=>{
5838
+ const id = datum[measureId];
5839
+ const measure = findMeasureById(measures, id);
5840
+ if (!measure) return value;
5841
+ const { format = {}, autoFormat = true } = measure;
5842
+ if (!isEmpty(format)) {
5843
+ const formatter = createFormatter(format);
5844
+ return formatter(value);
5845
+ }
5846
+ if (autoFormat) return autoFormatter(value, locale);
5847
+ return String(value);
5848
+ };
5849
+ result.push(formatValue(datum[measureValue]));
5850
+ return result.join(' ');
5851
+ }
5852
+ };
5853
+ return result;
5854
+ };
5855
+ const labelSecondary = (spec, context)=>{
5856
+ const result = {
5857
+ ...spec
5858
+ };
5859
+ const { advancedVSeed } = context;
5860
+ const { measures, datasetReshapeInfo, locale } = advancedVSeed;
5861
+ const { chartType } = advancedVSeed;
5862
+ const baseConfig = advancedVSeed.config[chartType];
5863
+ if (!baseConfig || !baseConfig.label) return result;
5864
+ if (isNullish(datasetReshapeInfo[0].foldInfoList?.[1])) return result;
5865
+ const foldInfoList = datasetReshapeInfo[0].foldInfoList;
5866
+ const { measureId, measureValue } = foldInfoList[1];
5867
+ const { label } = baseConfig;
5868
+ const { enable } = label;
5869
+ result.label = {
5870
+ visible: enable,
5871
+ formatMethod: (value, datum)=>{
5872
+ const result = [];
5873
+ const formatValue = (value)=>{
5874
+ const id = datum[measureId];
5875
+ const measure = findMeasureById(measures, id);
5876
+ if (!measure) return value;
5877
+ const { format = {}, autoFormat = true } = measure;
5878
+ if (!isEmpty(format)) {
5879
+ const formatter = createFormatter(format);
5880
+ return formatter(value);
5881
+ }
5882
+ if (autoFormat) return autoFormatter(value, locale);
5883
+ return String(value);
5884
+ };
5885
+ result.push(formatValue(datum[measureValue]));
5886
+ return result.join(' ');
5887
+ }
5888
+ };
5889
+ return result;
5890
+ };
5891
+ const tooltipPrimary = (spec, context)=>{
5892
+ const result = {
5893
+ ...spec
5894
+ };
5895
+ const { advancedVSeed } = context;
5896
+ const { measures, datasetReshapeInfo, chartType, locale, dimensions } = advancedVSeed;
5897
+ const baseConfig = advancedVSeed.config[chartType];
5898
+ const { tooltip = {
5899
+ enable: true
5900
+ } } = baseConfig;
5901
+ const { enable } = tooltip;
5902
+ const foldInfoList = datasetReshapeInfo[0].foldInfoList;
5903
+ const unfoldInfo = datasetReshapeInfo[0].unfoldInfo;
5904
+ const { measureId, measureValue, measureName } = foldInfoList[0];
5905
+ const { groupName } = unfoldInfo;
5906
+ result.tooltip = {
5907
+ visible: enable,
5908
+ mark: {
5909
+ title: {
5910
+ visible: true
5911
+ },
5912
+ content: [
5913
+ ...dimensions.map((item)=>({
5914
+ visible: true,
5915
+ hasShape: true,
5916
+ shapeType: 'rectRound',
5917
+ key: (datum)=>{
5918
+ if (item.alias || item.id) return item.alias || item.id;
5919
+ return datum && datum[item.id];
5920
+ },
5921
+ value: (datum)=>datum && datum[item.id]
5922
+ })),
5923
+ {
5924
+ visible: true,
5925
+ hasShape: true,
5926
+ key: (datum)=>datum && datum[measureName || groupName] || '',
5927
+ value: (datum)=>{
5928
+ if (!datum) return '';
5929
+ const value = datum[measureValue];
5930
+ const id = datum[measureId];
5931
+ const measure = findMeasureById(measures, id);
5932
+ if (!measure) return String(value);
5933
+ const { format = {}, autoFormat = true } = measure;
5934
+ if (!isEmpty(format)) {
5935
+ const formatter = createFormatter(format);
5936
+ return formatter(value);
5937
+ }
5938
+ if (autoFormat) return autoFormatter(value, locale);
5939
+ return String(value);
5940
+ }
5941
+ }
5942
+ ]
5943
+ },
5944
+ dimension: {
5945
+ content: [
5946
+ {
5947
+ visible: true,
5948
+ key: (datum)=>datum && datum[groupName] || '',
5949
+ value: (datum)=>{
5950
+ if (!datum) return '';
5951
+ const value = datum[measureValue];
5952
+ const id = datum[measureId];
5953
+ const measure = findMeasureById(measures, id);
5954
+ if (!measure) return String(value);
5955
+ const { format = {}, autoFormat = true } = measure;
5956
+ if (!isEmpty(format)) {
5957
+ const formatter = createFormatter(format);
5958
+ return formatter(value);
5959
+ }
5960
+ if (autoFormat) return autoFormatter(value, locale);
5961
+ return String(value);
5962
+ },
5963
+ shapeType: 'rectRound'
5964
+ }
5965
+ ]
5966
+ }
5967
+ };
5968
+ return result;
5969
+ };
5970
+ const tooltipSecondary = (spec, context)=>{
5971
+ const result = {
5972
+ ...spec
5973
+ };
5974
+ const { advancedVSeed } = context;
5975
+ const { measures, datasetReshapeInfo, chartType, locale, dimensions } = advancedVSeed;
5976
+ const baseConfig = advancedVSeed.config[chartType];
5977
+ const { tooltip = {
5978
+ enable: true
5979
+ } } = baseConfig;
5980
+ const { enable } = tooltip;
5981
+ if (isNullish(datasetReshapeInfo[0].foldInfoList?.[1])) return result;
5982
+ const foldInfoList = datasetReshapeInfo[0].foldInfoList;
5983
+ const unfoldInfo = datasetReshapeInfo[0].unfoldInfo;
5984
+ const { measureId, measureValue, measureName } = foldInfoList[1];
5985
+ const { groupName } = unfoldInfo;
5986
+ result.tooltip = {
5987
+ visible: enable,
5988
+ mark: {
5989
+ title: {
5990
+ visible: true
5991
+ },
5992
+ content: [
5993
+ ...dimensions.map((item)=>({
5994
+ visible: true,
5995
+ hasShape: true,
5996
+ shapeType: 'rectRound',
5997
+ key: (datum)=>{
5998
+ if (item.alias || item.id) return item.alias || item.id;
5999
+ return datum && datum[item.id];
6000
+ },
6001
+ value: (datum)=>datum && datum[item.id]
6002
+ })),
6003
+ {
6004
+ visible: true,
6005
+ hasShape: true,
6006
+ key: (datum)=>datum && datum[measureName || groupName] || '',
6007
+ value: (datum)=>{
6008
+ if (!datum) return '';
6009
+ const value = datum[measureValue];
6010
+ const id = datum[measureId];
6011
+ const measure = findMeasureById(measures, id);
6012
+ if (!measure) return String(value);
6013
+ const { format = {}, autoFormat = true } = measure;
6014
+ if (!isEmpty(format)) {
6015
+ const formatter = createFormatter(format);
6016
+ return formatter(value);
6017
+ }
6018
+ if (autoFormat) return autoFormatter(value, locale);
6019
+ return String(value);
6020
+ }
6021
+ }
6022
+ ]
6023
+ },
6024
+ dimension: {
6025
+ content: [
6026
+ {
6027
+ visible: true,
6028
+ key: (datum)=>datum && datum[groupName] || '',
6029
+ value: (datum)=>{
6030
+ if (!datum) return '';
6031
+ const value = datum[measureValue];
6032
+ const id = datum[measureId];
6033
+ const measure = findMeasureById(measures, id);
6034
+ if (!measure) return String(value);
6035
+ const { format = {}, autoFormat = true } = measure;
6036
+ if (!isEmpty(format)) {
6037
+ const formatter = createFormatter(format);
6038
+ return formatter(value);
6039
+ }
6040
+ if (autoFormat) return autoFormatter(value, locale);
6041
+ return String(value);
6042
+ },
6043
+ shapeType: 'rectRound'
6044
+ }
6045
+ ]
6046
+ }
6047
+ };
6048
+ return result;
6049
+ };
6050
+ const yLinearPrimary = (spec, context)=>{
6051
+ const result = {
6052
+ ...spec
6053
+ };
6054
+ const { advancedVSeed, vseed } = context;
6055
+ const { chartType } = vseed;
6056
+ const { locale, datasetReshapeInfo } = advancedVSeed;
6057
+ const config = advancedVSeed.config?.[chartType]?.primaryYAxis;
6058
+ if (datasetReshapeInfo[0].foldInfoList?.[0] && isEmpty(datasetReshapeInfo[0].foldInfoList[0].foldMap)) return result;
6059
+ const id = `${datasetReshapeInfo[0].id}-primary-axis`;
6060
+ const seriesId = `${datasetReshapeInfo[0].id}-primary-series`;
6061
+ if (!result.axes) result.axes = [];
6062
+ if (!config) {
6063
+ result.axes = [
6064
+ ...result.axes,
6065
+ {
6066
+ visible: true,
6067
+ id,
6068
+ seriesId,
6069
+ type: 'linear',
6070
+ orient: 'left',
6071
+ sync: {
6072
+ axisId: `${datasetReshapeInfo[0].id}-secondary-axis`,
6073
+ tickAlign: false,
6074
+ zeroAlign: true
6075
+ }
6076
+ }
6077
+ ];
6078
+ return result;
6079
+ }
6080
+ const { visible = true, label, tick, title, grid, line, zero, nice, inverse, max, min, log, logBase = 10 } = config;
6081
+ const linearAxis = {
6082
+ visible,
6083
+ id,
6084
+ seriesId,
6085
+ sync: {
6086
+ axisId: `${datasetReshapeInfo[0].id}-secondary-axis`,
6087
+ tickAlign: false,
6088
+ zeroAlign: true
6089
+ },
6090
+ type: log ? 'log' : 'linear',
6091
+ base: logBase,
6092
+ orient: 'left',
6093
+ nice,
6094
+ zero: log ? false : zero,
6095
+ inverse,
6096
+ max,
6097
+ min,
6098
+ label: {
6099
+ visible: label?.visible,
6100
+ formatMethod: (value)=>autoFormatter(value, locale),
6101
+ style: {
6102
+ fill: label?.labelColor,
6103
+ angle: label?.labelAngle,
6104
+ fontSize: label?.labelFontSize,
6105
+ fontWeight: label?.labelFontWeight
6106
+ }
6107
+ },
6108
+ title: {
6109
+ visible: title?.visible,
6110
+ text: title?.titleText,
6111
+ style: {
6112
+ fill: title?.titleColor,
6113
+ fontSize: title?.titleFontSize,
6114
+ fontWeight: title?.titleFontWeight
6115
+ }
6116
+ },
6117
+ tick: {
6118
+ visible: tick?.visible,
6119
+ tickSize: tick?.tickSize,
6120
+ inside: tick?.tickInside,
6121
+ style: {
6122
+ stroke: tick?.tickColor
6123
+ }
6124
+ },
6125
+ grid: {
6126
+ visible: grid?.visible,
6127
+ style: {
6128
+ lineWidth: grid?.gridWidth,
6129
+ stroke: grid?.gridColor
6130
+ }
6131
+ },
6132
+ domainLine: {
6133
+ visible: line?.visible,
6134
+ style: {
6135
+ lineWidth: line?.lineWidth,
6136
+ stroke: line?.lineColor
6137
+ }
6138
+ },
6139
+ innerOffset: {
6140
+ top: LINEAR_AXIS_INNER_OFFSET_TOP
6141
+ }
6142
+ };
6143
+ result.axes = [
6144
+ ...result.axes,
6145
+ linearAxis
6146
+ ];
6147
+ return result;
6148
+ };
6149
+ const yLinearSecondary = (spec, context)=>{
6150
+ const result = {
6151
+ ...spec
6152
+ };
6153
+ const { advancedVSeed, vseed } = context;
6154
+ const { chartType } = vseed;
6155
+ const { locale, datasetReshapeInfo } = advancedVSeed;
6156
+ const config = advancedVSeed.config?.[chartType]?.secondaryYAxis;
6157
+ if (isNullish(datasetReshapeInfo[0].foldInfoList?.[1])) return result;
6158
+ const id = `${datasetReshapeInfo[0].id}-secondary-axis`;
6159
+ const seriesId = `${datasetReshapeInfo[0].id}-secondary-series`;
6160
+ if (!result.axes) result.axes = [];
6161
+ if (!config) {
6162
+ result.axes = [
6163
+ ...result.axes,
6164
+ {
6165
+ visible: true,
6166
+ id,
6167
+ seriesId,
6168
+ type: 'linear',
6169
+ orient: 'right'
6170
+ }
6171
+ ];
6172
+ return result;
6173
+ }
6174
+ const { visible = true, label, tick, title, grid, line, zero, nice, inverse, max, min, log, logBase = 10 } = config;
6175
+ const linearAxis = {
6176
+ visible,
6177
+ id,
6178
+ seriesId,
6179
+ type: log ? 'log' : 'linear',
6180
+ base: logBase,
6181
+ orient: 'right',
6182
+ nice,
6183
+ zero: log ? false : zero,
6184
+ inverse,
6185
+ max,
6186
+ min,
6187
+ label: {
6188
+ visible: label?.visible,
6189
+ formatMethod: (value)=>autoFormatter(value, locale),
6190
+ style: {
6191
+ fill: label?.labelColor,
6192
+ angle: label?.labelAngle,
6193
+ fontSize: label?.labelFontSize,
6194
+ fontWeight: label?.labelFontWeight
6195
+ }
6196
+ },
6197
+ title: {
6198
+ visible: title?.visible,
6199
+ text: title?.titleText,
6200
+ style: {
6201
+ fill: title?.titleColor,
6202
+ fontSize: title?.titleFontSize,
6203
+ fontWeight: title?.titleFontWeight
6204
+ }
6205
+ },
6206
+ tick: {
6207
+ visible: tick?.visible,
6208
+ tickSize: tick?.tickSize,
6209
+ inside: tick?.tickInside,
6210
+ style: {
6211
+ stroke: tick?.tickColor
6212
+ }
6213
+ },
6214
+ grid: {
6215
+ visible: grid?.visible,
6216
+ style: {
6217
+ lineWidth: grid?.gridWidth,
6218
+ stroke: grid?.gridColor
6219
+ }
6220
+ },
6221
+ domainLine: {
6222
+ visible: line?.visible,
6223
+ style: {
6224
+ lineWidth: line?.lineWidth,
6225
+ stroke: line?.lineColor
6226
+ }
6227
+ },
6228
+ innerOffset: {
6229
+ top: LINEAR_AXIS_INNER_OFFSET_TOP
6230
+ }
6231
+ };
6232
+ result.axes = [
6233
+ ...result.axes,
6234
+ linearAxis
6235
+ ];
6236
+ return result;
6237
+ };
6238
+ const dualAxis = [
6239
+ series([
6240
+ initDualAxisPrimary,
6241
+ dualChartTypePrimary,
6242
+ datasetPrimary,
6243
+ labelPrimary,
6244
+ tooltipPrimary,
6245
+ progressive,
6246
+ barStyle_barStyle,
6247
+ pointStyle_pointStyle,
6248
+ pointStateDimensionHover,
6249
+ lineStyle_lineStyle,
6250
+ areaStyle_areaStyle
6251
+ ], [
6252
+ initDualAxisSecondary,
6253
+ dualChartTypeSecondary,
6254
+ datasetSecondary,
6255
+ labelSecondary,
6256
+ tooltipSecondary,
6257
+ progressive,
6258
+ barStyle_barStyle,
6259
+ pointStyle_pointStyle,
6260
+ pointStateDimensionHover,
6261
+ lineStyle_lineStyle,
6262
+ areaStyle_areaStyle
6263
+ ]),
6264
+ xBand,
6265
+ yLinearPrimary,
6266
+ yLinearSecondary,
6267
+ color_color,
6268
+ background_backgroundColor,
6269
+ discreteLegend,
6270
+ verticalCrosshairRect,
6271
+ annotationPoint_annotationPoint,
6272
+ annotationVerticalLine_annotationVerticalLine,
6273
+ annotationHorizontalLine_annotationHorizontalLine,
6274
+ annotationArea_annotationArea
6275
+ ];
6276
+ const pivotDualAxis = [
6277
+ initPivot,
6278
+ pivotGridStyle,
6279
+ pivotIndicators_pivotIndicatorsAsRow,
6280
+ datasetPivot,
6281
+ pivotIndicators_pivotIndicators([
6282
+ series([
6283
+ initDualAxisPrimary,
6284
+ datasetPrimary,
6285
+ labelPrimary,
6286
+ tooltipPrimary,
6287
+ progressive,
6288
+ barStyle_barStyle,
6289
+ pointStyle_pointStyle,
6290
+ pointStateDimensionHover,
6291
+ lineStyle_lineStyle,
6292
+ areaStyle_areaStyle
6293
+ ], [
6294
+ initDualAxisSecondary,
6295
+ datasetSecondary,
6296
+ labelSecondary,
6297
+ tooltipSecondary,
6298
+ progressive,
6299
+ barStyle_barStyle,
6300
+ pointStyle_pointStyle,
6301
+ pointStateDimensionHover,
6302
+ lineStyle_lineStyle,
6303
+ areaStyle_areaStyle
6304
+ ]),
6305
+ xBand,
6306
+ yLinearPrimary,
6307
+ yLinearSecondary,
6308
+ color_color,
6309
+ background_backgroundColor,
6310
+ verticalCrosshairRect,
6311
+ annotationPoint_annotationPoint,
6312
+ annotationVerticalLine_annotationVerticalLine,
6313
+ annotationHorizontalLine_annotationHorizontalLine,
6314
+ annotationArea_annotationArea
6315
+ ]),
6316
+ pivotRowDimensions,
6317
+ pivotColumnDimensions,
6318
+ pivotDiscreteLegend
6319
+ ];
6320
+ const dualAxisSpecPipeline = [
6321
+ pivotAdapter_pivotAdapter(dualAxis, pivotDualAxis)
6322
+ ];
6323
+ const registerDualAxis = ()=>{
6324
+ Builder._advancedPipelineMap.dualAxis = dualAxisAdvancedPipeline;
6325
+ Builder._specPipelineMap.dualAxis = dualAxisSpecPipeline;
6326
+ };
6327
+ const dataReshapeFor1D1M_emptyReshapeResult = {
6328
+ dataset: [],
6329
+ foldInfo: {
6330
+ foldMap: {},
6331
+ measureId: '',
6332
+ measureName: '',
6333
+ measureValue: ''
6334
+ },
6335
+ unfoldInfo: {
6336
+ groupName: '',
6337
+ groupId: '',
6338
+ colorItems: [],
6339
+ colorIdMap: {}
6340
+ }
6341
+ };
6342
+ const dataReshapeFor1D1M = (dataset, dimensions, measures, options)=>{
6343
+ const { foldMeasureId = FoldMeasureId, foldMeasureName = FoldMeasureName, foldMeasureValue = FoldMeasureValue, unfoldDimensionGroup = UnfoldDimensionGroup, unfoldDimensionGroupId = UnfoldDimensionGroupId } = options || {};
6344
+ if (0 === dimensions.length && 0 === measures.length) return dataReshapeFor1D1M_emptyReshapeResult;
6345
+ const { dataset: foldedDataset, foldInfo } = foldMeasures(dataset, measures, foldMeasureId, foldMeasureName, foldMeasureValue);
6346
+ if (0 === dimensions.length) {
6347
+ const { dataset: finalDataset, unfoldInfo } = unfoldDimensions(foldedDataset, [
6348
+ {
6349
+ id: foldMeasureName,
6350
+ alias: i18n`指标名称`,
6351
+ location: 'dimension'
6352
+ }
6353
+ ], [
6354
+ {
6355
+ id: foldMeasureValue,
6356
+ alias: i18n`指标值`
6357
+ }
6358
+ ], 0, unfoldDimensionGroup, unfoldDimensionGroupId, foldMeasureId);
6359
+ return {
6360
+ dataset: finalDataset,
6361
+ foldInfo,
6362
+ unfoldInfo
6363
+ };
6364
+ }
6365
+ {
6366
+ const dims = 1 === measures.length ? [
6367
+ ...dimensions
6368
+ ] : [
6369
+ ...dimensions,
6370
+ {
6371
+ id: foldMeasureName,
6372
+ alias: i18n`指标名称`,
6373
+ location: 'dimension'
6374
+ }
6375
+ ];
6376
+ const { dataset: finalDataset, unfoldInfo } = unfoldDimensions(foldedDataset, dims, [
6377
+ {
6378
+ id: foldMeasureValue,
6379
+ alias: i18n`指标值`
6380
+ }
6381
+ ], 0, unfoldDimensionGroup, unfoldDimensionGroupId, foldMeasureId);
6382
+ return {
6383
+ dataset: finalDataset,
6384
+ foldInfo,
6385
+ unfoldInfo
6386
+ };
6387
+ }
6388
+ };
6389
+ const reshapeTo1D1M = (advancedVSeed, context)=>{
6390
+ const result = {
6391
+ ...advancedVSeed
6392
+ };
6393
+ const { vseed } = context;
6394
+ const { dataset } = vseed;
6395
+ const { dimensions, measures } = advancedVSeed;
6396
+ if (!measures || !dimensions || !dataset) return result;
6397
+ if (0 === measures.length) throw new Error('measures can not be empty');
6398
+ const { dataset: newDatasets, foldInfo, unfoldInfo } = dataReshapeFor1D1M(dataset, dimensions, measures);
6399
+ return {
6400
+ ...result,
6401
+ dataset: newDatasets,
6402
+ datasetReshapeInfo: [
6403
+ {
6404
+ id: '1D1M',
6405
+ index: 0,
6406
+ foldInfo,
6407
+ unfoldInfo
6408
+ }
6409
+ ]
6410
+ };
6411
+ };
6412
+ const pivotReshapeTo1D1M = (advancedVSeed, context)=>{
6413
+ const result = {
6414
+ ...advancedVSeed
6415
+ };
6416
+ const { vseed } = context;
6417
+ const { dataset } = vseed;
6418
+ const { measures } = advancedVSeed;
6419
+ const dimensions = advancedVSeed.dimensions;
6420
+ if (!measures || !dimensions) return result;
6421
+ const measureGroups = [];
6422
+ if (measures) measures.forEach((measure)=>{
6423
+ if (measure.children && measure.children.length > 0) measureGroups.push(measure);
6424
+ });
6425
+ const newDatasets = [];
6426
+ const datasetReshapeInfo = [];
6427
+ measureGroups.forEach((measureGroup, index)=>{
6428
+ const measures = measureGroup.children;
6429
+ if (!measures) return;
6430
+ const commonDimensions = dimensions.filter((dim)=>'dimension' === dim.location);
6431
+ const groupId = measureGroup.id;
6432
+ const { dataset: newSubDataset, foldInfo, unfoldInfo } = dataReshapeFor1D1M(dataset, commonDimensions, measures, {
6433
+ foldMeasureId: FoldMeasureId,
6434
+ foldMeasureName: FoldMeasureName,
6435
+ foldMeasureValue: FoldMeasureValue + groupId,
6436
+ unfoldDimensionGroup: UnfoldDimensionGroup
6437
+ });
6438
+ const reshapeInfo = {
6439
+ id: groupId,
6440
+ index,
6441
+ foldInfo,
6442
+ unfoldInfo
6443
+ };
6444
+ newDatasets.push(newSubDataset);
6445
+ datasetReshapeInfo.push(reshapeInfo);
6446
+ });
6447
+ return {
6448
+ ...result,
6449
+ dataset: newDatasets,
6450
+ datasetReshapeInfo: datasetReshapeInfo
6451
+ };
6452
+ };
6453
+ const encodingPie = (advancedVSeed)=>{
6454
+ const result = {
6455
+ ...advancedVSeed
6456
+ };
6457
+ const { datasetReshapeInfo } = advancedVSeed;
6458
+ if (!datasetReshapeInfo) return result;
6459
+ const encoding = datasetReshapeInfo.reduce((prev, cur)=>{
6460
+ const { foldInfo, unfoldInfo } = cur;
6461
+ const radius = [
6462
+ foldInfo.measureValue
6463
+ ];
6464
+ const angle = [
6465
+ unfoldInfo.groupId
6466
+ ];
6467
+ const group = [
6468
+ unfoldInfo.groupId
6469
+ ];
6470
+ const color = [
6471
+ unfoldInfo.groupId
6472
+ ];
6473
+ return [
6474
+ ...prev,
6475
+ {
6476
+ angle,
6477
+ radius,
6478
+ group,
6479
+ color
6480
+ }
6481
+ ];
6482
+ }, []);
6483
+ return {
6484
+ ...result,
6485
+ encoding
6486
+ };
6487
+ };
6488
+ const pieAdvancedPipeline = [
6489
+ initAdvancedVSeed_initAdvancedVSeed,
6490
+ autoMeasures_autoMeasures,
6491
+ autoDimensions_autoDimensions,
6492
+ pivotAdapter([
6493
+ reshapeTo1D1M
6494
+ ], [
6495
+ pivotReshapeTo1D1M
6496
+ ]),
6497
+ encodingPie,
6498
+ pieConfig,
6499
+ theme_theme,
6500
+ annotation_annotation
6501
+ ];
6502
+ const initPie = (spec, context)=>{
6503
+ const result = {
6504
+ ...spec
6505
+ };
6506
+ const { advancedVSeed } = context;
6507
+ const { encoding, dataset } = advancedVSeed;
6508
+ if (!encoding[0].angle || !encoding[0].radius || !encoding[0].group) return result;
6509
+ const showStroke = dataset.length <= 30;
6510
+ result.type = 'pie';
6511
+ result.outerRadius = 0.8;
6512
+ result.innerRadius = 0;
6513
+ result.valueField = encoding[0].radius[0];
6514
+ result.categoryField = encoding[0].angle[0];
6515
+ result.seriesField = encoding[0].group[0];
6516
+ result.padding = 0;
6517
+ result.region = [
5477
6518
  {
5478
6519
  clip: true
5479
6520
  }
@@ -6750,6 +7791,17 @@ const lightTheme = ()=>{
6750
7791
  },
6751
7792
  crosshairLine
6752
7793
  },
7794
+ dualAxis: {
7795
+ ...baseConfig,
7796
+ xAxis: bandAxis,
7797
+ primaryYAxis: linearAxis,
7798
+ secondaryYAxis: linearAxis,
7799
+ dualChartType: {
7800
+ primary: 'column',
7801
+ secondary: 'line'
7802
+ },
7803
+ crosshairRect
7804
+ },
6753
7805
  pie: {
6754
7806
  ...baseConfig
6755
7807
  },
@@ -7072,6 +8124,17 @@ const darkTheme = ()=>{
7072
8124
  },
7073
8125
  crosshairLine
7074
8126
  },
8127
+ dualAxis: {
8128
+ ...baseConfig,
8129
+ xAxis: bandAxis,
8130
+ primaryYAxis: linearAxis,
8131
+ secondaryYAxis: linearAxis,
8132
+ dualChartType: {
8133
+ primary: 'column',
8134
+ secondary: 'line'
8135
+ },
8136
+ crosshairRect
8137
+ },
7075
8138
  pie: {
7076
8139
  ...baseConfig
7077
8140
  },
@@ -7137,6 +8200,7 @@ const registerAll = ()=>{
7137
8200
  registerAreaPercent();
7138
8201
  registerAreaRange();
7139
8202
  registerScatter();
8203
+ registerDualAxis();
7140
8204
  registerPie();
7141
8205
  registerDonut();
7142
8206
  registerRose();
@@ -7176,6 +8240,26 @@ const zChartType = z["enum"]([
7176
8240
  'funnel',
7177
8241
  'heatmap'
7178
8242
  ]);
8243
+ const zDualChartType = z.object({
8244
+ primary: z["enum"]([
8245
+ 'line',
8246
+ 'column',
8247
+ 'columnPercent',
8248
+ 'columnParallel',
8249
+ 'area',
8250
+ 'areaPercent',
8251
+ 'scatter'
8252
+ ]).default('column'),
8253
+ secondary: z["enum"]([
8254
+ 'line',
8255
+ 'column',
8256
+ 'columnPercent',
8257
+ 'columnParallel',
8258
+ 'area',
8259
+ 'areaPercent',
8260
+ 'scatter'
8261
+ ]).default('line')
8262
+ });
7179
8263
  const zDatum = z.record(z.string().or(z.number()), z.any());
7180
8264
  const zDataset = z.array(zDatum);
7181
8265
  const zDimension = z.object({
@@ -7241,6 +8325,14 @@ const zMeasureGroup = z.object({
7241
8325
  });
7242
8326
  const zMeasures = z.array(zMeasure);
7243
8327
  const zMeasureTree = z.array(zMeasureGroup.or(zMeasure));
8328
+ const zDualMeasure = z.object({
8329
+ id: z.string(),
8330
+ primaryMeasures: z.array(zMeasure).or(zMeasure).optional(),
8331
+ primaryAlias: z.string().optional(),
8332
+ secondaryMeasures: z.array(zMeasure).or(zMeasure).optional(),
8333
+ secondaryAlias: z.string().optional()
8334
+ });
8335
+ const zDualMeasures = z.array(zDualMeasure);
7244
8336
  const zFoldInfo = z.object({
7245
8337
  foldMap: z.record(z.string(), z.string().or(z.undefined())),
7246
8338
  measureId: z.string(),
@@ -7255,7 +8347,9 @@ const zUnfoldInfo = z.object({
7255
8347
  });
7256
8348
  const zDatasetReshapeInfo = z.array(z.object({
7257
8349
  id: z.string(),
8350
+ index: z.number(),
7258
8351
  foldInfo: zFoldInfo,
8352
+ foldInfoList: z.array(zFoldInfo).optional(),
7259
8353
  unfoldInfo: zUnfoldInfo
7260
8354
  }));
7261
8355
  const zEncoding = z.array(z.object({
@@ -7535,7 +8629,12 @@ const zDualAxisConfig = z.object({
7535
8629
  label: zLabel.optional(),
7536
8630
  color: zColor.optional(),
7537
8631
  tooltip: zTooltip.optional(),
7538
- legend: zLegend.optional()
8632
+ legend: zLegend.optional(),
8633
+ dualChartType: z.array(zDualChartType).or(zDualChartType).optional(),
8634
+ primaryYAxis: z.array(zYLinearAxis).or(zYLinearAxis).optional(),
8635
+ secondaryYAxis: z.array(zYLinearAxis).or(zYLinearAxis).optional(),
8636
+ xAxis: zXBandAxis.optional(),
8637
+ crosshairRect: zCrosshairRect.optional()
7539
8638
  });
7540
8639
  const zScatterConfig = z.object({
7541
8640
  backgroundColor: zBackgroundColor.optional(),
@@ -7579,8 +8678,8 @@ const zConfig = z.object({
7579
8678
  area: zAreaConfig.optional(),
7580
8679
  areaPercent: zAreaPercentConfig.optional(),
7581
8680
  areaRange: zAreaRangeConfig.optional(),
7582
- dualAxis: zDualAxisConfig.optional(),
7583
8681
  scatter: zScatterConfig.optional(),
8682
+ dualAxis: zDualAxisConfig.optional(),
7584
8683
  rose: zRoseConfig.optional(),
7585
8684
  roseParallel: zRoseParallelConfig.optional(),
7586
8685
  pie: zPieConfig.optional(),
@@ -7830,20 +8929,20 @@ const zAnnotationVerticalLine = z.object({
7830
8929
  'middle',
7831
8930
  'bottom'
7832
8931
  ]).default('top').optional(),
7833
- lineVisible: z.boolean().optional(),
7834
- lineColor: z.string().optional(),
7835
- lineWidth: z.number().optional(),
8932
+ lineVisible: z.boolean().default(true).optional(),
8933
+ lineColor: z.string().default('#212121').optional(),
8934
+ lineWidth: z.number().default(1).optional(),
7836
8935
  lineStyle: z.union([
7837
8936
  z.literal('solid'),
7838
8937
  z.literal('dashed'),
7839
8938
  z.literal('dotted')
7840
- ]).optional(),
8939
+ ]).default('dashed').optional(),
7841
8940
  backgroundVisible: z.boolean().default(true).optional(),
7842
8941
  backgroundColor: z.string().default('#212121').optional(),
7843
- backgroundBorderColor: z.string().optional(),
7844
- backgroundBorderWidth: z.number().default(1).optional(),
8942
+ backgroundBorderColor: z.string().default('#212121').optional(),
7845
8943
  backgroundBorderRadius: z.number().default(4).optional(),
7846
- backgroundPadding: z.number().optional(),
8944
+ backgroundBorderWidth: z.number().default(1).optional(),
8945
+ backgroundPadding: z.number().default(2).optional(),
7847
8946
  offsetX: z.number().default(0),
7848
8947
  offsetY: z.number().default(0)
7849
8948
  });
@@ -7868,7 +8967,7 @@ const zAnnotationHorizontalLine = z.object({
7868
8967
  'insideStart',
7869
8968
  'insideMiddle',
7870
8969
  'insideEnd'
7871
- ]).default('insideMiddle').optional(),
8970
+ ]).default('insideEnd').optional(),
7872
8971
  textColor: z.string().default('#ffffff').optional(),
7873
8972
  textFontSize: z.number().default(12).optional(),
7874
8973
  textFontWeight: z.number().default(400).optional(),
@@ -7876,26 +8975,26 @@ const zAnnotationHorizontalLine = z.object({
7876
8975
  'left',
7877
8976
  'right',
7878
8977
  'center'
7879
- ]).default('center').optional(),
8978
+ ]).default('right').optional(),
7880
8979
  textBaseline: z["enum"]([
7881
8980
  'top',
7882
8981
  'middle',
7883
8982
  'bottom'
7884
- ]).default('bottom').optional(),
7885
- lineVisible: z.boolean().optional(),
7886
- lineColor: z.string().optional(),
7887
- lineWidth: z.number().optional(),
8983
+ ]).default('top').optional(),
8984
+ lineVisible: z.boolean().default(true).optional(),
8985
+ lineColor: z.string().default('#212121').optional(),
8986
+ lineWidth: z.number().default(1).optional(),
7888
8987
  lineStyle: z.union([
7889
8988
  z.literal('solid'),
7890
8989
  z.literal('dashed'),
7891
8990
  z.literal('dotted')
7892
- ]).optional(),
8991
+ ]).default('dashed').optional(),
7893
8992
  backgroundVisible: z.boolean().default(true).optional(),
7894
8993
  backgroundColor: z.string().default('#212121').optional(),
7895
- backgroundBorderColor: z.string().optional(),
7896
- backgroundBorderWidth: z.number().default(1).optional(),
8994
+ backgroundBorderColor: z.string().default('#212121').optional(),
7897
8995
  backgroundBorderRadius: z.number().default(4).optional(),
7898
- backgroundPadding: z.number().optional(),
8996
+ backgroundBorderWidth: z.number().default(1).optional(),
8997
+ backgroundPadding: z.number().default(2).optional(),
7899
8998
  offsetX: z.number().default(0),
7900
8999
  offsetY: z.number().default(0)
7901
9000
  });
@@ -7927,21 +9026,21 @@ const zAnnotationArea = z.object({
7927
9026
  'top',
7928
9027
  'middle',
7929
9028
  'bottom'
7930
- ]).default('middle').optional(),
9029
+ ]).default('top').optional(),
7931
9030
  backgroundVisible: z.boolean().default(true).optional(),
7932
- backgroundColor: z.string().default('#212121').optional(),
7933
- backgroundBorderColor: z.string().optional(),
9031
+ backgroundColor: z.string().default('#191d24').optional(),
9032
+ backgroundBorderColor: z.string().default('#191d24').optional(),
7934
9033
  backgroundBorderWidth: z.number().default(1).optional(),
7935
9034
  backgroundBorderRadius: z.number().default(4).optional(),
7936
- backgroundPadding: z.number().optional(),
7937
- areaColor: z.string().default('red').optional(),
7938
- areaColorOpacity: z.number().default(0.5).optional(),
7939
- areaBorderColor: z.number().optional(),
7940
- areaBorderWidth: z.number().default(2).optional(),
9035
+ backgroundPadding: z.number().default(4).optional(),
9036
+ areaColor: z.string().default('#888888').optional(),
9037
+ areaColorOpacity: z.number().default(0.15).optional(),
9038
+ areaBorderColor: z.string().default('#888888').optional(),
9039
+ areaBorderWidth: z.number().default(1).optional(),
7941
9040
  areaBorderRadius: z.number().default(4).optional(),
7942
- outerPadding: z.number().optional(),
7943
- offsetX: z.number().optional(),
7944
- offsetY: z.number().optional()
9041
+ outerPadding: z.number().default(4).optional(),
9042
+ offsetX: z.number().default(0).optional(),
9043
+ offsetY: z.number().default(0).optional()
7945
9044
  });
7946
9045
  const zAnnotation = z.object({
7947
9046
  annotationPoint: zAnnotationPoint.or(z.array(zAnnotationPoint)).optional(),
@@ -8233,6 +9332,35 @@ const zScatter = z.object({
8233
9332
  annotationArea: z.array(zAnnotationArea).or(zAnnotationArea).optional(),
8234
9333
  locale: zLocale.optional()
8235
9334
  });
9335
+ const zDualAxis = z.object({
9336
+ chartType: z.literal('dualAxis'),
9337
+ dataset: zDataset.optional(),
9338
+ dimensions: zDimensions.optional(),
9339
+ measures: zMeasureTree.optional(),
9340
+ dualMeasures: zDualMeasures.optional(),
9341
+ dualChartType: z.array(zDualChartType).or(zDualChartType).optional(),
9342
+ primaryYAxis: z.array(zYLinearAxis).or(zYLinearAxis).optional(),
9343
+ secondaryYAxis: z.array(zYLinearAxis).or(zYLinearAxis).optional(),
9344
+ xAxis: zXBandAxis.optional(),
9345
+ backgroundColor: zBackgroundColor.optional(),
9346
+ color: zColor.optional(),
9347
+ label: zLabel.optional(),
9348
+ legend: zLegend.optional(),
9349
+ tooltip: zTooltip.optional(),
9350
+ crosshairRect: zCrosshairRect.optional(),
9351
+ sort: zSort.optional(),
9352
+ sortLegend: zSortLegend.optional(),
9353
+ theme: zTheme.optional(),
9354
+ barStyle: z.array(zBarStyle).or(zBarStyle).optional(),
9355
+ pointStyle: z.array(zPointStyle).or(zPointStyle).optional(),
9356
+ lineStyle: z.array(zLineStyle).or(zLineStyle).optional(),
9357
+ areaStyle: z.array(zAreaStyle).or(zAreaStyle).optional(),
9358
+ annotationPoint: z.array(zAnnotationPoint).or(zAnnotationPoint).optional(),
9359
+ annotationVerticalLine: z.array(zAnnotationVerticalLine).or(zAnnotationVerticalLine).optional(),
9360
+ annotationHorizontalLine: z.array(zAnnotationHorizontalLine).or(zAnnotationHorizontalLine).optional(),
9361
+ annotationArea: z.array(zAnnotationArea).or(zAnnotationArea).optional(),
9362
+ locale: zLocale.optional()
9363
+ });
8236
9364
  const zRose = z.object({
8237
9365
  chartType: z.literal('rose'),
8238
9366
  dataset: zDataset.optional(),
@@ -8338,6 +9466,7 @@ const zVSeed = z.discriminatedUnion('chartType', [
8338
9466
  zAreaPercent,
8339
9467
  zAreaRange,
8340
9468
  zScatter,
9469
+ zDualAxis,
8341
9470
  zPie,
8342
9471
  zDonut,
8343
9472
  zRose,
@@ -8361,6 +9490,6 @@ const zAdvancedVSeed = z.object({
8361
9490
  annotation: zAnnotation,
8362
9491
  locale: zLocale
8363
9492
  });
8364
- export { Builder, FoldMeasureId, FoldMeasureName, FoldMeasureValue, ORIGINAL_DATA, Separator, UnfoldDimensionGroup, UnfoldDimensionGroupId, areaAdvancedPipeline, areaPercentAdvancedPipeline, areaPercentSpecPipeline, areaRangeAdvancedPipeline, areaRangeSpecPipeline, areaSpecPipeline, autoFormatter, autoNumFormatter, barAdvancedPipeline, barParallelAdvancedPipeline, barParallelSpecPipeline, barPercentAdvancedPipeline, barPercentSpecPipeline, barSpecPipeline, columnAdvancedPipeline, columnParallelAdvancedPipeline, columnParallelSpecPipeline, columnPercentAdvancedPipeline, columnPercentSpecPipeline, columnSpecPipeline, createFormatter, createNumFormatter, darkTheme, dataReshapeFor1D, dataReshapeFor1D1M, dataReshapeFor1D2M, dataReshapeFor2D1M, dataReshapeFor2D1M0Name, donutAdvancedPipeline, donutSpecPipeline, execPipeline, findAllDimensions, findAllMeasures, findDimensionById, findFirstDimension, findFirstMeasure, findMeasureById, foldMeasures, funnelAdvancedPipeline, funnelSpecPipeline, heatmapAdvancedPipeline, heatmapSpecPipeline, i18n, intl, isDimensionSelector, isMeasureSelector, isPartialDatumSelector, isPivotChart, isPivotTable, isTable, isVChart, isVTable, isValueSelector, lightTheme, lineAdvancedPipeline, lineSpecPipeline, pieAdvancedPipeline, pieSpecPipeline, pivotTableAdvancedPipeline, pivotTableSpecPipeline, preorderTraverse, radarAdvancedPipeline, radarSpecPipeline, registerAll, registerArea, registerAreaPercent, registerAreaRange, registerBar, registerBarParallel, registerBarPercent, registerColumn, registerColumnParallel, registerColumnPercent, registerCustomTheme, registerDarkTheme, registerDonut, registerFunnel, registerHeatmap, registerLightTheme, registerLine, registerPie, registerPivotTable, registerRadar, registerRose, registerRoseParallel, registerScatter, registerTable, roseAdvancedPipeline, roseParallelAdvancedPipeline, roseParallelSpecPipeline, roseSpecPipeline, scatterAdvancedPipeline, scatterSpecPipeline, selector_selector as selector, tableAdvancedPipeline, tableSpecPipeline, unfoldDimensions, updateAdvanced, updateSpec, zAdvancedVSeed, zAnalysis, zAnnotation, zAnnotationArea, zAnnotationHorizontalLine, zAnnotationPoint, zAnnotationVerticalLine, zArea, zAreaConfig, zAreaPercent, zAreaPercentConfig, zAreaRange, zAreaRangeConfig, zAreaStyle, zAxis, zBackgroundColor, zBar, zBarConfig, zBarParallel, zBarParallelConfig, zBarPercent, zBarPercentConfig, zBarStyle, zChartType, zColor, zColorLegend, zColumn, zColumnConfig, zColumnParallel, zColumnParallelConfig, zColumnPercent, zColumnPercentConfig, zConfig, zCrosshairLine, zCrosshairRect, zCustomTheme, zCustomThemeConfig, zDataset, zDatasetReshapeInfo, zDatum, zDimension, zDimensionGroup, zDimensionTree, zDimensions, zDonut, zDonutConfig, zDualAxisConfig, zEncoding, zFoldInfo, zFunnel, zFunnelConfig, zHeatmap, zHeatmapConfig, zLabel, zLegend, zLine, zLineConfig, zLineStyle, zLinearColor, zLocale, zMarkStyle, zMeasure, zMeasureGroup, zMeasureTree, zMeasures, zNumFormat, zPie, zPieConfig, zPivotTable, zPivotTableConfig, zPointStyle, zRadar, zRadarConfig, zRose, zRoseConfig, zRoseParallel, zRoseParallelConfig, zScatter, zScatterConfig, zSort, zSortLegend, zStackCornerRadius, zTable, zTableConfig, zTheme, zTooltip, zUnfoldInfo, zVSeed, zXBandAxis, zXLinearAxis, zYBandAxis, zYLinearAxis };
9493
+ export { Builder, FoldMeasureId, FoldMeasureName, FoldMeasureValue, FoldPrimaryMeasureValue, FoldSecondaryMeasureValue, ORIGINAL_DATA, Separator, UnfoldDimensionGroup, UnfoldDimensionGroupId, areaAdvancedPipeline, areaPercentAdvancedPipeline, areaPercentSpecPipeline, areaRangeAdvancedPipeline, areaRangeSpecPipeline, areaSpecPipeline, autoFormatter, autoNumFormatter, barAdvancedPipeline, barParallelAdvancedPipeline, barParallelSpecPipeline, barPercentAdvancedPipeline, barPercentSpecPipeline, barSpecPipeline, columnAdvancedPipeline, columnParallelAdvancedPipeline, columnParallelSpecPipeline, columnPercentAdvancedPipeline, columnPercentSpecPipeline, columnSpecPipeline, createFormatter, createNumFormatter, darkTheme, dataReshapeFor1D, dataReshapeFor1D1M, dataReshapeFor1D2M, dataReshapeFor2D1M, dataReshapeFor2D1M0Name, donutAdvancedPipeline, donutSpecPipeline, dualAxisAdvancedPipeline, dualAxisSpecPipeline, execPipeline, findAllDimensions, findAllMeasures, findDimensionById, findFirstDimension, findFirstMeasure, findMeasureById, foldMeasures, funnelAdvancedPipeline, funnelSpecPipeline, heatmapAdvancedPipeline, heatmapSpecPipeline, i18n, intl, isDimensionSelector, isMeasureSelector, isPartialDatumSelector, isPivotChart, isPivotTable, isTable, isVChart, isVTable, isValueSelector, lightTheme, lineAdvancedPipeline, lineSpecPipeline, measureDepth, pieAdvancedPipeline, pieSpecPipeline, pivotTableAdvancedPipeline, pivotTableSpecPipeline, preorderTraverse, radarAdvancedPipeline, radarSpecPipeline, registerAll, registerArea, registerAreaPercent, registerAreaRange, registerBar, registerBarParallel, registerBarPercent, registerColumn, registerColumnParallel, registerColumnPercent, registerCustomTheme, registerDarkTheme, registerDonut, registerFunnel, registerHeatmap, registerLightTheme, registerLine, registerPie, registerPivotTable, registerRadar, registerRose, registerRoseParallel, registerScatter, registerTable, roseAdvancedPipeline, roseParallelAdvancedPipeline, roseParallelSpecPipeline, roseSpecPipeline, scatterAdvancedPipeline, scatterSpecPipeline, selector_selector as selector, tableAdvancedPipeline, tableSpecPipeline, unfoldDimensions, updateAdvanced, updateSpec, zAdvancedVSeed, zAnalysis, zAnnotation, zAnnotationArea, zAnnotationHorizontalLine, zAnnotationPoint, zAnnotationVerticalLine, zArea, zAreaConfig, zAreaPercent, zAreaPercentConfig, zAreaRange, zAreaRangeConfig, zAreaStyle, zAxis, zBackgroundColor, zBar, zBarConfig, zBarParallel, zBarParallelConfig, zBarPercent, zBarPercentConfig, zBarStyle, zChartType, zColor, zColorLegend, zColumn, zColumnConfig, zColumnParallel, zColumnParallelConfig, zColumnPercent, zColumnPercentConfig, zConfig, zCrosshairLine, zCrosshairRect, zCustomTheme, zCustomThemeConfig, zDataset, zDatasetReshapeInfo, zDatum, zDimension, zDimensionGroup, zDimensionTree, zDimensions, zDonut, zDonutConfig, zDualAxis, zDualAxisConfig, zDualChartType, zDualMeasure, zDualMeasures, zEncoding, zFoldInfo, zFunnel, zFunnelConfig, zHeatmap, zHeatmapConfig, zLabel, zLegend, zLine, zLineConfig, zLineStyle, zLinearColor, zLocale, zMarkStyle, zMeasure, zMeasureGroup, zMeasureTree, zMeasures, zNumFormat, zPie, zPieConfig, zPivotTable, zPivotTableConfig, zPointStyle, zRadar, zRadarConfig, zRose, zRoseConfig, zRoseParallel, zRoseParallelConfig, zScatter, zScatterConfig, zSort, zSortLegend, zStackCornerRadius, zTable, zTableConfig, zTheme, zTooltip, zUnfoldInfo, zVSeed, zXBandAxis, zXLinearAxis, zYBandAxis, zYLinearAxis };
8365
9494
 
8366
9495
  //# sourceMappingURL=index.js.map