@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.cjs CHANGED
@@ -32,10 +32,11 @@ __webpack_require__.d(__webpack_exports__, {
32
32
  areaSpecPipeline: ()=>areaSpecPipeline,
33
33
  isTable: ()=>isTable,
34
34
  zDonut: ()=>zDonut,
35
+ zDualMeasures: ()=>zDualMeasures,
35
36
  zPie: ()=>zPie,
36
- zRoseConfig: ()=>zRoseConfig,
37
37
  findFirstMeasure: ()=>findFirstMeasure,
38
38
  scatterAdvancedPipeline: ()=>scatterAdvancedPipeline,
39
+ zRoseConfig: ()=>zRoseConfig,
39
40
  updateSpec: ()=>updateSpec,
40
41
  zCrosshairRect: ()=>zCrosshairRect,
41
42
  scatterSpecPipeline: ()=>scatterSpecPipeline,
@@ -44,6 +45,7 @@ __webpack_require__.d(__webpack_exports__, {
44
45
  zColumnConfig: ()=>zColumnConfig,
45
46
  zAnnotation: ()=>zAnnotation,
46
47
  selector: ()=>selector_selector,
48
+ zDualMeasure: ()=>zDualMeasure,
47
49
  zSortLegend: ()=>zSortLegend,
48
50
  pivotTableAdvancedPipeline: ()=>pivotTableAdvancedPipeline,
49
51
  zYBandAxis: ()=>zYBandAxis,
@@ -103,27 +105,27 @@ __webpack_require__.d(__webpack_exports__, {
103
105
  registerPivotTable: ()=>registerPivotTable,
104
106
  tableAdvancedPipeline: ()=>tableAdvancedPipeline,
105
107
  pieSpecPipeline: ()=>pieSpecPipeline,
108
+ dualAxisSpecPipeline: ()=>dualAxisSpecPipeline,
106
109
  registerDarkTheme: ()=>registerDarkTheme,
107
110
  zAnnotationVerticalLine: ()=>zAnnotationVerticalLine,
108
- zChartType: ()=>zChartType,
109
111
  barSpecPipeline: ()=>barSpecPipeline,
110
- zCrosshairLine: ()=>zCrosshairLine,
112
+ zChartType: ()=>zChartType,
111
113
  registerRose: ()=>registerRose,
112
- zMeasureTree: ()=>zMeasureTree,
114
+ zCrosshairLine: ()=>zCrosshairLine,
113
115
  unfoldDimensions: ()=>unfoldDimensions,
114
116
  roseParallelAdvancedPipeline: ()=>roseParallelAdvancedPipeline,
115
117
  registerTable: ()=>registerTable,
116
- Builder: ()=>Builder,
117
118
  autoFormatter: ()=>autoFormatter,
118
119
  findFirstDimension: ()=>findFirstDimension,
120
+ Builder: ()=>Builder,
119
121
  registerAll: ()=>registerAll,
120
122
  registerBar: ()=>registerBar,
121
123
  isVChart: ()=>isVChart,
122
124
  radarSpecPipeline: ()=>radarSpecPipeline,
125
+ zMeasureTree: ()=>zMeasureTree,
123
126
  zPieConfig: ()=>zPieConfig,
124
127
  zPivotTable: ()=>zPivotTable,
125
128
  zRadar: ()=>zRadar,
126
- zRose: ()=>zRose,
127
129
  registerLine: ()=>registerLine,
128
130
  registerCustomTheme: ()=>registerCustomTheme,
129
131
  zColor: ()=>zColor,
@@ -134,16 +136,16 @@ __webpack_require__.d(__webpack_exports__, {
134
136
  zDonutConfig: ()=>zDonutConfig,
135
137
  zFunnelConfig: ()=>zFunnelConfig,
136
138
  zMeasureGroup: ()=>zMeasureGroup,
137
- zMeasures: ()=>zMeasures,
139
+ zDualAxis: ()=>zDualAxis,
138
140
  FoldMeasureName: ()=>FoldMeasureName,
139
- zRadarConfig: ()=>zRadarConfig,
141
+ zDualChartType: ()=>zDualChartType,
140
142
  darkTheme: ()=>darkTheme,
141
143
  createNumFormatter: ()=>createNumFormatter,
142
144
  zAreaConfig: ()=>zAreaConfig,
143
145
  zAxis: ()=>zAxis,
144
146
  isVTable: ()=>isVTable,
145
- zTable: ()=>zTable,
146
- zUnfoldInfo: ()=>zUnfoldInfo,
147
+ zMeasures: ()=>zMeasures,
148
+ zRadarConfig: ()=>zRadarConfig,
147
149
  zLine: ()=>zLine,
148
150
  columnSpecPipeline: ()=>columnSpecPipeline,
149
151
  UnfoldDimensionGroup: ()=>UnfoldDimensionGroup,
@@ -154,6 +156,8 @@ __webpack_require__.d(__webpack_exports__, {
154
156
  ORIGINAL_DATA: ()=>ORIGINAL_DATA,
155
157
  zStackCornerRadius: ()=>zStackCornerRadius,
156
158
  zAnnotationArea: ()=>zAnnotationArea,
159
+ zUnfoldInfo: ()=>zUnfoldInfo,
160
+ zRose: ()=>zRose,
157
161
  columnParallelSpecPipeline: ()=>columnParallelSpecPipeline,
158
162
  i18n: ()=>i18n,
159
163
  zPointStyle: ()=>zPointStyle,
@@ -162,12 +166,15 @@ __webpack_require__.d(__webpack_exports__, {
162
166
  registerColumnParallel: ()=>registerColumnParallel,
163
167
  updateAdvanced: ()=>updateAdvanced,
164
168
  zDimension: ()=>zDimension,
169
+ zTable: ()=>zTable,
170
+ FoldSecondaryMeasureValue: ()=>FoldSecondaryMeasureValue,
165
171
  zSort: ()=>zSort,
166
172
  isPivotChart: ()=>isPivotChart,
167
173
  zDualAxisConfig: ()=>zDualAxisConfig,
168
174
  zColumn: ()=>zColumn,
169
175
  zCustomTheme: ()=>zCustomTheme,
170
176
  zLineConfig: ()=>zLineConfig,
177
+ FoldPrimaryMeasureValue: ()=>FoldPrimaryMeasureValue,
171
178
  zTableConfig: ()=>zTableConfig,
172
179
  zXBandAxis: ()=>zXBandAxis,
173
180
  dataReshapeFor1D: ()=>dataReshapeFor1D,
@@ -185,15 +192,17 @@ __webpack_require__.d(__webpack_exports__, {
185
192
  zMeasure: ()=>zMeasure,
186
193
  areaRangeSpecPipeline: ()=>areaRangeSpecPipeline,
187
194
  areaRangeAdvancedPipeline: ()=>areaRangeAdvancedPipeline,
188
- zAreaRange: ()=>zAreaRange,
195
+ dualAxisAdvancedPipeline: ()=>dualAxisAdvancedPipeline,
189
196
  registerScatter: ()=>registerScatter,
190
- zEncoding: ()=>zEncoding,
197
+ zAreaRange: ()=>zAreaRange,
198
+ measureDepth: ()=>measureDepth,
191
199
  autoNumFormatter: ()=>autoNumFormatter,
192
200
  zAdvancedVSeed: ()=>zAdvancedVSeed,
193
201
  tableSpecPipeline: ()=>tableSpecPipeline,
194
202
  zConfig: ()=>zConfig,
195
- zRoseParallelConfig: ()=>zRoseParallelConfig,
203
+ zEncoding: ()=>zEncoding,
196
204
  zBarStyle: ()=>zBarStyle,
205
+ zRoseParallelConfig: ()=>zRoseParallelConfig,
197
206
  zXLinearAxis: ()=>zXLinearAxis,
198
207
  zAreaPercent: ()=>zAreaPercent,
199
208
  columnParallelAdvancedPipeline: ()=>columnParallelAdvancedPipeline,
@@ -232,11 +241,11 @@ const buildAdvanced = (builder)=>{
232
241
  const start = 'undefined' != typeof performance ? performance.now() : Date.now();
233
242
  const { chartType } = builder.vseed;
234
243
  if (!chartType) throw new Error('chartType is nil in buildAdvanced');
235
- const pipeline = builder.getAdvancedPipeline(chartType);
244
+ const pipeline = Builder.getAdvancedPipeline(chartType);
236
245
  if (!pipeline) throw new Error(`no advanced pipeline for chartType ${chartType}`);
237
246
  const context = {
238
247
  vseed: builder.vseed,
239
- customTheme: builder.getThemeMap()
248
+ customTheme: Builder.getThemeMap()
240
249
  };
241
250
  try {
242
251
  return execPipeline(pipeline, context);
@@ -252,7 +261,7 @@ const buildSpec = (builder, advancedVSeed)=>{
252
261
  const start = 'undefined' != typeof performance ? performance.now() : Date.now();
253
262
  const { chartType } = builder.vseed;
254
263
  if (!chartType) throw new Error('chartType is nil in buildSpec');
255
- const pipeline = builder.getSpecPipeline(chartType);
264
+ const pipeline = Builder.getSpecPipeline(chartType);
256
265
  if (!pipeline) throw new Error(`no spec pipeline for chartType ${chartType}`);
257
266
  const context = {
258
267
  vseed: builder.vseed,
@@ -336,20 +345,6 @@ class Builder {
336
345
  build = ()=>build(this);
337
346
  buildSpec = (advanced)=>buildSpec(this, advanced);
338
347
  buildAdvanced = ()=>buildAdvanced(this);
339
- getAdvancedPipeline = (chartType)=>{
340
- const customPipe = Builder._customAdvancedPipe[chartType];
341
- const pipeline = Builder._advancedPipelineMap[chartType];
342
- if (customPipe) pipeline.push(customPipe);
343
- return pipeline;
344
- };
345
- getSpecPipeline = (chartType)=>{
346
- const customPipe = Builder._customSpecPipe[chartType];
347
- const pipeline = Builder._specPipelineMap[chartType];
348
- if (customPipe) pipeline.push(customPipe);
349
- return pipeline;
350
- };
351
- getTheme = (themeKey)=>Builder._themeMap[themeKey];
352
- getThemeMap = ()=>Builder._themeMap;
353
348
  getColorItems = ()=>getColorItems(this);
354
349
  getColorIdMap = ()=>getColorIdMap(this);
355
350
  get vseed() {
@@ -376,12 +371,26 @@ class Builder {
376
371
  set performance(value) {
377
372
  this._performance = value;
378
373
  }
374
+ static getAdvancedPipeline = (chartType)=>{
375
+ const customPipe = Builder._customAdvancedPipe[chartType];
376
+ const pipeline = Builder._advancedPipelineMap[chartType];
377
+ if (customPipe) pipeline.push(customPipe);
378
+ return pipeline;
379
+ };
380
+ static getSpecPipeline = (chartType)=>{
381
+ const customPipe = Builder._customSpecPipe[chartType];
382
+ const pipeline = Builder._specPipelineMap[chartType];
383
+ if (customPipe) pipeline.push(customPipe);
384
+ return pipeline;
385
+ };
386
+ static getTheme = (themeKey)=>Builder._themeMap[themeKey];
387
+ static getThemeMap = ()=>Builder._themeMap;
388
+ static from = (vseed)=>new Builder(vseed);
379
389
  static _advancedPipelineMap = {};
380
390
  static _specPipelineMap = {};
381
391
  static _customAdvancedPipe = {};
382
392
  static _customSpecPipe = {};
383
393
  static _themeMap = {};
384
- static from = (vseed)=>new Builder(vseed);
385
394
  }
386
395
  const initAdvancedVSeed = (advancedVSeed, context)=>{
387
396
  const { vseed } = context;
@@ -400,7 +409,7 @@ const autoMeasures = (advancedVSeed, context)=>{
400
409
  const { measures, dataset } = vseed;
401
410
  if (!dataset) throw new Error('dataset is required');
402
411
  if (0 === dataset.length) return result;
403
- if (measures && measures.length > 0) {
412
+ if (measures) {
404
413
  result.measures = measures;
405
414
  return result;
406
415
  }
@@ -480,8 +489,11 @@ const autoDimensions = (advancedVSeed, context)=>{
480
489
  const measures = findAllMeasures(advancedVSeed.measures);
481
490
  if (!dataset) throw new Error('dataset is required');
482
491
  if (0 === dataset.length) return result;
483
- if (dimensions && dimensions.length > 0) {
484
- result.dimensions = dimensions;
492
+ if (dimensions) {
493
+ result.dimensions = dimensions.map((dim)=>({
494
+ location: 'dimension',
495
+ ...dim
496
+ }));
485
497
  return result;
486
498
  }
487
499
  const top100dataset = dataset.slice(0, 100);
@@ -777,7 +789,7 @@ const autoPivotMeasures = (advancedVSeed, context)=>{
777
789
  const measures = findAllMeasures(vseed.measures);
778
790
  if (!dataset) throw new Error('dataset is required');
779
791
  if (0 === dataset.length) return result;
780
- if (measures && measures.length > 0) {
792
+ if (vseed.measures) {
781
793
  result.measures = findAllMeasures(measures);
782
794
  return result;
783
795
  }
@@ -840,7 +852,7 @@ const autoPivotDimensions = (advancedVSeed, context)=>{
840
852
  const measures = findAllMeasures(advancedVSeed.measures);
841
853
  if (!dataset) throw new Error('dataset is required');
842
854
  if (0 === dataset.length) return result;
843
- if (dimensions && dimensions.length > 0) {
855
+ if (dimensions) {
844
856
  const newDimensions = findAllDimensions(dimensions);
845
857
  result.dimensions = newDimensions.map((item, index)=>{
846
858
  if ('rowDimension' === item.location || 'columnDimension' === item.location) return item;
@@ -1075,6 +1087,15 @@ const initAdvancedVSeed_initAdvancedVSeed = (advancedVSeed, context)=>{
1075
1087
  locale: locale || 'zh-CN'
1076
1088
  };
1077
1089
  };
1090
+ const measureDepth = (measures = [])=>{
1091
+ if (!measures) return 0;
1092
+ let depth = 1;
1093
+ preorderTraverse(measures, (node)=>{
1094
+ if ('children' in node) depth = Math.max(depth, 1 + measureDepth(node.children));
1095
+ return false;
1096
+ });
1097
+ return depth;
1098
+ };
1078
1099
  const isTable = (vseed)=>'table' === vseed.chartType;
1079
1100
  const isPivotTable = (vseed)=>'pivotTable' === vseed.chartType;
1080
1101
  const isVTable = (vseed)=>[
@@ -1084,9 +1105,18 @@ const isVTable = (vseed)=>[
1084
1105
  const isVChart = (vseed)=>!isVTable(vseed);
1085
1106
  const isPivotChart = (vseed)=>{
1086
1107
  if (isVTable(vseed)) return false;
1108
+ if ('dualAxis' === vseed.chartType) {
1109
+ if (vseed.measures) {
1110
+ const depth = measureDepth(vseed.measures);
1111
+ if (3 === depth) return true;
1112
+ return false;
1113
+ }
1114
+ if (vseed.dualMeasures && vseed.dualMeasures.length > 1) return true;
1115
+ return false;
1116
+ }
1087
1117
  const { measures = [], dimensions = [] } = vseed;
1088
1118
  const hasRowOrColumnDimension = dimensions && dimensions.some((dimension)=>'rowDimension' === dimension.location || 'columnDimension' === dimension.location);
1089
- const hasMeasureGroup = measures && measures.find((measure)=>measure && measure.children);
1119
+ const hasMeasureGroup = measures && measures.some((measure)=>measure && measure.children);
1090
1120
  return hasRowOrColumnDimension || hasMeasureGroup;
1091
1121
  };
1092
1122
  const autoMeasures_autoMeasures = (advancedVSeed, context)=>{
@@ -1170,7 +1200,10 @@ const autoDimensions_autoDimensions = (advancedVSeed, context)=>{
1170
1200
  if (!dataset) throw new Error('dataset is required');
1171
1201
  if (0 === dataset.length) return result;
1172
1202
  if (dimensions) {
1173
- result.dimensions = dimensions;
1203
+ result.dimensions = dimensions.map((dim)=>({
1204
+ location: 'dimension',
1205
+ ...dim
1206
+ }));
1174
1207
  return result;
1175
1208
  }
1176
1209
  const top100dataset = dataset.slice(0, 100);
@@ -1196,8 +1229,10 @@ const pivotAdapter = (pipeline, pivotPipeline)=>(advancedVSeed, context)=>{
1196
1229
  return execPipeline(pipeline, context, advancedVSeed);
1197
1230
  };
1198
1231
  const FoldMeasureName = '__MeaName__';
1199
- const FoldMeasureValue = '__MeaValue__';
1200
1232
  const FoldMeasureId = '__MeaId__';
1233
+ const FoldMeasureValue = '__MeaValue__';
1234
+ const FoldPrimaryMeasureValue = '__MeaPrimaryValue__';
1235
+ const FoldSecondaryMeasureValue = '__MeaSecondaryValue__';
1201
1236
  const UnfoldDimensionGroup = '__DimGroup__';
1202
1237
  const UnfoldDimensionGroupId = '__DimGroupID__';
1203
1238
  const Separator = '-';
@@ -1377,6 +1412,7 @@ const reshapeTo2D1M0Name = (advancedVSeed, context)=>{
1377
1412
  datasetReshapeInfo: [
1378
1413
  {
1379
1414
  id: '2D1M',
1415
+ index: 0,
1380
1416
  foldInfo,
1381
1417
  unfoldInfo
1382
1418
  }
@@ -1401,7 +1437,7 @@ const pivotReshapeTo2D1M0Name = (advancedVSeed, context)=>{
1401
1437
  const commonDimensions = dimensions.filter((dim)=>'dimension' === dim.location);
1402
1438
  const newDatasets = [];
1403
1439
  const datasetReshapeInfo = [];
1404
- measureGroups.forEach((measureGroup)=>{
1440
+ measureGroups.forEach((measureGroup, index)=>{
1405
1441
  const measures = measureGroup.children;
1406
1442
  if (!measures) return;
1407
1443
  const groupId = measureGroup.id;
@@ -1413,6 +1449,7 @@ const pivotReshapeTo2D1M0Name = (advancedVSeed, context)=>{
1413
1449
  });
1414
1450
  const reshapeInfo = {
1415
1451
  id: groupId,
1452
+ index,
1416
1453
  foldInfo,
1417
1454
  unfoldInfo
1418
1455
  };
@@ -1694,11 +1731,13 @@ const color_color = (spec, context)=>{
1694
1731
  const { unfoldInfo } = datasetReshapeInfo[0];
1695
1732
  const baseConfig = advancedVSeed.config[chartType];
1696
1733
  if (!baseConfig || !baseConfig.color) return result;
1734
+ const colorItems = unfoldInfo.colorItems;
1735
+ const colorIdMap = unfoldInfo.colorIdMap;
1697
1736
  const { color } = baseConfig;
1698
1737
  const { colorScheme, colorMapping } = color;
1699
1738
  const mappingList = [];
1700
1739
  if (colorMapping) Object.entries(colorMapping).sort((a, b)=>a[0].split(Separator).length - b[0].split(Separator).length).forEach(([key, value])=>{
1701
- const idMap = Object.entries(unfoldInfo.colorIdMap).filter(([_, v])=>v.includes(key));
1740
+ const idMap = Object.entries(colorIdMap).filter(([_, v])=>v.includes(key));
1702
1741
  for (const [colorId] of idMap)mappingList.push([
1703
1742
  colorId,
1704
1743
  value
@@ -1706,7 +1745,7 @@ const color_color = (spec, context)=>{
1706
1745
  });
1707
1746
  result.color = {
1708
1747
  type: 'ordinal',
1709
- domain: unfoldInfo.colorItems,
1748
+ domain: colorItems,
1710
1749
  range: colorScheme,
1711
1750
  specified: Object.fromEntries(mappingList)
1712
1751
  };
@@ -2528,7 +2567,7 @@ const annotationPoint_annotationPoint = (spec, context)=>{
2528
2567
  annotationPoint
2529
2568
  ];
2530
2569
  const markPoint = annotationPointList.flatMap((annotationPoint)=>{
2531
- 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;
2570
+ 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;
2532
2571
  const dataset = advancedVSeed.dataset.flat();
2533
2572
  const selectedData = selectorPoint ? dataset.filter((datum)=>selector_selector(datum, selectorPoint)) : [];
2534
2573
  return selectedData.map((datum)=>({
@@ -2560,7 +2599,8 @@ const annotationPoint_annotationPoint = (spec, context)=>{
2560
2599
  stroke: backgroundColor,
2561
2600
  lineWidth: 1,
2562
2601
  fontSize: textFontSize,
2563
- fontWeight: textFontWeight
2602
+ fontWeight: textFontWeight,
2603
+ dy: textFontSize
2564
2604
  },
2565
2605
  labelBackground: {
2566
2606
  visible: backgroundVisible,
@@ -2569,7 +2609,8 @@ const annotationPoint_annotationPoint = (spec, context)=>{
2569
2609
  cornerRadius: backgroundBorderRadius ?? 4,
2570
2610
  fill: backgroundColor,
2571
2611
  stroke: backgroundBorderColor,
2572
- lineWidth: backgroundBorderWidth
2612
+ lineWidth: backgroundBorderWidth,
2613
+ dy: textFontSize
2573
2614
  }
2574
2615
  }
2575
2616
  }
@@ -2598,7 +2639,7 @@ const annotationVerticalLine_annotationVerticalLine = (spec, context)=>{
2598
2639
  insideEnd: 'insideEndTop'
2599
2640
  };
2600
2641
  const markLine = annotationVerticalLineList.flatMap((annotationVerticalLine)=>{
2601
- 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;
2642
+ 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;
2602
2643
  const dataset = advancedVSeed.dataset.flat();
2603
2644
  const generateOneMarkLine = (x)=>({
2604
2645
  x: x,
@@ -2697,7 +2738,7 @@ const annotationHorizontalLine_annotationHorizontalLine = (spec, context)=>{
2697
2738
  insideEnd: 'insideEndTop'
2698
2739
  };
2699
2740
  const markLine = annotationVerticalLineList.flatMap((annotationVerticalLine)=>{
2700
- 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;
2741
+ 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;
2701
2742
  const dataset = advancedVSeed.dataset.flat();
2702
2743
  const generateOneMarkLine = (y)=>({
2703
2744
  y,
@@ -2798,7 +2839,7 @@ const annotationArea_annotationArea = (spec, context)=>{
2798
2839
  right: 'insideRight'
2799
2840
  };
2800
2841
  const markArea = annotationAreaList.flatMap((annotationArea)=>{
2801
- 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;
2842
+ 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;
2802
2843
  const dataset = advancedVSeed.dataset.flat();
2803
2844
  const selectedData = selectorPoint ? dataset.filter((datum)=>selector_selector(datum, selectorPoint)) : [];
2804
2845
  return {
@@ -2868,6 +2909,7 @@ const annotationArea_annotationArea = (spec, context)=>{
2868
2909
  visible: true,
2869
2910
  text: text,
2870
2911
  style: {
2912
+ dy: textFontSize,
2871
2913
  textAlign: textAlign,
2872
2914
  textBaseline: textBaseline,
2873
2915
  fill: textColor,
@@ -2880,6 +2922,7 @@ const annotationArea_annotationArea = (spec, context)=>{
2880
2922
  visible: backgroundVisible,
2881
2923
  padding: backgroundPadding,
2882
2924
  style: {
2925
+ dy: textFontSize,
2883
2926
  cornerRadius: backgroundBorderRadius ?? 4,
2884
2927
  fill: backgroundColor,
2885
2928
  stroke: backgroundBorderColor,
@@ -3412,6 +3455,7 @@ const reshapeTo2D1M = (advancedVSeed, context)=>{
3412
3455
  datasetReshapeInfo: [
3413
3456
  {
3414
3457
  id: '2D1M',
3458
+ index: 0,
3415
3459
  foldInfo,
3416
3460
  unfoldInfo
3417
3461
  }
@@ -3436,7 +3480,7 @@ const pivotReshapeTo2D1M = (advancedVSeed, context)=>{
3436
3480
  const commonDimensions = dimensions.filter((dim)=>'dimension' === dim.location);
3437
3481
  const newDatasets = [];
3438
3482
  const datasetReshapeInfo = [];
3439
- measureGroups.forEach((measureGroup)=>{
3483
+ measureGroups.forEach((measureGroup, index)=>{
3440
3484
  const measures = measureGroup.children;
3441
3485
  if (!measures) return;
3442
3486
  const groupId = measureGroup.id;
@@ -3448,6 +3492,7 @@ const pivotReshapeTo2D1M = (advancedVSeed, context)=>{
3448
3492
  });
3449
3493
  const reshapeInfo = {
3450
3494
  id: groupId,
3495
+ index,
3451
3496
  foldInfo,
3452
3497
  unfoldInfo
3453
3498
  };
@@ -3635,7 +3680,7 @@ const annotationAreaBand = (spec, context)=>{
3635
3680
  right: 'insideRight'
3636
3681
  };
3637
3682
  const markArea = annotationAreaList.flatMap((annotationArea)=>{
3638
- 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;
3683
+ 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;
3639
3684
  const dataset = advancedVSeed.dataset.flat();
3640
3685
  const selectedData = selectorPoint ? dataset.filter((datum)=>selector_selector(datum, selectorPoint)) : [];
3641
3686
  return {
@@ -3709,6 +3754,7 @@ const annotationAreaBand = (spec, context)=>{
3709
3754
  visible: true,
3710
3755
  text: text,
3711
3756
  style: {
3757
+ dy: textFontSize,
3712
3758
  textAlign: textAlign,
3713
3759
  textBaseline: textBaseline,
3714
3760
  stroke: backgroundColor,
@@ -3721,6 +3767,7 @@ const annotationAreaBand = (spec, context)=>{
3721
3767
  visible: backgroundVisible,
3722
3768
  padding: backgroundPadding,
3723
3769
  style: {
3770
+ dy: textFontSize,
3724
3771
  cornerRadius: backgroundBorderRadius ?? 4,
3725
3772
  fill: backgroundColor,
3726
3773
  stroke: backgroundBorderColor,
@@ -4852,6 +4899,7 @@ const reshapeTo1D = (advancedVSeed, context)=>{
4852
4899
  datasetReshapeInfo: [
4853
4900
  {
4854
4901
  id: '1D2M',
4902
+ index: 0,
4855
4903
  foldInfo,
4856
4904
  unfoldInfo
4857
4905
  }
@@ -4873,7 +4921,7 @@ const pivotReshapeTo1D = (advancedVSeed, context)=>{
4873
4921
  });
4874
4922
  const newDatasets = [];
4875
4923
  const datasetReshapeInfo = [];
4876
- measureGroups.forEach((measureGroup)=>{
4924
+ measureGroups.forEach((measureGroup, index)=>{
4877
4925
  const measures = measureGroup.children;
4878
4926
  if (!measures) return;
4879
4927
  const commonDimensions = dimensions.filter((dim)=>'dimension' === dim.location);
@@ -4886,6 +4934,7 @@ const pivotReshapeTo1D = (advancedVSeed, context)=>{
4886
4934
  });
4887
4935
  const reshapeInfo = {
4888
4936
  id: groupId,
4937
+ index,
4889
4938
  foldInfo,
4890
4939
  unfoldInfo
4891
4940
  };
@@ -4898,7 +4947,7 @@ const pivotReshapeTo1D = (advancedVSeed, context)=>{
4898
4947
  datasetReshapeInfo: datasetReshapeInfo
4899
4948
  };
4900
4949
  };
4901
- const encodingXYY = (advancedVSeed)=>{
4950
+ const encodingAreaRange = (advancedVSeed)=>{
4902
4951
  const result = {
4903
4952
  ...advancedVSeed
4904
4953
  };
@@ -4975,7 +5024,7 @@ const areaRangeAdvancedPipeline = [
4975
5024
  ], [
4976
5025
  pivotReshapeTo1D
4977
5026
  ]),
4978
- encodingXYY,
5027
+ encodingAreaRange,
4979
5028
  sortXBandAxis,
4980
5029
  areaConfig,
4981
5030
  theme_theme,
@@ -5297,6 +5346,7 @@ const reshapeTo1D2M = (advancedVSeed, context)=>{
5297
5346
  datasetReshapeInfo: [
5298
5347
  {
5299
5348
  id: '1D2M',
5349
+ index: 0,
5300
5350
  foldInfo,
5301
5351
  unfoldInfo
5302
5352
  }
@@ -5318,7 +5368,7 @@ const pivotReshapeTo1D2M = (advancedVSeed, context)=>{
5318
5368
  });
5319
5369
  const newDatasets = [];
5320
5370
  const datasetReshapeInfo = [];
5321
- measureGroups.forEach((measureGroup)=>{
5371
+ measureGroups.forEach((measureGroup, index)=>{
5322
5372
  const measures = measureGroup.children;
5323
5373
  if (!measures) return;
5324
5374
  const commonDimensions = dimensions.filter((dim)=>'dimension' === dim.location);
@@ -5331,6 +5381,7 @@ const pivotReshapeTo1D2M = (advancedVSeed, context)=>{
5331
5381
  });
5332
5382
  const reshapeInfo = {
5333
5383
  id: groupId,
5384
+ index,
5334
5385
  foldInfo,
5335
5386
  unfoldInfo
5336
5387
  };
@@ -5510,69 +5561,7 @@ const registerScatter = ()=>{
5510
5561
  Builder._advancedPipelineMap.scatter = scatterAdvancedPipeline;
5511
5562
  Builder._specPipelineMap.scatter = scatterSpecPipeline;
5512
5563
  };
5513
- const dataReshapeFor1D1M_emptyReshapeResult = {
5514
- dataset: [],
5515
- foldInfo: {
5516
- foldMap: {},
5517
- measureId: '',
5518
- measureName: '',
5519
- measureValue: ''
5520
- },
5521
- unfoldInfo: {
5522
- groupName: '',
5523
- groupId: '',
5524
- colorItems: [],
5525
- colorIdMap: {}
5526
- }
5527
- };
5528
- const dataReshapeFor1D1M = (dataset, dimensions, measures, options)=>{
5529
- const { foldMeasureId = FoldMeasureId, foldMeasureName = FoldMeasureName, foldMeasureValue = FoldMeasureValue, unfoldDimensionGroup = UnfoldDimensionGroup, unfoldDimensionGroupId = UnfoldDimensionGroupId } = options || {};
5530
- if (0 === dimensions.length && 0 === measures.length) return dataReshapeFor1D1M_emptyReshapeResult;
5531
- const { dataset: foldedDataset, foldInfo } = foldMeasures(dataset, measures, foldMeasureId, foldMeasureName, foldMeasureValue);
5532
- if (0 === dimensions.length) {
5533
- const { dataset: finalDataset, unfoldInfo } = unfoldDimensions(foldedDataset, [
5534
- {
5535
- id: foldMeasureName,
5536
- alias: i18n`指标名称`,
5537
- location: 'dimension'
5538
- }
5539
- ], [
5540
- {
5541
- id: foldMeasureValue,
5542
- alias: i18n`指标值`
5543
- }
5544
- ], 0, unfoldDimensionGroup, unfoldDimensionGroupId, foldMeasureId);
5545
- return {
5546
- dataset: finalDataset,
5547
- foldInfo,
5548
- unfoldInfo
5549
- };
5550
- }
5551
- {
5552
- const dims = 1 === measures.length ? [
5553
- ...dimensions
5554
- ] : [
5555
- ...dimensions,
5556
- {
5557
- id: foldMeasureName,
5558
- alias: i18n`指标名称`,
5559
- location: 'dimension'
5560
- }
5561
- ];
5562
- const { dataset: finalDataset, unfoldInfo } = unfoldDimensions(foldedDataset, dims, [
5563
- {
5564
- id: foldMeasureValue,
5565
- alias: i18n`指标值`
5566
- }
5567
- ], 0, unfoldDimensionGroup, unfoldDimensionGroupId, foldMeasureId);
5568
- return {
5569
- dataset: finalDataset,
5570
- foldInfo,
5571
- unfoldInfo
5572
- };
5573
- }
5574
- };
5575
- const reshapeTo1D1M = (advancedVSeed, context)=>{
5564
+ const reshapeTo2D2M = (advancedVSeed, context)=>{
5576
5565
  const result = {
5577
5566
  ...advancedVSeed
5578
5567
  };
@@ -5581,84 +5570,138 @@ const reshapeTo1D1M = (advancedVSeed, context)=>{
5581
5570
  const { dimensions, measures } = advancedVSeed;
5582
5571
  if (!measures || !dimensions || !dataset) return result;
5583
5572
  if (0 === measures.length) throw new Error('measures can not be empty');
5584
- const { dataset: newDatasets, foldInfo, unfoldInfo } = dataReshapeFor1D1M(dataset, dimensions, measures);
5573
+ if (measures.length > 2) throw new Error('measures can not be more than 2');
5574
+ const commonDimensions = dimensions.filter((dim)=>'dimension' === dim.location);
5575
+ const datasets = [];
5576
+ const foldInfoList = [];
5577
+ const unfoldInfoList = [];
5578
+ const primaryMeasures = measures[0];
5579
+ const secondaryMeasures = measures[1] || [];
5580
+ if (primaryMeasures && primaryMeasures.children) {
5581
+ const { dataset: newDatasets, foldInfo, unfoldInfo } = dataReshapeFor2D1M(dataset, commonDimensions, primaryMeasures.children, {
5582
+ foldMeasureValue: FoldPrimaryMeasureValue
5583
+ });
5584
+ datasets.push(newDatasets);
5585
+ foldInfoList.push(foldInfo);
5586
+ unfoldInfoList.push(unfoldInfo);
5587
+ }
5588
+ if (secondaryMeasures && secondaryMeasures.children) {
5589
+ const { dataset: newDatasets, foldInfo, unfoldInfo } = dataReshapeFor2D1M(dataset, commonDimensions, secondaryMeasures.children, {
5590
+ foldMeasureValue: FoldSecondaryMeasureValue
5591
+ });
5592
+ datasets.push(newDatasets);
5593
+ foldInfoList.push(foldInfo);
5594
+ unfoldInfoList.push(unfoldInfo);
5595
+ }
5596
+ const unfoldInfo = {
5597
+ groupName: unfoldInfoList[0].groupName,
5598
+ groupId: unfoldInfoList[0].groupId,
5599
+ colorItems: unfoldInfoList.flatMap((d)=>d.colorItems),
5600
+ colorIdMap: unfoldInfoList.reduce((prev, cur)=>({
5601
+ ...prev,
5602
+ ...cur.colorIdMap
5603
+ }), {})
5604
+ };
5585
5605
  return {
5586
5606
  ...result,
5587
- dataset: newDatasets,
5607
+ dataset: datasets,
5588
5608
  datasetReshapeInfo: [
5589
5609
  {
5590
- id: '1D1M',
5591
- foldInfo,
5592
- unfoldInfo
5610
+ id: '2D2M',
5611
+ index: 0,
5612
+ foldInfo: foldInfoList[0],
5613
+ foldInfoList: foldInfoList,
5614
+ unfoldInfo: unfoldInfo
5593
5615
  }
5594
5616
  ]
5595
5617
  };
5596
5618
  };
5597
- const pivotReshapeTo1D1M = (advancedVSeed, context)=>{
5619
+ const pivotReshapeTo2D2M = (advancedVSeed, context)=>{
5598
5620
  const result = {
5599
5621
  ...advancedVSeed
5600
5622
  };
5601
5623
  const { vseed } = context;
5602
5624
  const { dataset } = vseed;
5603
- const { measures } = advancedVSeed;
5604
- const dimensions = advancedVSeed.dimensions;
5605
- if (!measures || !dimensions) return result;
5606
- const measureGroups = [];
5607
- if (measures) measures.forEach((measure)=>{
5608
- if (measure.children && measure.children.length > 0) measureGroups.push(measure);
5609
- });
5610
- const newDatasets = [];
5625
+ const { dimensions, measures } = advancedVSeed;
5626
+ if (!measures || !dimensions || !dataset) return result;
5627
+ const commonDimensions = dimensions.filter((dim)=>'dimension' === dim.location);
5628
+ const datasetList = [];
5611
5629
  const datasetReshapeInfo = [];
5612
- measureGroups.forEach((measureGroup)=>{
5613
- const measures = measureGroup.children;
5614
- if (!measures) return;
5615
- const commonDimensions = dimensions.filter((dim)=>'dimension' === dim.location);
5616
- const groupId = measureGroup.id;
5617
- const { dataset: newSubDataset, foldInfo, unfoldInfo } = dataReshapeFor1D1M(dataset, commonDimensions, measures, {
5618
- foldMeasureId: FoldMeasureId,
5619
- foldMeasureName: FoldMeasureName,
5620
- foldMeasureValue: FoldMeasureValue + groupId,
5621
- unfoldDimensionGroup: UnfoldDimensionGroup
5622
- });
5630
+ measures.forEach((measureGroup, index)=>{
5631
+ const measures = measureGroup.children || [];
5632
+ if (0 === measures.length) throw new Error('measures can not be empty');
5633
+ if (measures.length > 2) throw new Error('measures can not be more than 2');
5634
+ const datasets = [];
5635
+ const foldInfoList = [];
5636
+ const unfoldInfoList = [];
5637
+ const primaryMeasures = measures[0];
5638
+ const secondaryMeasures = measures[1] || measures[0];
5639
+ if (primaryMeasures && primaryMeasures.children) {
5640
+ const { dataset: newDatasets, foldInfo, unfoldInfo } = dataReshapeFor2D1M(dataset, commonDimensions, primaryMeasures.children, {
5641
+ foldMeasureValue: `${FoldPrimaryMeasureValue}${index}`
5642
+ });
5643
+ datasets.push(newDatasets);
5644
+ foldInfoList.push(foldInfo);
5645
+ unfoldInfoList.push(unfoldInfo);
5646
+ }
5647
+ if (secondaryMeasures && secondaryMeasures.children) {
5648
+ const { dataset: newDatasets, foldInfo, unfoldInfo } = dataReshapeFor2D1M(dataset, commonDimensions, secondaryMeasures.children, {
5649
+ foldMeasureValue: `${FoldSecondaryMeasureValue}${index}`
5650
+ });
5651
+ datasets.push(newDatasets);
5652
+ foldInfoList.push(foldInfo);
5653
+ unfoldInfoList.push(unfoldInfo);
5654
+ }
5655
+ datasetList.push(datasets.flat(2));
5656
+ const unfoldInfo = {
5657
+ groupName: unfoldInfoList[0].groupName,
5658
+ groupId: unfoldInfoList[0].groupId,
5659
+ colorItems: unfoldInfoList.flatMap((d)=>d.colorItems),
5660
+ colorIdMap: unfoldInfoList.reduce((prev, cur)=>({
5661
+ ...prev,
5662
+ ...cur.colorIdMap
5663
+ }), {})
5664
+ };
5623
5665
  const reshapeInfo = {
5624
- id: groupId,
5625
- foldInfo,
5626
- unfoldInfo
5666
+ id: `2D2M-${index}`,
5667
+ index,
5668
+ foldInfo: foldInfoList[0],
5669
+ unfoldInfo: unfoldInfo,
5670
+ foldInfoList: foldInfoList
5627
5671
  };
5628
- newDatasets.push(newSubDataset);
5629
5672
  datasetReshapeInfo.push(reshapeInfo);
5630
5673
  });
5631
5674
  return {
5632
5675
  ...result,
5633
- dataset: newDatasets,
5634
- datasetReshapeInfo: datasetReshapeInfo
5676
+ dataset: datasetList,
5677
+ datasetReshapeInfo
5635
5678
  };
5636
5679
  };
5637
- const encodingPie = (advancedVSeed)=>{
5680
+ const encodingXYY = (advancedVSeed)=>{
5638
5681
  const result = {
5639
5682
  ...advancedVSeed
5640
5683
  };
5641
- const { datasetReshapeInfo } = advancedVSeed;
5642
- if (!datasetReshapeInfo) return result;
5684
+ const { datasetReshapeInfo, dimensions } = advancedVSeed;
5685
+ if (!datasetReshapeInfo || !dimensions) return result;
5686
+ const xDimension = dimensions.find((item)=>'rowDimension' !== item.location && 'columnDimension' !== item.location) || dimensions[0];
5687
+ const isZeroDimension = 0 === dimensions.length;
5643
5688
  const encoding = datasetReshapeInfo.reduce((prev, cur)=>{
5644
- const { foldInfo, unfoldInfo } = cur;
5645
- const radius = [
5646
- foldInfo.measureValue
5647
- ];
5648
- const angle = [
5649
- unfoldInfo.groupId
5689
+ const { foldInfoList, unfoldInfo } = cur;
5690
+ const x = [
5691
+ isZeroDimension ? foldInfoList[0].measureName : xDimension?.id
5650
5692
  ];
5693
+ const y = foldInfoList.map((d)=>d.measureValue);
5651
5694
  const group = [
5652
5695
  unfoldInfo.groupId
5653
5696
  ];
5654
5697
  const color = [
5655
- unfoldInfo.groupId
5698
+ foldInfoList[0].measureName
5656
5699
  ];
5657
5700
  return [
5658
5701
  ...prev,
5659
5702
  {
5660
- angle,
5661
- radius,
5703
+ x,
5704
+ y,
5662
5705
  group,
5663
5706
  color
5664
5707
  }
@@ -5669,58 +5712,1065 @@ const encodingPie = (advancedVSeed)=>{
5669
5712
  encoding
5670
5713
  };
5671
5714
  };
5672
- const pieAdvancedPipeline = [
5673
- initAdvancedVSeed_initAdvancedVSeed,
5674
- autoMeasures_autoMeasures,
5675
- autoDimensions_autoDimensions,
5676
- pivotAdapter([
5677
- reshapeTo1D1M
5678
- ], [
5679
- pivotReshapeTo1D1M
5680
- ]),
5681
- encodingPie,
5682
- pieConfig,
5683
- theme_theme,
5684
- annotation_annotation
5685
- ];
5686
- const initPie = (spec, context)=>{
5715
+ const dualAxisConfig = (advancedVSeed, context)=>{
5716
+ const { vseed } = context;
5717
+ const { chartType } = vseed;
5687
5718
  const result = {
5688
- ...spec
5719
+ ...advancedVSeed
5689
5720
  };
5690
- const { advancedVSeed } = context;
5691
- const { encoding, dataset } = advancedVSeed;
5692
- if (!encoding[0].angle || !encoding[0].radius || !encoding[0].group) return result;
5693
- const showStroke = dataset.length <= 30;
5694
- result.type = 'pie';
5695
- result.outerRadius = 0.8;
5696
- result.innerRadius = 0;
5697
- result.valueField = encoding[0].radius[0];
5698
- result.categoryField = encoding[0].angle[0];
5699
- result.seriesField = encoding[0].group[0];
5700
- result.padding = 0;
5701
- result.region = [
5702
- {
5703
- clip: true
5704
- }
5705
- ];
5706
- result.pie = {
5707
- style: {
5708
- stroke: '#ffffff',
5709
- lineWidth: showStroke ? 1 : 0,
5710
- centerOffset: 0
5711
- },
5712
- state: {
5713
- hover: {
5714
- outerRadius: 1.1 * result.outerRadius
5715
- }
5721
+ const config = (0, external_remeda_namespaceObject.pick)(vseed, [
5722
+ 'backgroundColor',
5723
+ 'color',
5724
+ 'label',
5725
+ 'legend',
5726
+ 'tooltip',
5727
+ 'dualChartType',
5728
+ 'primaryYAxis',
5729
+ 'secondaryYAxis',
5730
+ 'crosshairLine'
5731
+ ]);
5732
+ result.config = {
5733
+ ...result.config || {},
5734
+ [chartType]: {
5735
+ ...config
5716
5736
  }
5717
5737
  };
5718
- result.animation = true;
5719
5738
  return result;
5720
5739
  };
5721
- const pie = [
5722
- initPie,
5723
- color_color,
5740
+ const autoDualMeasures = (advancedVSeed, context)=>{
5741
+ const result = {
5742
+ ...advancedVSeed
5743
+ };
5744
+ const { vseed } = context;
5745
+ const { dataset, dualMeasures, measures } = vseed;
5746
+ if (!dataset) throw new Error('dataset is required');
5747
+ if (0 === dataset.length) return result;
5748
+ if (dualMeasures) {
5749
+ result.measures = dualMeasuresToMeasureTree(dualMeasures);
5750
+ return result;
5751
+ }
5752
+ if (measures && measureDepth(measures) > 1) {
5753
+ result.measures = measures;
5754
+ return result;
5755
+ }
5756
+ const top100dataset = dataset.slice(0, 100);
5757
+ const sample = top100dataset.reduce((prev, cur)=>({
5758
+ ...prev,
5759
+ ...cur
5760
+ }), {});
5761
+ const newMeasures = measures || Object.keys(sample).filter((key)=>top100dataset.some((item)=>'number' == typeof item[key]) && ![
5762
+ '',
5763
+ null,
5764
+ void 0
5765
+ ].includes(key)).map((measure)=>({
5766
+ id: measure,
5767
+ alias: measure
5768
+ }));
5769
+ if (0 === newMeasures.length) result.measures = [];
5770
+ else if (1 === newMeasures.length) result.measures = [
5771
+ {
5772
+ id: 'primary',
5773
+ alias: 'primary',
5774
+ children: newMeasures
5775
+ }
5776
+ ];
5777
+ else if (newMeasures.length > 1) result.measures = [
5778
+ {
5779
+ id: 'primary',
5780
+ alias: 'primary',
5781
+ children: newMeasures.slice(0, 1)
5782
+ },
5783
+ {
5784
+ id: 'secondary',
5785
+ alias: 'secondary',
5786
+ children: newMeasures.slice(1)
5787
+ }
5788
+ ];
5789
+ return result;
5790
+ };
5791
+ const dualMeasuresToMeasureTree = (dualMeasures)=>{
5792
+ const measureTree = dualMeasures.map((item, index)=>{
5793
+ const { primaryMeasures, secondaryMeasures, primaryAlias, secondaryAlias } = item;
5794
+ const groupChildren = [];
5795
+ if (primaryMeasures) {
5796
+ const arrPrimaryMeasures = Array.isArray(primaryMeasures) ? primaryMeasures : [
5797
+ primaryMeasures
5798
+ ];
5799
+ groupChildren.push({
5800
+ id: `${index}-primary`,
5801
+ alias: primaryAlias || arrPrimaryMeasures.map((item)=>item.alias || item.id).toString(),
5802
+ children: arrPrimaryMeasures
5803
+ });
5804
+ }
5805
+ if (secondaryMeasures) {
5806
+ const arrSecondaryMeasures = Array.isArray(secondaryMeasures) ? secondaryMeasures : [
5807
+ secondaryMeasures
5808
+ ];
5809
+ groupChildren.push({
5810
+ id: `${index}-secondary`,
5811
+ alias: secondaryAlias || arrSecondaryMeasures.map((item)=>item.alias || item.id).toString(),
5812
+ children: arrSecondaryMeasures
5813
+ });
5814
+ }
5815
+ const id = [
5816
+ primaryAlias,
5817
+ secondaryAlias,
5818
+ index
5819
+ ].filter((d)=>!(0, external_remeda_namespaceObject.isNullish)(d)).join('-');
5820
+ return {
5821
+ id,
5822
+ alias: id,
5823
+ children: groupChildren
5824
+ };
5825
+ });
5826
+ if (1 === dualMeasures.length) return measureTree[0].children || [];
5827
+ return measureTree;
5828
+ };
5829
+ const dualAxisAdvancedPipeline = [
5830
+ initAdvancedVSeed_initAdvancedVSeed,
5831
+ autoDualMeasures,
5832
+ autoDimensions_autoDimensions,
5833
+ pivotAdapter([
5834
+ reshapeTo2D2M
5835
+ ], [
5836
+ pivotReshapeTo2D2M
5837
+ ]),
5838
+ encodingXYY,
5839
+ sortXBandAxis,
5840
+ sort_sortLegend,
5841
+ dualAxisConfig,
5842
+ theme_theme,
5843
+ markStyle_markStyle,
5844
+ annotation_annotation
5845
+ ];
5846
+ const initDualAxisPrimary = (spec, context)=>{
5847
+ const result = {
5848
+ ...spec
5849
+ };
5850
+ const { advancedVSeed } = context;
5851
+ const { encoding, datasetReshapeInfo } = advancedVSeed;
5852
+ if (!encoding[0].y || !encoding[0].x || !encoding[0].group) return result;
5853
+ result.id = `${datasetReshapeInfo[0].id}-primary-series`;
5854
+ result.type = 'bar';
5855
+ result.direction = 'vertical';
5856
+ result.xField = encoding[0].x[0];
5857
+ result.yField = encoding[0].y[0];
5858
+ result.seriesField = encoding[0].group[0];
5859
+ result.animation = true;
5860
+ return result;
5861
+ };
5862
+ const initDualAxisSecondary = (spec, context)=>{
5863
+ const result = {
5864
+ ...spec
5865
+ };
5866
+ const { advancedVSeed } = context;
5867
+ const { encoding, datasetReshapeInfo } = advancedVSeed;
5868
+ if (!encoding[0].y || !encoding[0].x || !encoding[0].group) return result;
5869
+ result.id = `${datasetReshapeInfo[0].id}-secondary-series`;
5870
+ result.type = 'line';
5871
+ result.direction = 'vertical';
5872
+ result.xField = encoding[0].x[0];
5873
+ result.yField = encoding[0].y[1];
5874
+ result.seriesField = encoding[0].group[0];
5875
+ result.animation = true;
5876
+ return result;
5877
+ };
5878
+ const dualChartTypePrimary = (spec, context)=>{
5879
+ const result = {
5880
+ ...spec
5881
+ };
5882
+ const { advancedVSeed, vseed } = context;
5883
+ const { chartType } = vseed;
5884
+ const { datasetReshapeInfo } = advancedVSeed;
5885
+ const config = advancedVSeed.config?.[chartType]?.dualChartType || {
5886
+ primary: 'column',
5887
+ secondary: 'line'
5888
+ };
5889
+ if (Array.isArray(config)) return result;
5890
+ switch(config.primary){
5891
+ case 'line':
5892
+ result.type = 'line';
5893
+ break;
5894
+ case 'column':
5895
+ result.type = 'bar';
5896
+ break;
5897
+ case 'columnParallel':
5898
+ {
5899
+ const columnSpec = result;
5900
+ if (Array.isArray(columnSpec.xField)) columnSpec.xField.push(datasetReshapeInfo[0].unfoldInfo.groupId);
5901
+ else if (columnSpec.xField) columnSpec.xField = [
5902
+ columnSpec.xField,
5903
+ datasetReshapeInfo[0].unfoldInfo.groupId
5904
+ ];
5905
+ columnSpec.type = 'bar';
5906
+ break;
5907
+ }
5908
+ case 'columnPercent':
5909
+ result.type = 'bar';
5910
+ result.percent = true;
5911
+ break;
5912
+ case 'area':
5913
+ result.type = 'area';
5914
+ break;
5915
+ case 'areaPercent':
5916
+ result.type = 'area';
5917
+ result.percent = true;
5918
+ break;
5919
+ case 'scatter':
5920
+ result.type = 'scatter';
5921
+ break;
5922
+ default:
5923
+ result.type = config.primary;
5924
+ }
5925
+ return result;
5926
+ };
5927
+ const dualChartTypeSecondary = (spec, context)=>{
5928
+ const result = {
5929
+ ...spec
5930
+ };
5931
+ const { advancedVSeed, vseed } = context;
5932
+ const { chartType } = vseed;
5933
+ const { datasetReshapeInfo } = advancedVSeed;
5934
+ const config = advancedVSeed.config?.[chartType]?.dualChartType || {
5935
+ primary: 'column',
5936
+ secondary: 'line'
5937
+ };
5938
+ if (Array.isArray(config)) return result;
5939
+ switch(config.secondary){
5940
+ case 'line':
5941
+ result.type = 'line';
5942
+ break;
5943
+ case 'column':
5944
+ result.type = 'bar';
5945
+ break;
5946
+ case 'columnParallel':
5947
+ {
5948
+ const columnSpec = result;
5949
+ if (Array.isArray(columnSpec.xField)) columnSpec.xField.push(datasetReshapeInfo[0].unfoldInfo.groupId);
5950
+ else if (columnSpec.xField) columnSpec.xField = [
5951
+ columnSpec.xField,
5952
+ datasetReshapeInfo[0].unfoldInfo.groupId
5953
+ ];
5954
+ columnSpec.type = 'bar';
5955
+ break;
5956
+ }
5957
+ case 'columnPercent':
5958
+ result.type = 'bar';
5959
+ result.percent = true;
5960
+ break;
5961
+ case 'area':
5962
+ result.type = 'area';
5963
+ break;
5964
+ case 'areaPercent':
5965
+ result.type = 'area';
5966
+ result.percent = true;
5967
+ break;
5968
+ case 'scatter':
5969
+ result.type = 'scatter';
5970
+ break;
5971
+ default:
5972
+ result.type = config.secondary;
5973
+ }
5974
+ return result;
5975
+ };
5976
+ const datasetPrimary = (spec, context)=>{
5977
+ const { advancedVSeed, vseed } = context;
5978
+ const { encoding, analysis, datasetReshapeInfo } = advancedVSeed;
5979
+ const { orderMapping = {} } = analysis ?? {};
5980
+ const x = encoding[0]?.x?.[0];
5981
+ const group = encoding[0]?.group?.[0];
5982
+ const id = datasetReshapeInfo[0].id;
5983
+ const fields = {};
5984
+ if (x) {
5985
+ const order = orderMapping[x];
5986
+ if (order) fields[x] = {
5987
+ sortIndex: 0,
5988
+ domain: order,
5989
+ lockStatisticsByDomain: true
5990
+ };
5991
+ else fields[x] = {
5992
+ sortIndex: 0
5993
+ };
5994
+ }
5995
+ if (group) {
5996
+ const order = orderMapping[group];
5997
+ if (order) fields[group] = {
5998
+ sortIndex: 0,
5999
+ domain: order,
6000
+ lockStatisticsByDomain: true
6001
+ };
6002
+ else fields[group] = {
6003
+ sortIndex: 0
6004
+ };
6005
+ }
6006
+ return {
6007
+ ...spec,
6008
+ data: {
6009
+ id: `${id}-primary-dataset`,
6010
+ values: isPivotChart(vseed) ? void 0 : advancedVSeed.dataset[0],
6011
+ fields: fields
6012
+ }
6013
+ };
6014
+ };
6015
+ const datasetSecondary = (spec, context)=>{
6016
+ const { advancedVSeed, vseed } = context;
6017
+ const { encoding, analysis, datasetReshapeInfo } = advancedVSeed;
6018
+ const { orderMapping = {} } = analysis ?? {};
6019
+ const x = encoding[0]?.x?.[0];
6020
+ const group = encoding[0]?.group?.[0];
6021
+ const id = datasetReshapeInfo[0].id;
6022
+ const fields = {};
6023
+ if (x) {
6024
+ const order = orderMapping[x];
6025
+ if (order) fields[x] = {
6026
+ sortIndex: 0,
6027
+ domain: order,
6028
+ lockStatisticsByDomain: true
6029
+ };
6030
+ else fields[x] = {
6031
+ sortIndex: 0
6032
+ };
6033
+ }
6034
+ if (group) {
6035
+ const order = orderMapping[group];
6036
+ if (order) fields[group] = {
6037
+ sortIndex: 0,
6038
+ domain: order,
6039
+ lockStatisticsByDomain: true
6040
+ };
6041
+ else fields[group] = {
6042
+ sortIndex: 0
6043
+ };
6044
+ }
6045
+ return {
6046
+ ...spec,
6047
+ data: {
6048
+ id: `${id}-secondary-dataset`,
6049
+ values: isPivotChart(vseed) ? void 0 : advancedVSeed.dataset[1],
6050
+ fields: fields
6051
+ }
6052
+ };
6053
+ };
6054
+ const labelPrimary = (spec, context)=>{
6055
+ const result = {
6056
+ ...spec
6057
+ };
6058
+ const { advancedVSeed } = context;
6059
+ const { measures, datasetReshapeInfo, locale } = advancedVSeed;
6060
+ const { chartType } = advancedVSeed;
6061
+ const baseConfig = advancedVSeed.config[chartType];
6062
+ if (!baseConfig || !baseConfig.label) return result;
6063
+ const foldInfoList = datasetReshapeInfo[0].foldInfoList;
6064
+ const { measureId, measureValue } = foldInfoList[0];
6065
+ const { label } = baseConfig;
6066
+ const { enable } = label;
6067
+ result.label = {
6068
+ visible: enable,
6069
+ formatMethod: (value, datum)=>{
6070
+ const result = [];
6071
+ const formatValue = (value)=>{
6072
+ const id = datum[measureId];
6073
+ const measure = findMeasureById(measures, id);
6074
+ if (!measure) return value;
6075
+ const { format = {}, autoFormat = true } = measure;
6076
+ if (!(0, external_remeda_namespaceObject.isEmpty)(format)) {
6077
+ const formatter = createFormatter(format);
6078
+ return formatter(value);
6079
+ }
6080
+ if (autoFormat) return autoFormatter(value, locale);
6081
+ return String(value);
6082
+ };
6083
+ result.push(formatValue(datum[measureValue]));
6084
+ return result.join(' ');
6085
+ }
6086
+ };
6087
+ return result;
6088
+ };
6089
+ const labelSecondary = (spec, context)=>{
6090
+ const result = {
6091
+ ...spec
6092
+ };
6093
+ const { advancedVSeed } = context;
6094
+ const { measures, datasetReshapeInfo, locale } = advancedVSeed;
6095
+ const { chartType } = advancedVSeed;
6096
+ const baseConfig = advancedVSeed.config[chartType];
6097
+ if (!baseConfig || !baseConfig.label) return result;
6098
+ if ((0, external_remeda_namespaceObject.isNullish)(datasetReshapeInfo[0].foldInfoList?.[1])) return result;
6099
+ const foldInfoList = datasetReshapeInfo[0].foldInfoList;
6100
+ const { measureId, measureValue } = foldInfoList[1];
6101
+ const { label } = baseConfig;
6102
+ const { enable } = label;
6103
+ result.label = {
6104
+ visible: enable,
6105
+ formatMethod: (value, datum)=>{
6106
+ const result = [];
6107
+ const formatValue = (value)=>{
6108
+ const id = datum[measureId];
6109
+ const measure = findMeasureById(measures, id);
6110
+ if (!measure) return value;
6111
+ const { format = {}, autoFormat = true } = measure;
6112
+ if (!(0, external_remeda_namespaceObject.isEmpty)(format)) {
6113
+ const formatter = createFormatter(format);
6114
+ return formatter(value);
6115
+ }
6116
+ if (autoFormat) return autoFormatter(value, locale);
6117
+ return String(value);
6118
+ };
6119
+ result.push(formatValue(datum[measureValue]));
6120
+ return result.join(' ');
6121
+ }
6122
+ };
6123
+ return result;
6124
+ };
6125
+ const tooltipPrimary = (spec, context)=>{
6126
+ const result = {
6127
+ ...spec
6128
+ };
6129
+ const { advancedVSeed } = context;
6130
+ const { measures, datasetReshapeInfo, chartType, locale, dimensions } = advancedVSeed;
6131
+ const baseConfig = advancedVSeed.config[chartType];
6132
+ const { tooltip = {
6133
+ enable: true
6134
+ } } = baseConfig;
6135
+ const { enable } = tooltip;
6136
+ const foldInfoList = datasetReshapeInfo[0].foldInfoList;
6137
+ const unfoldInfo = datasetReshapeInfo[0].unfoldInfo;
6138
+ const { measureId, measureValue, measureName } = foldInfoList[0];
6139
+ const { groupName } = unfoldInfo;
6140
+ result.tooltip = {
6141
+ visible: enable,
6142
+ mark: {
6143
+ title: {
6144
+ visible: true
6145
+ },
6146
+ content: [
6147
+ ...dimensions.map((item)=>({
6148
+ visible: true,
6149
+ hasShape: true,
6150
+ shapeType: 'rectRound',
6151
+ key: (datum)=>{
6152
+ if (item.alias || item.id) return item.alias || item.id;
6153
+ return datum && datum[item.id];
6154
+ },
6155
+ value: (datum)=>datum && datum[item.id]
6156
+ })),
6157
+ {
6158
+ visible: true,
6159
+ hasShape: true,
6160
+ key: (datum)=>datum && datum[measureName || groupName] || '',
6161
+ value: (datum)=>{
6162
+ if (!datum) return '';
6163
+ const value = datum[measureValue];
6164
+ const id = datum[measureId];
6165
+ const measure = findMeasureById(measures, id);
6166
+ if (!measure) return String(value);
6167
+ const { format = {}, autoFormat = true } = measure;
6168
+ if (!(0, external_remeda_namespaceObject.isEmpty)(format)) {
6169
+ const formatter = createFormatter(format);
6170
+ return formatter(value);
6171
+ }
6172
+ if (autoFormat) return autoFormatter(value, locale);
6173
+ return String(value);
6174
+ }
6175
+ }
6176
+ ]
6177
+ },
6178
+ dimension: {
6179
+ content: [
6180
+ {
6181
+ visible: true,
6182
+ key: (datum)=>datum && datum[groupName] || '',
6183
+ value: (datum)=>{
6184
+ if (!datum) return '';
6185
+ const value = datum[measureValue];
6186
+ const id = datum[measureId];
6187
+ const measure = findMeasureById(measures, id);
6188
+ if (!measure) return String(value);
6189
+ const { format = {}, autoFormat = true } = measure;
6190
+ if (!(0, external_remeda_namespaceObject.isEmpty)(format)) {
6191
+ const formatter = createFormatter(format);
6192
+ return formatter(value);
6193
+ }
6194
+ if (autoFormat) return autoFormatter(value, locale);
6195
+ return String(value);
6196
+ },
6197
+ shapeType: 'rectRound'
6198
+ }
6199
+ ]
6200
+ }
6201
+ };
6202
+ return result;
6203
+ };
6204
+ const tooltipSecondary = (spec, context)=>{
6205
+ const result = {
6206
+ ...spec
6207
+ };
6208
+ const { advancedVSeed } = context;
6209
+ const { measures, datasetReshapeInfo, chartType, locale, dimensions } = advancedVSeed;
6210
+ const baseConfig = advancedVSeed.config[chartType];
6211
+ const { tooltip = {
6212
+ enable: true
6213
+ } } = baseConfig;
6214
+ const { enable } = tooltip;
6215
+ if ((0, external_remeda_namespaceObject.isNullish)(datasetReshapeInfo[0].foldInfoList?.[1])) return result;
6216
+ const foldInfoList = datasetReshapeInfo[0].foldInfoList;
6217
+ const unfoldInfo = datasetReshapeInfo[0].unfoldInfo;
6218
+ const { measureId, measureValue, measureName } = foldInfoList[1];
6219
+ const { groupName } = unfoldInfo;
6220
+ result.tooltip = {
6221
+ visible: enable,
6222
+ mark: {
6223
+ title: {
6224
+ visible: true
6225
+ },
6226
+ content: [
6227
+ ...dimensions.map((item)=>({
6228
+ visible: true,
6229
+ hasShape: true,
6230
+ shapeType: 'rectRound',
6231
+ key: (datum)=>{
6232
+ if (item.alias || item.id) return item.alias || item.id;
6233
+ return datum && datum[item.id];
6234
+ },
6235
+ value: (datum)=>datum && datum[item.id]
6236
+ })),
6237
+ {
6238
+ visible: true,
6239
+ hasShape: true,
6240
+ key: (datum)=>datum && datum[measureName || groupName] || '',
6241
+ value: (datum)=>{
6242
+ if (!datum) return '';
6243
+ const value = datum[measureValue];
6244
+ const id = datum[measureId];
6245
+ const measure = findMeasureById(measures, id);
6246
+ if (!measure) return String(value);
6247
+ const { format = {}, autoFormat = true } = measure;
6248
+ if (!(0, external_remeda_namespaceObject.isEmpty)(format)) {
6249
+ const formatter = createFormatter(format);
6250
+ return formatter(value);
6251
+ }
6252
+ if (autoFormat) return autoFormatter(value, locale);
6253
+ return String(value);
6254
+ }
6255
+ }
6256
+ ]
6257
+ },
6258
+ dimension: {
6259
+ content: [
6260
+ {
6261
+ visible: true,
6262
+ key: (datum)=>datum && datum[groupName] || '',
6263
+ value: (datum)=>{
6264
+ if (!datum) return '';
6265
+ const value = datum[measureValue];
6266
+ const id = datum[measureId];
6267
+ const measure = findMeasureById(measures, id);
6268
+ if (!measure) return String(value);
6269
+ const { format = {}, autoFormat = true } = measure;
6270
+ if (!(0, external_remeda_namespaceObject.isEmpty)(format)) {
6271
+ const formatter = createFormatter(format);
6272
+ return formatter(value);
6273
+ }
6274
+ if (autoFormat) return autoFormatter(value, locale);
6275
+ return String(value);
6276
+ },
6277
+ shapeType: 'rectRound'
6278
+ }
6279
+ ]
6280
+ }
6281
+ };
6282
+ return result;
6283
+ };
6284
+ const yLinearPrimary = (spec, context)=>{
6285
+ const result = {
6286
+ ...spec
6287
+ };
6288
+ const { advancedVSeed, vseed } = context;
6289
+ const { chartType } = vseed;
6290
+ const { locale, datasetReshapeInfo } = advancedVSeed;
6291
+ const config = advancedVSeed.config?.[chartType]?.primaryYAxis;
6292
+ if (datasetReshapeInfo[0].foldInfoList?.[0] && (0, external_remeda_namespaceObject.isEmpty)(datasetReshapeInfo[0].foldInfoList[0].foldMap)) return result;
6293
+ const id = `${datasetReshapeInfo[0].id}-primary-axis`;
6294
+ const seriesId = `${datasetReshapeInfo[0].id}-primary-series`;
6295
+ if (!result.axes) result.axes = [];
6296
+ if (!config) {
6297
+ result.axes = [
6298
+ ...result.axes,
6299
+ {
6300
+ visible: true,
6301
+ id,
6302
+ seriesId,
6303
+ type: 'linear',
6304
+ orient: 'left',
6305
+ sync: {
6306
+ axisId: `${datasetReshapeInfo[0].id}-secondary-axis`,
6307
+ tickAlign: false,
6308
+ zeroAlign: true
6309
+ }
6310
+ }
6311
+ ];
6312
+ return result;
6313
+ }
6314
+ const { visible = true, label, tick, title, grid, line, zero, nice, inverse, max, min, log, logBase = 10 } = config;
6315
+ const linearAxis = {
6316
+ visible,
6317
+ id,
6318
+ seriesId,
6319
+ sync: {
6320
+ axisId: `${datasetReshapeInfo[0].id}-secondary-axis`,
6321
+ tickAlign: false,
6322
+ zeroAlign: true
6323
+ },
6324
+ type: log ? 'log' : 'linear',
6325
+ base: logBase,
6326
+ orient: 'left',
6327
+ nice,
6328
+ zero: log ? false : zero,
6329
+ inverse,
6330
+ max,
6331
+ min,
6332
+ label: {
6333
+ visible: label?.visible,
6334
+ formatMethod: (value)=>autoFormatter(value, locale),
6335
+ style: {
6336
+ fill: label?.labelColor,
6337
+ angle: label?.labelAngle,
6338
+ fontSize: label?.labelFontSize,
6339
+ fontWeight: label?.labelFontWeight
6340
+ }
6341
+ },
6342
+ title: {
6343
+ visible: title?.visible,
6344
+ text: title?.titleText,
6345
+ style: {
6346
+ fill: title?.titleColor,
6347
+ fontSize: title?.titleFontSize,
6348
+ fontWeight: title?.titleFontWeight
6349
+ }
6350
+ },
6351
+ tick: {
6352
+ visible: tick?.visible,
6353
+ tickSize: tick?.tickSize,
6354
+ inside: tick?.tickInside,
6355
+ style: {
6356
+ stroke: tick?.tickColor
6357
+ }
6358
+ },
6359
+ grid: {
6360
+ visible: grid?.visible,
6361
+ style: {
6362
+ lineWidth: grid?.gridWidth,
6363
+ stroke: grid?.gridColor
6364
+ }
6365
+ },
6366
+ domainLine: {
6367
+ visible: line?.visible,
6368
+ style: {
6369
+ lineWidth: line?.lineWidth,
6370
+ stroke: line?.lineColor
6371
+ }
6372
+ },
6373
+ innerOffset: {
6374
+ top: LINEAR_AXIS_INNER_OFFSET_TOP
6375
+ }
6376
+ };
6377
+ result.axes = [
6378
+ ...result.axes,
6379
+ linearAxis
6380
+ ];
6381
+ return result;
6382
+ };
6383
+ const yLinearSecondary = (spec, context)=>{
6384
+ const result = {
6385
+ ...spec
6386
+ };
6387
+ const { advancedVSeed, vseed } = context;
6388
+ const { chartType } = vseed;
6389
+ const { locale, datasetReshapeInfo } = advancedVSeed;
6390
+ const config = advancedVSeed.config?.[chartType]?.secondaryYAxis;
6391
+ if ((0, external_remeda_namespaceObject.isNullish)(datasetReshapeInfo[0].foldInfoList?.[1])) return result;
6392
+ const id = `${datasetReshapeInfo[0].id}-secondary-axis`;
6393
+ const seriesId = `${datasetReshapeInfo[0].id}-secondary-series`;
6394
+ if (!result.axes) result.axes = [];
6395
+ if (!config) {
6396
+ result.axes = [
6397
+ ...result.axes,
6398
+ {
6399
+ visible: true,
6400
+ id,
6401
+ seriesId,
6402
+ type: 'linear',
6403
+ orient: 'right'
6404
+ }
6405
+ ];
6406
+ return result;
6407
+ }
6408
+ const { visible = true, label, tick, title, grid, line, zero, nice, inverse, max, min, log, logBase = 10 } = config;
6409
+ const linearAxis = {
6410
+ visible,
6411
+ id,
6412
+ seriesId,
6413
+ type: log ? 'log' : 'linear',
6414
+ base: logBase,
6415
+ orient: 'right',
6416
+ nice,
6417
+ zero: log ? false : zero,
6418
+ inverse,
6419
+ max,
6420
+ min,
6421
+ label: {
6422
+ visible: label?.visible,
6423
+ formatMethod: (value)=>autoFormatter(value, locale),
6424
+ style: {
6425
+ fill: label?.labelColor,
6426
+ angle: label?.labelAngle,
6427
+ fontSize: label?.labelFontSize,
6428
+ fontWeight: label?.labelFontWeight
6429
+ }
6430
+ },
6431
+ title: {
6432
+ visible: title?.visible,
6433
+ text: title?.titleText,
6434
+ style: {
6435
+ fill: title?.titleColor,
6436
+ fontSize: title?.titleFontSize,
6437
+ fontWeight: title?.titleFontWeight
6438
+ }
6439
+ },
6440
+ tick: {
6441
+ visible: tick?.visible,
6442
+ tickSize: tick?.tickSize,
6443
+ inside: tick?.tickInside,
6444
+ style: {
6445
+ stroke: tick?.tickColor
6446
+ }
6447
+ },
6448
+ grid: {
6449
+ visible: grid?.visible,
6450
+ style: {
6451
+ lineWidth: grid?.gridWidth,
6452
+ stroke: grid?.gridColor
6453
+ }
6454
+ },
6455
+ domainLine: {
6456
+ visible: line?.visible,
6457
+ style: {
6458
+ lineWidth: line?.lineWidth,
6459
+ stroke: line?.lineColor
6460
+ }
6461
+ },
6462
+ innerOffset: {
6463
+ top: LINEAR_AXIS_INNER_OFFSET_TOP
6464
+ }
6465
+ };
6466
+ result.axes = [
6467
+ ...result.axes,
6468
+ linearAxis
6469
+ ];
6470
+ return result;
6471
+ };
6472
+ const dualAxis = [
6473
+ series([
6474
+ initDualAxisPrimary,
6475
+ dualChartTypePrimary,
6476
+ datasetPrimary,
6477
+ labelPrimary,
6478
+ tooltipPrimary,
6479
+ progressive,
6480
+ barStyle_barStyle,
6481
+ pointStyle_pointStyle,
6482
+ pointStateDimensionHover,
6483
+ lineStyle_lineStyle,
6484
+ areaStyle_areaStyle
6485
+ ], [
6486
+ initDualAxisSecondary,
6487
+ dualChartTypeSecondary,
6488
+ datasetSecondary,
6489
+ labelSecondary,
6490
+ tooltipSecondary,
6491
+ progressive,
6492
+ barStyle_barStyle,
6493
+ pointStyle_pointStyle,
6494
+ pointStateDimensionHover,
6495
+ lineStyle_lineStyle,
6496
+ areaStyle_areaStyle
6497
+ ]),
6498
+ xBand,
6499
+ yLinearPrimary,
6500
+ yLinearSecondary,
6501
+ color_color,
6502
+ background_backgroundColor,
6503
+ discreteLegend,
6504
+ verticalCrosshairRect,
6505
+ annotationPoint_annotationPoint,
6506
+ annotationVerticalLine_annotationVerticalLine,
6507
+ annotationHorizontalLine_annotationHorizontalLine,
6508
+ annotationArea_annotationArea
6509
+ ];
6510
+ const pivotDualAxis = [
6511
+ initPivot,
6512
+ pivotGridStyle,
6513
+ pivotIndicators_pivotIndicatorsAsRow,
6514
+ datasetPivot,
6515
+ pivotIndicators_pivotIndicators([
6516
+ series([
6517
+ initDualAxisPrimary,
6518
+ datasetPrimary,
6519
+ labelPrimary,
6520
+ tooltipPrimary,
6521
+ progressive,
6522
+ barStyle_barStyle,
6523
+ pointStyle_pointStyle,
6524
+ pointStateDimensionHover,
6525
+ lineStyle_lineStyle,
6526
+ areaStyle_areaStyle
6527
+ ], [
6528
+ initDualAxisSecondary,
6529
+ datasetSecondary,
6530
+ labelSecondary,
6531
+ tooltipSecondary,
6532
+ progressive,
6533
+ barStyle_barStyle,
6534
+ pointStyle_pointStyle,
6535
+ pointStateDimensionHover,
6536
+ lineStyle_lineStyle,
6537
+ areaStyle_areaStyle
6538
+ ]),
6539
+ xBand,
6540
+ yLinearPrimary,
6541
+ yLinearSecondary,
6542
+ color_color,
6543
+ background_backgroundColor,
6544
+ verticalCrosshairRect,
6545
+ annotationPoint_annotationPoint,
6546
+ annotationVerticalLine_annotationVerticalLine,
6547
+ annotationHorizontalLine_annotationHorizontalLine,
6548
+ annotationArea_annotationArea
6549
+ ]),
6550
+ pivotRowDimensions,
6551
+ pivotColumnDimensions,
6552
+ pivotDiscreteLegend
6553
+ ];
6554
+ const dualAxisSpecPipeline = [
6555
+ pivotAdapter_pivotAdapter(dualAxis, pivotDualAxis)
6556
+ ];
6557
+ const registerDualAxis = ()=>{
6558
+ Builder._advancedPipelineMap.dualAxis = dualAxisAdvancedPipeline;
6559
+ Builder._specPipelineMap.dualAxis = dualAxisSpecPipeline;
6560
+ };
6561
+ const dataReshapeFor1D1M_emptyReshapeResult = {
6562
+ dataset: [],
6563
+ foldInfo: {
6564
+ foldMap: {},
6565
+ measureId: '',
6566
+ measureName: '',
6567
+ measureValue: ''
6568
+ },
6569
+ unfoldInfo: {
6570
+ groupName: '',
6571
+ groupId: '',
6572
+ colorItems: [],
6573
+ colorIdMap: {}
6574
+ }
6575
+ };
6576
+ const dataReshapeFor1D1M = (dataset, dimensions, measures, options)=>{
6577
+ const { foldMeasureId = FoldMeasureId, foldMeasureName = FoldMeasureName, foldMeasureValue = FoldMeasureValue, unfoldDimensionGroup = UnfoldDimensionGroup, unfoldDimensionGroupId = UnfoldDimensionGroupId } = options || {};
6578
+ if (0 === dimensions.length && 0 === measures.length) return dataReshapeFor1D1M_emptyReshapeResult;
6579
+ const { dataset: foldedDataset, foldInfo } = foldMeasures(dataset, measures, foldMeasureId, foldMeasureName, foldMeasureValue);
6580
+ if (0 === dimensions.length) {
6581
+ const { dataset: finalDataset, unfoldInfo } = unfoldDimensions(foldedDataset, [
6582
+ {
6583
+ id: foldMeasureName,
6584
+ alias: i18n`指标名称`,
6585
+ location: 'dimension'
6586
+ }
6587
+ ], [
6588
+ {
6589
+ id: foldMeasureValue,
6590
+ alias: i18n`指标值`
6591
+ }
6592
+ ], 0, unfoldDimensionGroup, unfoldDimensionGroupId, foldMeasureId);
6593
+ return {
6594
+ dataset: finalDataset,
6595
+ foldInfo,
6596
+ unfoldInfo
6597
+ };
6598
+ }
6599
+ {
6600
+ const dims = 1 === measures.length ? [
6601
+ ...dimensions
6602
+ ] : [
6603
+ ...dimensions,
6604
+ {
6605
+ id: foldMeasureName,
6606
+ alias: i18n`指标名称`,
6607
+ location: 'dimension'
6608
+ }
6609
+ ];
6610
+ const { dataset: finalDataset, unfoldInfo } = unfoldDimensions(foldedDataset, dims, [
6611
+ {
6612
+ id: foldMeasureValue,
6613
+ alias: i18n`指标值`
6614
+ }
6615
+ ], 0, unfoldDimensionGroup, unfoldDimensionGroupId, foldMeasureId);
6616
+ return {
6617
+ dataset: finalDataset,
6618
+ foldInfo,
6619
+ unfoldInfo
6620
+ };
6621
+ }
6622
+ };
6623
+ const reshapeTo1D1M = (advancedVSeed, context)=>{
6624
+ const result = {
6625
+ ...advancedVSeed
6626
+ };
6627
+ const { vseed } = context;
6628
+ const { dataset } = vseed;
6629
+ const { dimensions, measures } = advancedVSeed;
6630
+ if (!measures || !dimensions || !dataset) return result;
6631
+ if (0 === measures.length) throw new Error('measures can not be empty');
6632
+ const { dataset: newDatasets, foldInfo, unfoldInfo } = dataReshapeFor1D1M(dataset, dimensions, measures);
6633
+ return {
6634
+ ...result,
6635
+ dataset: newDatasets,
6636
+ datasetReshapeInfo: [
6637
+ {
6638
+ id: '1D1M',
6639
+ index: 0,
6640
+ foldInfo,
6641
+ unfoldInfo
6642
+ }
6643
+ ]
6644
+ };
6645
+ };
6646
+ const pivotReshapeTo1D1M = (advancedVSeed, context)=>{
6647
+ const result = {
6648
+ ...advancedVSeed
6649
+ };
6650
+ const { vseed } = context;
6651
+ const { dataset } = vseed;
6652
+ const { measures } = advancedVSeed;
6653
+ const dimensions = advancedVSeed.dimensions;
6654
+ if (!measures || !dimensions) return result;
6655
+ const measureGroups = [];
6656
+ if (measures) measures.forEach((measure)=>{
6657
+ if (measure.children && measure.children.length > 0) measureGroups.push(measure);
6658
+ });
6659
+ const newDatasets = [];
6660
+ const datasetReshapeInfo = [];
6661
+ measureGroups.forEach((measureGroup, index)=>{
6662
+ const measures = measureGroup.children;
6663
+ if (!measures) return;
6664
+ const commonDimensions = dimensions.filter((dim)=>'dimension' === dim.location);
6665
+ const groupId = measureGroup.id;
6666
+ const { dataset: newSubDataset, foldInfo, unfoldInfo } = dataReshapeFor1D1M(dataset, commonDimensions, measures, {
6667
+ foldMeasureId: FoldMeasureId,
6668
+ foldMeasureName: FoldMeasureName,
6669
+ foldMeasureValue: FoldMeasureValue + groupId,
6670
+ unfoldDimensionGroup: UnfoldDimensionGroup
6671
+ });
6672
+ const reshapeInfo = {
6673
+ id: groupId,
6674
+ index,
6675
+ foldInfo,
6676
+ unfoldInfo
6677
+ };
6678
+ newDatasets.push(newSubDataset);
6679
+ datasetReshapeInfo.push(reshapeInfo);
6680
+ });
6681
+ return {
6682
+ ...result,
6683
+ dataset: newDatasets,
6684
+ datasetReshapeInfo: datasetReshapeInfo
6685
+ };
6686
+ };
6687
+ const encodingPie = (advancedVSeed)=>{
6688
+ const result = {
6689
+ ...advancedVSeed
6690
+ };
6691
+ const { datasetReshapeInfo } = advancedVSeed;
6692
+ if (!datasetReshapeInfo) return result;
6693
+ const encoding = datasetReshapeInfo.reduce((prev, cur)=>{
6694
+ const { foldInfo, unfoldInfo } = cur;
6695
+ const radius = [
6696
+ foldInfo.measureValue
6697
+ ];
6698
+ const angle = [
6699
+ unfoldInfo.groupId
6700
+ ];
6701
+ const group = [
6702
+ unfoldInfo.groupId
6703
+ ];
6704
+ const color = [
6705
+ unfoldInfo.groupId
6706
+ ];
6707
+ return [
6708
+ ...prev,
6709
+ {
6710
+ angle,
6711
+ radius,
6712
+ group,
6713
+ color
6714
+ }
6715
+ ];
6716
+ }, []);
6717
+ return {
6718
+ ...result,
6719
+ encoding
6720
+ };
6721
+ };
6722
+ const pieAdvancedPipeline = [
6723
+ initAdvancedVSeed_initAdvancedVSeed,
6724
+ autoMeasures_autoMeasures,
6725
+ autoDimensions_autoDimensions,
6726
+ pivotAdapter([
6727
+ reshapeTo1D1M
6728
+ ], [
6729
+ pivotReshapeTo1D1M
6730
+ ]),
6731
+ encodingPie,
6732
+ pieConfig,
6733
+ theme_theme,
6734
+ annotation_annotation
6735
+ ];
6736
+ const initPie = (spec, context)=>{
6737
+ const result = {
6738
+ ...spec
6739
+ };
6740
+ const { advancedVSeed } = context;
6741
+ const { encoding, dataset } = advancedVSeed;
6742
+ if (!encoding[0].angle || !encoding[0].radius || !encoding[0].group) return result;
6743
+ const showStroke = dataset.length <= 30;
6744
+ result.type = 'pie';
6745
+ result.outerRadius = 0.8;
6746
+ result.innerRadius = 0;
6747
+ result.valueField = encoding[0].radius[0];
6748
+ result.categoryField = encoding[0].angle[0];
6749
+ result.seriesField = encoding[0].group[0];
6750
+ result.padding = 0;
6751
+ result.region = [
6752
+ {
6753
+ clip: true
6754
+ }
6755
+ ];
6756
+ result.pie = {
6757
+ style: {
6758
+ stroke: '#ffffff',
6759
+ lineWidth: showStroke ? 1 : 0,
6760
+ centerOffset: 0
6761
+ },
6762
+ state: {
6763
+ hover: {
6764
+ outerRadius: 1.1 * result.outerRadius
6765
+ }
6766
+ }
6767
+ };
6768
+ result.animation = true;
6769
+ return result;
6770
+ };
6771
+ const pie = [
6772
+ initPie,
6773
+ color_color,
5724
6774
  background_backgroundColor,
5725
6775
  datasetXY,
5726
6776
  progressive,
@@ -6975,6 +8025,17 @@ const lightTheme = ()=>{
6975
8025
  },
6976
8026
  crosshairLine
6977
8027
  },
8028
+ dualAxis: {
8029
+ ...baseConfig,
8030
+ xAxis: bandAxis,
8031
+ primaryYAxis: linearAxis,
8032
+ secondaryYAxis: linearAxis,
8033
+ dualChartType: {
8034
+ primary: 'column',
8035
+ secondary: 'line'
8036
+ },
8037
+ crosshairRect
8038
+ },
6978
8039
  pie: {
6979
8040
  ...baseConfig
6980
8041
  },
@@ -7297,6 +8358,17 @@ const darkTheme = ()=>{
7297
8358
  },
7298
8359
  crosshairLine
7299
8360
  },
8361
+ dualAxis: {
8362
+ ...baseConfig,
8363
+ xAxis: bandAxis,
8364
+ primaryYAxis: linearAxis,
8365
+ secondaryYAxis: linearAxis,
8366
+ dualChartType: {
8367
+ primary: 'column',
8368
+ secondary: 'line'
8369
+ },
8370
+ crosshairRect
8371
+ },
7300
8372
  pie: {
7301
8373
  ...baseConfig
7302
8374
  },
@@ -7362,6 +8434,7 @@ const registerAll = ()=>{
7362
8434
  registerAreaPercent();
7363
8435
  registerAreaRange();
7364
8436
  registerScatter();
8437
+ registerDualAxis();
7365
8438
  registerPie();
7366
8439
  registerDonut();
7367
8440
  registerRose();
@@ -7402,6 +8475,26 @@ const zChartType = external_zod_namespaceObject.z["enum"]([
7402
8475
  'funnel',
7403
8476
  'heatmap'
7404
8477
  ]);
8478
+ const zDualChartType = external_zod_namespaceObject.z.object({
8479
+ primary: external_zod_namespaceObject.z["enum"]([
8480
+ 'line',
8481
+ 'column',
8482
+ 'columnPercent',
8483
+ 'columnParallel',
8484
+ 'area',
8485
+ 'areaPercent',
8486
+ 'scatter'
8487
+ ]).default('column'),
8488
+ secondary: external_zod_namespaceObject.z["enum"]([
8489
+ 'line',
8490
+ 'column',
8491
+ 'columnPercent',
8492
+ 'columnParallel',
8493
+ 'area',
8494
+ 'areaPercent',
8495
+ 'scatter'
8496
+ ]).default('line')
8497
+ });
7405
8498
  const zDatum = external_zod_namespaceObject.z.record(external_zod_namespaceObject.z.string().or(external_zod_namespaceObject.z.number()), external_zod_namespaceObject.z.any());
7406
8499
  const zDataset = external_zod_namespaceObject.z.array(zDatum);
7407
8500
  const zDimension = external_zod_namespaceObject.z.object({
@@ -7467,6 +8560,14 @@ const zMeasureGroup = external_zod_namespaceObject.z.object({
7467
8560
  });
7468
8561
  const zMeasures = external_zod_namespaceObject.z.array(zMeasure);
7469
8562
  const zMeasureTree = external_zod_namespaceObject.z.array(zMeasureGroup.or(zMeasure));
8563
+ const zDualMeasure = external_zod_namespaceObject.z.object({
8564
+ id: external_zod_namespaceObject.z.string(),
8565
+ primaryMeasures: external_zod_namespaceObject.z.array(zMeasure).or(zMeasure).optional(),
8566
+ primaryAlias: external_zod_namespaceObject.z.string().optional(),
8567
+ secondaryMeasures: external_zod_namespaceObject.z.array(zMeasure).or(zMeasure).optional(),
8568
+ secondaryAlias: external_zod_namespaceObject.z.string().optional()
8569
+ });
8570
+ const zDualMeasures = external_zod_namespaceObject.z.array(zDualMeasure);
7470
8571
  const zFoldInfo = external_zod_namespaceObject.z.object({
7471
8572
  foldMap: external_zod_namespaceObject.z.record(external_zod_namespaceObject.z.string(), external_zod_namespaceObject.z.string().or(external_zod_namespaceObject.z.undefined())),
7472
8573
  measureId: external_zod_namespaceObject.z.string(),
@@ -7481,7 +8582,9 @@ const zUnfoldInfo = external_zod_namespaceObject.z.object({
7481
8582
  });
7482
8583
  const zDatasetReshapeInfo = external_zod_namespaceObject.z.array(external_zod_namespaceObject.z.object({
7483
8584
  id: external_zod_namespaceObject.z.string(),
8585
+ index: external_zod_namespaceObject.z.number(),
7484
8586
  foldInfo: zFoldInfo,
8587
+ foldInfoList: external_zod_namespaceObject.z.array(zFoldInfo).optional(),
7485
8588
  unfoldInfo: zUnfoldInfo
7486
8589
  }));
7487
8590
  const zEncoding = external_zod_namespaceObject.z.array(external_zod_namespaceObject.z.object({
@@ -7761,7 +8864,12 @@ const zDualAxisConfig = external_zod_namespaceObject.z.object({
7761
8864
  label: zLabel.optional(),
7762
8865
  color: zColor.optional(),
7763
8866
  tooltip: zTooltip.optional(),
7764
- legend: zLegend.optional()
8867
+ legend: zLegend.optional(),
8868
+ dualChartType: external_zod_namespaceObject.z.array(zDualChartType).or(zDualChartType).optional(),
8869
+ primaryYAxis: external_zod_namespaceObject.z.array(zYLinearAxis).or(zYLinearAxis).optional(),
8870
+ secondaryYAxis: external_zod_namespaceObject.z.array(zYLinearAxis).or(zYLinearAxis).optional(),
8871
+ xAxis: zXBandAxis.optional(),
8872
+ crosshairRect: zCrosshairRect.optional()
7765
8873
  });
7766
8874
  const zScatterConfig = external_zod_namespaceObject.z.object({
7767
8875
  backgroundColor: zBackgroundColor.optional(),
@@ -7805,8 +8913,8 @@ const zConfig = external_zod_namespaceObject.z.object({
7805
8913
  area: zAreaConfig.optional(),
7806
8914
  areaPercent: zAreaPercentConfig.optional(),
7807
8915
  areaRange: zAreaRangeConfig.optional(),
7808
- dualAxis: zDualAxisConfig.optional(),
7809
8916
  scatter: zScatterConfig.optional(),
8917
+ dualAxis: zDualAxisConfig.optional(),
7810
8918
  rose: zRoseConfig.optional(),
7811
8919
  roseParallel: zRoseParallelConfig.optional(),
7812
8920
  pie: zPieConfig.optional(),
@@ -8056,20 +9164,20 @@ const zAnnotationVerticalLine = external_zod_namespaceObject.z.object({
8056
9164
  'middle',
8057
9165
  'bottom'
8058
9166
  ]).default('top').optional(),
8059
- lineVisible: external_zod_namespaceObject.z.boolean().optional(),
8060
- lineColor: external_zod_namespaceObject.z.string().optional(),
8061
- lineWidth: external_zod_namespaceObject.z.number().optional(),
9167
+ lineVisible: external_zod_namespaceObject.z.boolean().default(true).optional(),
9168
+ lineColor: external_zod_namespaceObject.z.string().default('#212121').optional(),
9169
+ lineWidth: external_zod_namespaceObject.z.number().default(1).optional(),
8062
9170
  lineStyle: external_zod_namespaceObject.z.union([
8063
9171
  external_zod_namespaceObject.z.literal('solid'),
8064
9172
  external_zod_namespaceObject.z.literal('dashed'),
8065
9173
  external_zod_namespaceObject.z.literal('dotted')
8066
- ]).optional(),
9174
+ ]).default('dashed').optional(),
8067
9175
  backgroundVisible: external_zod_namespaceObject.z.boolean().default(true).optional(),
8068
9176
  backgroundColor: external_zod_namespaceObject.z.string().default('#212121').optional(),
8069
- backgroundBorderColor: external_zod_namespaceObject.z.string().optional(),
8070
- backgroundBorderWidth: external_zod_namespaceObject.z.number().default(1).optional(),
9177
+ backgroundBorderColor: external_zod_namespaceObject.z.string().default('#212121').optional(),
8071
9178
  backgroundBorderRadius: external_zod_namespaceObject.z.number().default(4).optional(),
8072
- backgroundPadding: external_zod_namespaceObject.z.number().optional(),
9179
+ backgroundBorderWidth: external_zod_namespaceObject.z.number().default(1).optional(),
9180
+ backgroundPadding: external_zod_namespaceObject.z.number().default(2).optional(),
8073
9181
  offsetX: external_zod_namespaceObject.z.number().default(0),
8074
9182
  offsetY: external_zod_namespaceObject.z.number().default(0)
8075
9183
  });
@@ -8094,7 +9202,7 @@ const zAnnotationHorizontalLine = external_zod_namespaceObject.z.object({
8094
9202
  'insideStart',
8095
9203
  'insideMiddle',
8096
9204
  'insideEnd'
8097
- ]).default('insideMiddle').optional(),
9205
+ ]).default('insideEnd').optional(),
8098
9206
  textColor: external_zod_namespaceObject.z.string().default('#ffffff').optional(),
8099
9207
  textFontSize: external_zod_namespaceObject.z.number().default(12).optional(),
8100
9208
  textFontWeight: external_zod_namespaceObject.z.number().default(400).optional(),
@@ -8102,26 +9210,26 @@ const zAnnotationHorizontalLine = external_zod_namespaceObject.z.object({
8102
9210
  'left',
8103
9211
  'right',
8104
9212
  'center'
8105
- ]).default('center').optional(),
9213
+ ]).default('right').optional(),
8106
9214
  textBaseline: external_zod_namespaceObject.z["enum"]([
8107
9215
  'top',
8108
9216
  'middle',
8109
9217
  'bottom'
8110
- ]).default('bottom').optional(),
8111
- lineVisible: external_zod_namespaceObject.z.boolean().optional(),
8112
- lineColor: external_zod_namespaceObject.z.string().optional(),
8113
- lineWidth: external_zod_namespaceObject.z.number().optional(),
9218
+ ]).default('top').optional(),
9219
+ lineVisible: external_zod_namespaceObject.z.boolean().default(true).optional(),
9220
+ lineColor: external_zod_namespaceObject.z.string().default('#212121').optional(),
9221
+ lineWidth: external_zod_namespaceObject.z.number().default(1).optional(),
8114
9222
  lineStyle: external_zod_namespaceObject.z.union([
8115
9223
  external_zod_namespaceObject.z.literal('solid'),
8116
9224
  external_zod_namespaceObject.z.literal('dashed'),
8117
9225
  external_zod_namespaceObject.z.literal('dotted')
8118
- ]).optional(),
9226
+ ]).default('dashed').optional(),
8119
9227
  backgroundVisible: external_zod_namespaceObject.z.boolean().default(true).optional(),
8120
9228
  backgroundColor: external_zod_namespaceObject.z.string().default('#212121').optional(),
8121
- backgroundBorderColor: external_zod_namespaceObject.z.string().optional(),
8122
- backgroundBorderWidth: external_zod_namespaceObject.z.number().default(1).optional(),
9229
+ backgroundBorderColor: external_zod_namespaceObject.z.string().default('#212121').optional(),
8123
9230
  backgroundBorderRadius: external_zod_namespaceObject.z.number().default(4).optional(),
8124
- backgroundPadding: external_zod_namespaceObject.z.number().optional(),
9231
+ backgroundBorderWidth: external_zod_namespaceObject.z.number().default(1).optional(),
9232
+ backgroundPadding: external_zod_namespaceObject.z.number().default(2).optional(),
8125
9233
  offsetX: external_zod_namespaceObject.z.number().default(0),
8126
9234
  offsetY: external_zod_namespaceObject.z.number().default(0)
8127
9235
  });
@@ -8153,21 +9261,21 @@ const zAnnotationArea = external_zod_namespaceObject.z.object({
8153
9261
  'top',
8154
9262
  'middle',
8155
9263
  'bottom'
8156
- ]).default('middle').optional(),
9264
+ ]).default('top').optional(),
8157
9265
  backgroundVisible: external_zod_namespaceObject.z.boolean().default(true).optional(),
8158
- backgroundColor: external_zod_namespaceObject.z.string().default('#212121').optional(),
8159
- backgroundBorderColor: external_zod_namespaceObject.z.string().optional(),
9266
+ backgroundColor: external_zod_namespaceObject.z.string().default('#191d24').optional(),
9267
+ backgroundBorderColor: external_zod_namespaceObject.z.string().default('#191d24').optional(),
8160
9268
  backgroundBorderWidth: external_zod_namespaceObject.z.number().default(1).optional(),
8161
9269
  backgroundBorderRadius: external_zod_namespaceObject.z.number().default(4).optional(),
8162
- backgroundPadding: external_zod_namespaceObject.z.number().optional(),
8163
- areaColor: external_zod_namespaceObject.z.string().default('red').optional(),
8164
- areaColorOpacity: external_zod_namespaceObject.z.number().default(0.5).optional(),
8165
- areaBorderColor: external_zod_namespaceObject.z.number().optional(),
8166
- areaBorderWidth: external_zod_namespaceObject.z.number().default(2).optional(),
9270
+ backgroundPadding: external_zod_namespaceObject.z.number().default(4).optional(),
9271
+ areaColor: external_zod_namespaceObject.z.string().default('#888888').optional(),
9272
+ areaColorOpacity: external_zod_namespaceObject.z.number().default(0.15).optional(),
9273
+ areaBorderColor: external_zod_namespaceObject.z.string().default('#888888').optional(),
9274
+ areaBorderWidth: external_zod_namespaceObject.z.number().default(1).optional(),
8167
9275
  areaBorderRadius: external_zod_namespaceObject.z.number().default(4).optional(),
8168
- outerPadding: external_zod_namespaceObject.z.number().optional(),
8169
- offsetX: external_zod_namespaceObject.z.number().optional(),
8170
- offsetY: external_zod_namespaceObject.z.number().optional()
9276
+ outerPadding: external_zod_namespaceObject.z.number().default(4).optional(),
9277
+ offsetX: external_zod_namespaceObject.z.number().default(0).optional(),
9278
+ offsetY: external_zod_namespaceObject.z.number().default(0).optional()
8171
9279
  });
8172
9280
  const zAnnotation = external_zod_namespaceObject.z.object({
8173
9281
  annotationPoint: zAnnotationPoint.or(external_zod_namespaceObject.z.array(zAnnotationPoint)).optional(),
@@ -8459,6 +9567,35 @@ const zScatter = external_zod_namespaceObject.z.object({
8459
9567
  annotationArea: external_zod_namespaceObject.z.array(zAnnotationArea).or(zAnnotationArea).optional(),
8460
9568
  locale: zLocale.optional()
8461
9569
  });
9570
+ const zDualAxis = external_zod_namespaceObject.z.object({
9571
+ chartType: external_zod_namespaceObject.z.literal('dualAxis'),
9572
+ dataset: zDataset.optional(),
9573
+ dimensions: zDimensions.optional(),
9574
+ measures: zMeasureTree.optional(),
9575
+ dualMeasures: zDualMeasures.optional(),
9576
+ dualChartType: external_zod_namespaceObject.z.array(zDualChartType).or(zDualChartType).optional(),
9577
+ primaryYAxis: external_zod_namespaceObject.z.array(zYLinearAxis).or(zYLinearAxis).optional(),
9578
+ secondaryYAxis: external_zod_namespaceObject.z.array(zYLinearAxis).or(zYLinearAxis).optional(),
9579
+ xAxis: zXBandAxis.optional(),
9580
+ backgroundColor: zBackgroundColor.optional(),
9581
+ color: zColor.optional(),
9582
+ label: zLabel.optional(),
9583
+ legend: zLegend.optional(),
9584
+ tooltip: zTooltip.optional(),
9585
+ crosshairRect: zCrosshairRect.optional(),
9586
+ sort: zSort.optional(),
9587
+ sortLegend: zSortLegend.optional(),
9588
+ theme: zTheme.optional(),
9589
+ barStyle: external_zod_namespaceObject.z.array(zBarStyle).or(zBarStyle).optional(),
9590
+ pointStyle: external_zod_namespaceObject.z.array(zPointStyle).or(zPointStyle).optional(),
9591
+ lineStyle: external_zod_namespaceObject.z.array(zLineStyle).or(zLineStyle).optional(),
9592
+ areaStyle: external_zod_namespaceObject.z.array(zAreaStyle).or(zAreaStyle).optional(),
9593
+ annotationPoint: external_zod_namespaceObject.z.array(zAnnotationPoint).or(zAnnotationPoint).optional(),
9594
+ annotationVerticalLine: external_zod_namespaceObject.z.array(zAnnotationVerticalLine).or(zAnnotationVerticalLine).optional(),
9595
+ annotationHorizontalLine: external_zod_namespaceObject.z.array(zAnnotationHorizontalLine).or(zAnnotationHorizontalLine).optional(),
9596
+ annotationArea: external_zod_namespaceObject.z.array(zAnnotationArea).or(zAnnotationArea).optional(),
9597
+ locale: zLocale.optional()
9598
+ });
8462
9599
  const zRose = external_zod_namespaceObject.z.object({
8463
9600
  chartType: external_zod_namespaceObject.z.literal('rose'),
8464
9601
  dataset: zDataset.optional(),
@@ -8564,6 +9701,7 @@ const zVSeed = external_zod_namespaceObject.z.discriminatedUnion('chartType', [
8564
9701
  zAreaPercent,
8565
9702
  zAreaRange,
8566
9703
  zScatter,
9704
+ zDualAxis,
8567
9705
  zPie,
8568
9706
  zDonut,
8569
9707
  zRose,
@@ -8591,6 +9729,8 @@ exports.Builder = __webpack_exports__.Builder;
8591
9729
  exports.FoldMeasureId = __webpack_exports__.FoldMeasureId;
8592
9730
  exports.FoldMeasureName = __webpack_exports__.FoldMeasureName;
8593
9731
  exports.FoldMeasureValue = __webpack_exports__.FoldMeasureValue;
9732
+ exports.FoldPrimaryMeasureValue = __webpack_exports__.FoldPrimaryMeasureValue;
9733
+ exports.FoldSecondaryMeasureValue = __webpack_exports__.FoldSecondaryMeasureValue;
8594
9734
  exports.ORIGINAL_DATA = __webpack_exports__.ORIGINAL_DATA;
8595
9735
  exports.Separator = __webpack_exports__.Separator;
8596
9736
  exports.UnfoldDimensionGroup = __webpack_exports__.UnfoldDimensionGroup;
@@ -8625,6 +9765,8 @@ exports.dataReshapeFor2D1M = __webpack_exports__.dataReshapeFor2D1M;
8625
9765
  exports.dataReshapeFor2D1M0Name = __webpack_exports__.dataReshapeFor2D1M0Name;
8626
9766
  exports.donutAdvancedPipeline = __webpack_exports__.donutAdvancedPipeline;
8627
9767
  exports.donutSpecPipeline = __webpack_exports__.donutSpecPipeline;
9768
+ exports.dualAxisAdvancedPipeline = __webpack_exports__.dualAxisAdvancedPipeline;
9769
+ exports.dualAxisSpecPipeline = __webpack_exports__.dualAxisSpecPipeline;
8628
9770
  exports.execPipeline = __webpack_exports__.execPipeline;
8629
9771
  exports.findAllDimensions = __webpack_exports__.findAllDimensions;
8630
9772
  exports.findAllMeasures = __webpack_exports__.findAllMeasures;
@@ -8651,6 +9793,7 @@ exports.isValueSelector = __webpack_exports__.isValueSelector;
8651
9793
  exports.lightTheme = __webpack_exports__.lightTheme;
8652
9794
  exports.lineAdvancedPipeline = __webpack_exports__.lineAdvancedPipeline;
8653
9795
  exports.lineSpecPipeline = __webpack_exports__.lineSpecPipeline;
9796
+ exports.measureDepth = __webpack_exports__.measureDepth;
8654
9797
  exports.pieAdvancedPipeline = __webpack_exports__.pieAdvancedPipeline;
8655
9798
  exports.pieSpecPipeline = __webpack_exports__.pieSpecPipeline;
8656
9799
  exports.pivotTableAdvancedPipeline = __webpack_exports__.pivotTableAdvancedPipeline;
@@ -8740,7 +9883,11 @@ exports.zDimensionTree = __webpack_exports__.zDimensionTree;
8740
9883
  exports.zDimensions = __webpack_exports__.zDimensions;
8741
9884
  exports.zDonut = __webpack_exports__.zDonut;
8742
9885
  exports.zDonutConfig = __webpack_exports__.zDonutConfig;
9886
+ exports.zDualAxis = __webpack_exports__.zDualAxis;
8743
9887
  exports.zDualAxisConfig = __webpack_exports__.zDualAxisConfig;
9888
+ exports.zDualChartType = __webpack_exports__.zDualChartType;
9889
+ exports.zDualMeasure = __webpack_exports__.zDualMeasure;
9890
+ exports.zDualMeasures = __webpack_exports__.zDualMeasures;
8744
9891
  exports.zEncoding = __webpack_exports__.zEncoding;
8745
9892
  exports.zFoldInfo = __webpack_exports__.zFoldInfo;
8746
9893
  exports.zFunnel = __webpack_exports__.zFunnel;
@@ -8791,6 +9938,8 @@ for(var __webpack_i__ in __webpack_exports__)if (-1 === [
8791
9938
  "FoldMeasureId",
8792
9939
  "FoldMeasureName",
8793
9940
  "FoldMeasureValue",
9941
+ "FoldPrimaryMeasureValue",
9942
+ "FoldSecondaryMeasureValue",
8794
9943
  "ORIGINAL_DATA",
8795
9944
  "Separator",
8796
9945
  "UnfoldDimensionGroup",
@@ -8825,6 +9974,8 @@ for(var __webpack_i__ in __webpack_exports__)if (-1 === [
8825
9974
  "dataReshapeFor2D1M0Name",
8826
9975
  "donutAdvancedPipeline",
8827
9976
  "donutSpecPipeline",
9977
+ "dualAxisAdvancedPipeline",
9978
+ "dualAxisSpecPipeline",
8828
9979
  "execPipeline",
8829
9980
  "findAllDimensions",
8830
9981
  "findAllMeasures",
@@ -8851,6 +10002,7 @@ for(var __webpack_i__ in __webpack_exports__)if (-1 === [
8851
10002
  "lightTheme",
8852
10003
  "lineAdvancedPipeline",
8853
10004
  "lineSpecPipeline",
10005
+ "measureDepth",
8854
10006
  "pieAdvancedPipeline",
8855
10007
  "pieSpecPipeline",
8856
10008
  "pivotTableAdvancedPipeline",
@@ -8940,7 +10092,11 @@ for(var __webpack_i__ in __webpack_exports__)if (-1 === [
8940
10092
  "zDimensions",
8941
10093
  "zDonut",
8942
10094
  "zDonutConfig",
10095
+ "zDualAxis",
8943
10096
  "zDualAxisConfig",
10097
+ "zDualChartType",
10098
+ "zDualMeasure",
10099
+ "zDualMeasures",
8944
10100
  "zEncoding",
8945
10101
  "zFoldInfo",
8946
10102
  "zFunnel",