@visactor/vseed 0.0.33 → 0.0.35

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 (68) 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 +2794 -4887
  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 +1362 -202
  8. package/dist/index.cjs.map +1 -1
  9. package/dist/index.js +1289 -156
  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 +491 -14
  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/dualAxis/dualAxis.d.ts +123 -23
  52. package/dist/types/chartType/dualAxis/index.d.ts +1 -0
  53. package/dist/types/chartType/dualAxis/zDualAxis.d.ts +1955 -0
  54. package/dist/types/chartType/index.d.ts +1 -1
  55. package/dist/types/properties/chartType/dualChartType.d.ts +18 -0
  56. package/dist/types/properties/chartType/index.d.ts +2 -0
  57. package/dist/types/properties/config/config.d.ts +477 -7
  58. package/dist/types/properties/datasetReshapeInfo/datasetReshapeInfo.d.ts +7 -0
  59. package/dist/types/properties/measures/dualMeasures.d.ts +8 -0
  60. package/dist/types/properties/measures/index.d.ts +4 -1
  61. package/dist/types/properties/measures/measures.d.ts +0 -107
  62. package/dist/types/properties/measures/zDualMeasures.d.ts +287 -0
  63. package/dist/types/properties/measures/zMeasures.d.ts +108 -0
  64. package/dist/types/properties/theme/customTheme.d.ts +484 -14
  65. package/dist/types/vseed.d.ts +1953 -0
  66. package/dist/umd/index.js +1282 -140
  67. package/dist/umd/index.js.map +1 -1
  68. package/package.json +1 -1
package/dist/umd/index.js CHANGED
@@ -38,10 +38,11 @@
38
38
  areaSpecPipeline: ()=>areaSpecPipeline,
39
39
  isTable: ()=>isTable,
40
40
  zDonut: ()=>zDonut,
41
+ zDualMeasures: ()=>zDualMeasures,
41
42
  zPie: ()=>zPie,
42
- zRoseConfig: ()=>zRoseConfig,
43
43
  findFirstMeasure: ()=>findFirstMeasure,
44
44
  scatterAdvancedPipeline: ()=>scatterAdvancedPipeline,
45
+ zRoseConfig: ()=>zRoseConfig,
45
46
  updateSpec: ()=>updateSpec,
46
47
  zCrosshairRect: ()=>zCrosshairRect,
47
48
  scatterSpecPipeline: ()=>scatterSpecPipeline,
@@ -50,6 +51,7 @@
50
51
  zColumnConfig: ()=>zColumnConfig,
51
52
  zAnnotation: ()=>zAnnotation,
52
53
  selector: ()=>selector_selector,
54
+ zDualMeasure: ()=>zDualMeasure,
53
55
  zSortLegend: ()=>zSortLegend,
54
56
  pivotTableAdvancedPipeline: ()=>pivotTableAdvancedPipeline,
55
57
  zYBandAxis: ()=>zYBandAxis,
@@ -109,27 +111,27 @@
109
111
  registerPivotTable: ()=>registerPivotTable,
110
112
  tableAdvancedPipeline: ()=>tableAdvancedPipeline,
111
113
  pieSpecPipeline: ()=>pieSpecPipeline,
114
+ dualAxisSpecPipeline: ()=>dualAxisSpecPipeline,
112
115
  registerDarkTheme: ()=>registerDarkTheme,
113
116
  zAnnotationVerticalLine: ()=>zAnnotationVerticalLine,
114
- zChartType: ()=>zChartType,
115
117
  barSpecPipeline: ()=>barSpecPipeline,
116
- zCrosshairLine: ()=>zCrosshairLine,
118
+ zChartType: ()=>zChartType,
117
119
  registerRose: ()=>registerRose,
118
- zMeasureTree: ()=>zMeasureTree,
120
+ zCrosshairLine: ()=>zCrosshairLine,
119
121
  unfoldDimensions: ()=>unfoldDimensions,
120
122
  roseParallelAdvancedPipeline: ()=>roseParallelAdvancedPipeline,
121
123
  registerTable: ()=>registerTable,
122
- Builder: ()=>Builder,
123
124
  autoFormatter: ()=>autoFormatter,
124
125
  findFirstDimension: ()=>findFirstDimension,
126
+ Builder: ()=>Builder,
125
127
  registerAll: ()=>registerAll,
126
128
  registerBar: ()=>registerBar,
127
129
  isVChart: ()=>isVChart,
128
130
  radarSpecPipeline: ()=>radarSpecPipeline,
131
+ zMeasureTree: ()=>zMeasureTree,
129
132
  zPieConfig: ()=>zPieConfig,
130
133
  zPivotTable: ()=>zPivotTable,
131
134
  zRadar: ()=>zRadar,
132
- zRose: ()=>zRose,
133
135
  registerLine: ()=>registerLine,
134
136
  registerCustomTheme: ()=>registerCustomTheme,
135
137
  zColor: ()=>zColor,
@@ -140,16 +142,16 @@
140
142
  zDonutConfig: ()=>zDonutConfig,
141
143
  zFunnelConfig: ()=>zFunnelConfig,
142
144
  zMeasureGroup: ()=>zMeasureGroup,
143
- zMeasures: ()=>zMeasures,
145
+ zDualAxis: ()=>zDualAxis,
144
146
  FoldMeasureName: ()=>FoldMeasureName,
145
- zRadarConfig: ()=>zRadarConfig,
147
+ zDualChartType: ()=>zDualChartType,
146
148
  darkTheme: ()=>darkTheme,
147
149
  createNumFormatter: ()=>createNumFormatter,
148
150
  zAreaConfig: ()=>zAreaConfig,
149
151
  zAxis: ()=>zAxis,
150
152
  isVTable: ()=>isVTable,
151
- zTable: ()=>zTable,
152
- zUnfoldInfo: ()=>zUnfoldInfo,
153
+ zMeasures: ()=>zMeasures,
154
+ zRadarConfig: ()=>zRadarConfig,
153
155
  zLine: ()=>zLine,
154
156
  columnSpecPipeline: ()=>columnSpecPipeline,
155
157
  UnfoldDimensionGroup: ()=>UnfoldDimensionGroup,
@@ -160,6 +162,8 @@
160
162
  ORIGINAL_DATA: ()=>ORIGINAL_DATA,
161
163
  zStackCornerRadius: ()=>zStackCornerRadius,
162
164
  zAnnotationArea: ()=>zAnnotationArea,
165
+ zUnfoldInfo: ()=>zUnfoldInfo,
166
+ zRose: ()=>zRose,
163
167
  columnParallelSpecPipeline: ()=>columnParallelSpecPipeline,
164
168
  i18n: ()=>i18n,
165
169
  zPointStyle: ()=>zPointStyle,
@@ -168,12 +172,15 @@
168
172
  registerColumnParallel: ()=>registerColumnParallel,
169
173
  updateAdvanced: ()=>updateAdvanced,
170
174
  zDimension: ()=>zDimension,
175
+ zTable: ()=>zTable,
176
+ FoldSecondaryMeasureValue: ()=>FoldSecondaryMeasureValue,
171
177
  zSort: ()=>zSort,
172
178
  isPivotChart: ()=>isPivotChart,
173
179
  zDualAxisConfig: ()=>zDualAxisConfig,
174
180
  zColumn: ()=>zColumn,
175
181
  zCustomTheme: ()=>zCustomTheme,
176
182
  zLineConfig: ()=>zLineConfig,
183
+ FoldPrimaryMeasureValue: ()=>FoldPrimaryMeasureValue,
177
184
  zTableConfig: ()=>zTableConfig,
178
185
  zXBandAxis: ()=>zXBandAxis,
179
186
  dataReshapeFor1D: ()=>dataReshapeFor1D,
@@ -191,15 +198,17 @@
191
198
  zMeasure: ()=>zMeasure,
192
199
  areaRangeSpecPipeline: ()=>areaRangeSpecPipeline,
193
200
  areaRangeAdvancedPipeline: ()=>areaRangeAdvancedPipeline,
194
- zAreaRange: ()=>zAreaRange,
201
+ dualAxisAdvancedPipeline: ()=>dualAxisAdvancedPipeline,
195
202
  registerScatter: ()=>registerScatter,
196
- zEncoding: ()=>zEncoding,
203
+ zAreaRange: ()=>zAreaRange,
204
+ measureDepth: ()=>measureDepth,
197
205
  autoNumFormatter: ()=>autoNumFormatter,
198
206
  zAdvancedVSeed: ()=>zAdvancedVSeed,
199
207
  tableSpecPipeline: ()=>tableSpecPipeline,
200
208
  zConfig: ()=>zConfig,
201
- zRoseParallelConfig: ()=>zRoseParallelConfig,
209
+ zEncoding: ()=>zEncoding,
202
210
  zBarStyle: ()=>zBarStyle,
211
+ zRoseParallelConfig: ()=>zRoseParallelConfig,
203
212
  zXLinearAxis: ()=>zXLinearAxis,
204
213
  zAreaPercent: ()=>zAreaPercent,
205
214
  columnParallelAdvancedPipeline: ()=>columnParallelAdvancedPipeline,
@@ -238,11 +247,11 @@
238
247
  const start = 'undefined' != typeof performance ? performance.now() : Date.now();
239
248
  const { chartType } = builder.vseed;
240
249
  if (!chartType) throw new Error('chartType is nil in buildAdvanced');
241
- const pipeline = builder.getAdvancedPipeline(chartType);
250
+ const pipeline = Builder.getAdvancedPipeline(chartType);
242
251
  if (!pipeline) throw new Error(`no advanced pipeline for chartType ${chartType}`);
243
252
  const context = {
244
253
  vseed: builder.vseed,
245
- customTheme: builder.getThemeMap()
254
+ customTheme: Builder.getThemeMap()
246
255
  };
247
256
  try {
248
257
  return execPipeline(pipeline, context);
@@ -258,7 +267,7 @@
258
267
  const start = 'undefined' != typeof performance ? performance.now() : Date.now();
259
268
  const { chartType } = builder.vseed;
260
269
  if (!chartType) throw new Error('chartType is nil in buildSpec');
261
- const pipeline = builder.getSpecPipeline(chartType);
270
+ const pipeline = Builder.getSpecPipeline(chartType);
262
271
  if (!pipeline) throw new Error(`no spec pipeline for chartType ${chartType}`);
263
272
  const context = {
264
273
  vseed: builder.vseed,
@@ -425,20 +434,6 @@
425
434
  build = ()=>build(this);
426
435
  buildSpec = (advanced)=>buildSpec(this, advanced);
427
436
  buildAdvanced = ()=>buildAdvanced(this);
428
- getAdvancedPipeline = (chartType)=>{
429
- const customPipe = Builder._customAdvancedPipe[chartType];
430
- const pipeline = Builder._advancedPipelineMap[chartType];
431
- if (customPipe) pipeline.push(customPipe);
432
- return pipeline;
433
- };
434
- getSpecPipeline = (chartType)=>{
435
- const customPipe = Builder._customSpecPipe[chartType];
436
- const pipeline = Builder._specPipelineMap[chartType];
437
- if (customPipe) pipeline.push(customPipe);
438
- return pipeline;
439
- };
440
- getTheme = (themeKey)=>Builder._themeMap[themeKey];
441
- getThemeMap = ()=>Builder._themeMap;
442
437
  getColorItems = ()=>getColorItems(this);
443
438
  getColorIdMap = ()=>getColorIdMap(this);
444
439
  get vseed() {
@@ -465,12 +460,26 @@
465
460
  set performance(value) {
466
461
  this._performance = value;
467
462
  }
463
+ static getAdvancedPipeline = (chartType)=>{
464
+ const customPipe = Builder._customAdvancedPipe[chartType];
465
+ const pipeline = Builder._advancedPipelineMap[chartType];
466
+ if (customPipe) pipeline.push(customPipe);
467
+ return pipeline;
468
+ };
469
+ static getSpecPipeline = (chartType)=>{
470
+ const customPipe = Builder._customSpecPipe[chartType];
471
+ const pipeline = Builder._specPipelineMap[chartType];
472
+ if (customPipe) pipeline.push(customPipe);
473
+ return pipeline;
474
+ };
475
+ static getTheme = (themeKey)=>Builder._themeMap[themeKey];
476
+ static getThemeMap = ()=>Builder._themeMap;
477
+ static from = (vseed)=>new Builder(vseed);
468
478
  static _advancedPipelineMap = {};
469
479
  static _specPipelineMap = {};
470
480
  static _customAdvancedPipe = {};
471
481
  static _customSpecPipe = {};
472
482
  static _themeMap = {};
473
- static from = (vseed)=>new Builder(vseed);
474
483
  }
475
484
  const initAdvancedVSeed = (advancedVSeed, context)=>{
476
485
  const { vseed } = context;
@@ -570,7 +579,10 @@
570
579
  if (!dataset) throw new Error('dataset is required');
571
580
  if (0 === dataset.length) return result;
572
581
  if (dimensions) {
573
- result.dimensions = dimensions;
582
+ result.dimensions = dimensions.map((dim)=>({
583
+ location: 'dimension',
584
+ ...dim
585
+ }));
574
586
  return result;
575
587
  }
576
588
  const top100dataset = dataset.slice(0, 100);
@@ -924,7 +936,7 @@
924
936
  const measures = findAllMeasures(vseed.measures);
925
937
  if (!dataset) throw new Error('dataset is required');
926
938
  if (0 === dataset.length) return result;
927
- if (measures) {
939
+ if (vseed.measures) {
928
940
  result.measures = findAllMeasures(measures);
929
941
  return result;
930
942
  }
@@ -1222,6 +1234,15 @@
1222
1234
  locale: locale || 'zh-CN'
1223
1235
  };
1224
1236
  };
1237
+ const measureDepth = (measures = [])=>{
1238
+ if (!measures) return 0;
1239
+ let depth = 1;
1240
+ preorderTraverse(measures, (node)=>{
1241
+ if ('children' in node) depth = Math.max(depth, 1 + measureDepth(node.children));
1242
+ return false;
1243
+ });
1244
+ return depth;
1245
+ };
1225
1246
  const isTable = (vseed)=>'table' === vseed.chartType;
1226
1247
  const isPivotTable = (vseed)=>'pivotTable' === vseed.chartType;
1227
1248
  const isVTable = (vseed)=>[
@@ -1231,9 +1252,18 @@
1231
1252
  const isVChart = (vseed)=>!isVTable(vseed);
1232
1253
  const isPivotChart = (vseed)=>{
1233
1254
  if (isVTable(vseed)) return false;
1255
+ if ('dualAxis' === vseed.chartType) {
1256
+ if (vseed.measures) {
1257
+ const depth = measureDepth(vseed.measures);
1258
+ if (3 === depth) return true;
1259
+ return false;
1260
+ }
1261
+ if (vseed.dualMeasures && vseed.dualMeasures.length > 1) return true;
1262
+ return false;
1263
+ }
1234
1264
  const { measures = [], dimensions = [] } = vseed;
1235
1265
  const hasRowOrColumnDimension = dimensions && dimensions.some((dimension)=>'rowDimension' === dimension.location || 'columnDimension' === dimension.location);
1236
- const hasMeasureGroup = measures && measures.find((measure)=>measure && measure.children);
1266
+ const hasMeasureGroup = measures && measures.some((measure)=>measure && measure.children);
1237
1267
  return hasRowOrColumnDimension || hasMeasureGroup;
1238
1268
  };
1239
1269
  const autoMeasures_autoMeasures = (advancedVSeed, context)=>{
@@ -1317,7 +1347,10 @@
1317
1347
  if (!dataset) throw new Error('dataset is required');
1318
1348
  if (0 === dataset.length) return result;
1319
1349
  if (dimensions) {
1320
- result.dimensions = dimensions;
1350
+ result.dimensions = dimensions.map((dim)=>({
1351
+ location: 'dimension',
1352
+ ...dim
1353
+ }));
1321
1354
  return result;
1322
1355
  }
1323
1356
  const top100dataset = dataset.slice(0, 100);
@@ -1343,8 +1376,10 @@
1343
1376
  return execPipeline(pipeline, context, advancedVSeed);
1344
1377
  };
1345
1378
  const FoldMeasureName = '__MeaName__';
1346
- const FoldMeasureValue = '__MeaValue__';
1347
1379
  const FoldMeasureId = '__MeaId__';
1380
+ const FoldMeasureValue = '__MeaValue__';
1381
+ const FoldPrimaryMeasureValue = '__MeaPrimaryValue__';
1382
+ const FoldSecondaryMeasureValue = '__MeaSecondaryValue__';
1348
1383
  const UnfoldDimensionGroup = '__DimGroup__';
1349
1384
  const UnfoldDimensionGroupId = '__DimGroupID__';
1350
1385
  const Separator = '-';
@@ -1545,6 +1580,7 @@
1545
1580
  datasetReshapeInfo: [
1546
1581
  {
1547
1582
  id: '2D1M',
1583
+ index: 0,
1548
1584
  foldInfo,
1549
1585
  unfoldInfo
1550
1586
  }
@@ -1569,7 +1605,7 @@
1569
1605
  const commonDimensions = dimensions.filter((dim)=>'dimension' === dim.location);
1570
1606
  const newDatasets = [];
1571
1607
  const datasetReshapeInfo = [];
1572
- measureGroups.forEach((measureGroup)=>{
1608
+ measureGroups.forEach((measureGroup, index)=>{
1573
1609
  const measures = measureGroup.children;
1574
1610
  if (!measures) return;
1575
1611
  const groupId = measureGroup.id;
@@ -1581,6 +1617,7 @@
1581
1617
  });
1582
1618
  const reshapeInfo = {
1583
1619
  id: groupId,
1620
+ index,
1584
1621
  foldInfo,
1585
1622
  unfoldInfo
1586
1623
  };
@@ -1879,11 +1916,13 @@
1879
1916
  const { unfoldInfo } = datasetReshapeInfo[0];
1880
1917
  const baseConfig = advancedVSeed.config[chartType];
1881
1918
  if (!baseConfig || !baseConfig.color) return result;
1919
+ const colorItems = unfoldInfo.colorItems;
1920
+ const colorIdMap = unfoldInfo.colorIdMap;
1882
1921
  const { color } = baseConfig;
1883
1922
  const { colorScheme, colorMapping } = color;
1884
1923
  const mappingList = [];
1885
1924
  if (colorMapping) Object.entries(colorMapping).sort((a, b)=>a[0].split(Separator).length - b[0].split(Separator).length).forEach(([key, value])=>{
1886
- const idMap = Object.entries(unfoldInfo.colorIdMap).filter(([_, v])=>v.includes(key));
1925
+ const idMap = Object.entries(colorIdMap).filter(([_, v])=>v.includes(key));
1887
1926
  for (const [colorId] of idMap)mappingList.push([
1888
1927
  colorId,
1889
1928
  value
@@ -1891,7 +1930,7 @@
1891
1930
  });
1892
1931
  result.color = {
1893
1932
  type: 'ordinal',
1894
- domain: unfoldInfo.colorItems,
1933
+ domain: colorItems,
1895
1934
  range: colorScheme,
1896
1935
  specified: Object.fromEntries(mappingList)
1897
1936
  };
@@ -3629,6 +3668,7 @@
3629
3668
  datasetReshapeInfo: [
3630
3669
  {
3631
3670
  id: '2D1M',
3671
+ index: 0,
3632
3672
  foldInfo,
3633
3673
  unfoldInfo
3634
3674
  }
@@ -3653,7 +3693,7 @@
3653
3693
  const commonDimensions = dimensions.filter((dim)=>'dimension' === dim.location);
3654
3694
  const newDatasets = [];
3655
3695
  const datasetReshapeInfo = [];
3656
- measureGroups.forEach((measureGroup)=>{
3696
+ measureGroups.forEach((measureGroup, index)=>{
3657
3697
  const measures = measureGroup.children;
3658
3698
  if (!measures) return;
3659
3699
  const groupId = measureGroup.id;
@@ -3665,6 +3705,7 @@
3665
3705
  });
3666
3706
  const reshapeInfo = {
3667
3707
  id: groupId,
3708
+ index,
3668
3709
  foldInfo,
3669
3710
  unfoldInfo
3670
3711
  };
@@ -5071,6 +5112,7 @@
5071
5112
  datasetReshapeInfo: [
5072
5113
  {
5073
5114
  id: '1D2M',
5115
+ index: 0,
5074
5116
  foldInfo,
5075
5117
  unfoldInfo
5076
5118
  }
@@ -5092,7 +5134,7 @@
5092
5134
  });
5093
5135
  const newDatasets = [];
5094
5136
  const datasetReshapeInfo = [];
5095
- measureGroups.forEach((measureGroup)=>{
5137
+ measureGroups.forEach((measureGroup, index)=>{
5096
5138
  const measures = measureGroup.children;
5097
5139
  if (!measures) return;
5098
5140
  const commonDimensions = dimensions.filter((dim)=>'dimension' === dim.location);
@@ -5105,6 +5147,7 @@
5105
5147
  });
5106
5148
  const reshapeInfo = {
5107
5149
  id: groupId,
5150
+ index,
5108
5151
  foldInfo,
5109
5152
  unfoldInfo
5110
5153
  };
@@ -5117,7 +5160,7 @@
5117
5160
  datasetReshapeInfo: datasetReshapeInfo
5118
5161
  };
5119
5162
  };
5120
- const encodingXYY = (advancedVSeed)=>{
5163
+ const encodingAreaRange = (advancedVSeed)=>{
5121
5164
  const result = {
5122
5165
  ...advancedVSeed
5123
5166
  };
@@ -5194,7 +5237,7 @@
5194
5237
  ], [
5195
5238
  pivotReshapeTo1D
5196
5239
  ]),
5197
- encodingXYY,
5240
+ encodingAreaRange,
5198
5241
  sortXBandAxis,
5199
5242
  areaConfig,
5200
5243
  theme_theme,
@@ -5516,6 +5559,7 @@
5516
5559
  datasetReshapeInfo: [
5517
5560
  {
5518
5561
  id: '1D2M',
5562
+ index: 0,
5519
5563
  foldInfo,
5520
5564
  unfoldInfo
5521
5565
  }
@@ -5537,7 +5581,7 @@
5537
5581
  });
5538
5582
  const newDatasets = [];
5539
5583
  const datasetReshapeInfo = [];
5540
- measureGroups.forEach((measureGroup)=>{
5584
+ measureGroups.forEach((measureGroup, index)=>{
5541
5585
  const measures = measureGroup.children;
5542
5586
  if (!measures) return;
5543
5587
  const commonDimensions = dimensions.filter((dim)=>'dimension' === dim.location);
@@ -5550,6 +5594,7 @@
5550
5594
  });
5551
5595
  const reshapeInfo = {
5552
5596
  id: groupId,
5597
+ index,
5553
5598
  foldInfo,
5554
5599
  unfoldInfo
5555
5600
  };
@@ -5591,128 +5636,1129 @@
5591
5636
  group,
5592
5637
  color
5593
5638
  }
5594
- ];
5595
- }, []);
5596
- return {
5597
- ...result,
5598
- encoding
5599
- };
5600
- };
5601
- const scatterAdvancedPipeline = [
5602
- initAdvancedVSeed_initAdvancedVSeed,
5603
- autoMeasures_autoMeasures,
5604
- autoDimensions_autoDimensions,
5605
- pivotAdapter([
5606
- reshapeTo1D2M
5607
- ], [
5608
- pivotReshapeTo1D2M
5609
- ]),
5610
- encodingYY,
5611
- scatterConfig,
5612
- theme_theme,
5613
- markStyle_markStyle,
5614
- annotation_annotation
5615
- ];
5616
- const initScatter = (spec, context)=>{
5617
- const result = {
5618
- ...spec
5619
- };
5620
- const { advancedVSeed } = context;
5621
- const { encoding } = advancedVSeed;
5622
- if (!encoding[0].y || !encoding[0].x || !encoding[0].group) return result;
5623
- result.type = 'scatter';
5624
- result.direction = 'vertical';
5625
- result.xField = encoding[0].x[0];
5626
- result.yField = encoding[0].y[0];
5627
- result.seriesField = encoding[0].group[0];
5628
- result.padding = 0;
5629
- result.region = [
5630
- {
5631
- clip: true
5639
+ ];
5640
+ }, []);
5641
+ return {
5642
+ ...result,
5643
+ encoding
5644
+ };
5645
+ };
5646
+ const scatterAdvancedPipeline = [
5647
+ initAdvancedVSeed_initAdvancedVSeed,
5648
+ autoMeasures_autoMeasures,
5649
+ autoDimensions_autoDimensions,
5650
+ pivotAdapter([
5651
+ reshapeTo1D2M
5652
+ ], [
5653
+ pivotReshapeTo1D2M
5654
+ ]),
5655
+ encodingYY,
5656
+ scatterConfig,
5657
+ theme_theme,
5658
+ markStyle_markStyle,
5659
+ annotation_annotation
5660
+ ];
5661
+ const initScatter = (spec, context)=>{
5662
+ const result = {
5663
+ ...spec
5664
+ };
5665
+ const { advancedVSeed } = context;
5666
+ const { encoding } = advancedVSeed;
5667
+ if (!encoding[0].y || !encoding[0].x || !encoding[0].group) return result;
5668
+ result.type = 'scatter';
5669
+ result.direction = 'vertical';
5670
+ result.xField = encoding[0].x[0];
5671
+ result.yField = encoding[0].y[0];
5672
+ result.seriesField = encoding[0].group[0];
5673
+ result.padding = 0;
5674
+ result.region = [
5675
+ {
5676
+ clip: true
5677
+ }
5678
+ ];
5679
+ result.animation = true;
5680
+ return result;
5681
+ };
5682
+ const horizontalCrosshairLine = (spec, context)=>{
5683
+ const result = {
5684
+ ...spec
5685
+ };
5686
+ const { advancedVSeed, vseed } = context;
5687
+ const { chartType } = vseed;
5688
+ const config = advancedVSeed.config?.[chartType]?.crosshairLine;
5689
+ if (!config) return result;
5690
+ if (!result.crosshair) result.crosshair = {};
5691
+ const { visible = true, lineColor, labelColor, labelVisible, labelBackgroundColor } = config;
5692
+ const crosshair = result.crosshair;
5693
+ crosshair.yField = {
5694
+ visible,
5695
+ line: {
5696
+ type: 'line',
5697
+ style: {
5698
+ lineWidth: 1,
5699
+ opacity: 1,
5700
+ stroke: lineColor,
5701
+ lineDash: [
5702
+ 4,
5703
+ 2
5704
+ ]
5705
+ }
5706
+ },
5707
+ label: {
5708
+ visible: labelVisible,
5709
+ labelBackground: {
5710
+ visible: labelVisible,
5711
+ style: {
5712
+ fill: labelBackgroundColor
5713
+ }
5714
+ },
5715
+ style: {
5716
+ fill: labelColor
5717
+ }
5718
+ }
5719
+ };
5720
+ return result;
5721
+ };
5722
+ const scatter = [
5723
+ initScatter,
5724
+ color_color,
5725
+ background_backgroundColor,
5726
+ datasetXY,
5727
+ progressive,
5728
+ xLinear,
5729
+ yLinear,
5730
+ label_label,
5731
+ tooltip_tooltip,
5732
+ verticalCrosshairLine,
5733
+ horizontalCrosshairLine,
5734
+ discreteLegend,
5735
+ pointStyle_pointStyle,
5736
+ pointStateHover,
5737
+ annotationPoint_annotationPoint,
5738
+ annotationVerticalLine_annotationVerticalLine,
5739
+ annotationHorizontalLine_annotationHorizontalLine,
5740
+ annotationArea_annotationArea
5741
+ ];
5742
+ const pivotScatter = [
5743
+ initPivot,
5744
+ pivotGridStyle,
5745
+ pivotIndicators_pivotIndicatorsAsRow,
5746
+ datasetPivot,
5747
+ pivotIndicators_pivotIndicators([
5748
+ initScatter,
5749
+ color_color,
5750
+ background_backgroundColor,
5751
+ datasetXY,
5752
+ progressive,
5753
+ xLinear,
5754
+ yLinear,
5755
+ label_label,
5756
+ tooltip_tooltip,
5757
+ verticalCrosshairLine,
5758
+ horizontalCrosshairLine,
5759
+ pointStyle_pointStyle,
5760
+ pointStateHover,
5761
+ annotationPoint_annotationPoint,
5762
+ annotationVerticalLine_annotationVerticalLine,
5763
+ annotationHorizontalLine_annotationHorizontalLine,
5764
+ annotationArea_annotationArea
5765
+ ]),
5766
+ pivotRowDimensions,
5767
+ pivotColumnDimensions,
5768
+ pivotDiscreteLegend
5769
+ ];
5770
+ const scatterSpecPipeline = [
5771
+ pivotAdapter_pivotAdapter(scatter, pivotScatter)
5772
+ ];
5773
+ const registerScatter = ()=>{
5774
+ Builder._advancedPipelineMap.scatter = scatterAdvancedPipeline;
5775
+ Builder._specPipelineMap.scatter = scatterSpecPipeline;
5776
+ };
5777
+ const reshapeTo2D2M = (advancedVSeed, context)=>{
5778
+ const result = {
5779
+ ...advancedVSeed
5780
+ };
5781
+ const { vseed } = context;
5782
+ const { dataset } = vseed;
5783
+ const { dimensions, measures } = advancedVSeed;
5784
+ if (!measures || !dimensions || !dataset) return result;
5785
+ if (0 === measures.length) throw new Error('measures can not be empty');
5786
+ if (measures.length > 2) throw new Error('measures can not be more than 2');
5787
+ const commonDimensions = dimensions.filter((dim)=>'dimension' === dim.location);
5788
+ const datasets = [];
5789
+ const foldInfoList = [];
5790
+ const unfoldInfoList = [];
5791
+ const primaryMeasures = measures[0];
5792
+ const secondaryMeasures = measures[1] || [];
5793
+ if (primaryMeasures && primaryMeasures.children) {
5794
+ const { dataset: newDatasets, foldInfo, unfoldInfo } = dataReshapeFor2D1M(dataset, commonDimensions, primaryMeasures.children, {
5795
+ foldMeasureValue: FoldPrimaryMeasureValue
5796
+ });
5797
+ datasets.push(newDatasets);
5798
+ foldInfoList.push(foldInfo);
5799
+ unfoldInfoList.push(unfoldInfo);
5800
+ }
5801
+ if (secondaryMeasures && secondaryMeasures.children) {
5802
+ const { dataset: newDatasets, foldInfo, unfoldInfo } = dataReshapeFor2D1M(dataset, commonDimensions, secondaryMeasures.children, {
5803
+ foldMeasureValue: FoldSecondaryMeasureValue
5804
+ });
5805
+ datasets.push(newDatasets);
5806
+ foldInfoList.push(foldInfo);
5807
+ unfoldInfoList.push(unfoldInfo);
5808
+ }
5809
+ const unfoldInfo = {
5810
+ groupName: unfoldInfoList[0].groupName,
5811
+ groupId: unfoldInfoList[0].groupId,
5812
+ colorItems: unfoldInfoList.flatMap((d)=>d.colorItems),
5813
+ colorIdMap: unfoldInfoList.reduce((prev, cur)=>({
5814
+ ...prev,
5815
+ ...cur.colorIdMap
5816
+ }), {})
5817
+ };
5818
+ return {
5819
+ ...result,
5820
+ dataset: datasets,
5821
+ datasetReshapeInfo: [
5822
+ {
5823
+ id: '2D2M',
5824
+ index: 0,
5825
+ foldInfo: foldInfoList[0],
5826
+ foldInfoList: foldInfoList,
5827
+ unfoldInfo: unfoldInfo
5828
+ }
5829
+ ]
5830
+ };
5831
+ };
5832
+ const pivotReshapeTo2D2M = (advancedVSeed, context)=>{
5833
+ const result = {
5834
+ ...advancedVSeed
5835
+ };
5836
+ const { vseed } = context;
5837
+ const { dataset } = vseed;
5838
+ const { dimensions, measures } = advancedVSeed;
5839
+ if (!measures || !dimensions || !dataset) return result;
5840
+ const commonDimensions = dimensions.filter((dim)=>'dimension' === dim.location);
5841
+ const datasetList = [];
5842
+ const datasetReshapeInfo = [];
5843
+ measures.forEach((measureGroup, index)=>{
5844
+ const measures = measureGroup.children || [];
5845
+ if (0 === measures.length) throw new Error('measures can not be empty');
5846
+ if (measures.length > 2) throw new Error('measures can not be more than 2');
5847
+ const datasets = [];
5848
+ const foldInfoList = [];
5849
+ const unfoldInfoList = [];
5850
+ const primaryMeasures = measures[0];
5851
+ const secondaryMeasures = measures[1] || measures[0];
5852
+ if (primaryMeasures && primaryMeasures.children) {
5853
+ const { dataset: newDatasets, foldInfo, unfoldInfo } = dataReshapeFor2D1M(dataset, commonDimensions, primaryMeasures.children, {
5854
+ foldMeasureValue: `${FoldPrimaryMeasureValue}${index}`
5855
+ });
5856
+ datasets.push(newDatasets);
5857
+ foldInfoList.push(foldInfo);
5858
+ unfoldInfoList.push(unfoldInfo);
5859
+ }
5860
+ if (secondaryMeasures && secondaryMeasures.children) {
5861
+ const { dataset: newDatasets, foldInfo, unfoldInfo } = dataReshapeFor2D1M(dataset, commonDimensions, secondaryMeasures.children, {
5862
+ foldMeasureValue: `${FoldSecondaryMeasureValue}${index}`
5863
+ });
5864
+ datasets.push(newDatasets);
5865
+ foldInfoList.push(foldInfo);
5866
+ unfoldInfoList.push(unfoldInfo);
5867
+ }
5868
+ datasetList.push(datasets.flat(2));
5869
+ const unfoldInfo = {
5870
+ groupName: unfoldInfoList[0].groupName,
5871
+ groupId: unfoldInfoList[0].groupId,
5872
+ colorItems: unfoldInfoList.flatMap((d)=>d.colorItems),
5873
+ colorIdMap: unfoldInfoList.reduce((prev, cur)=>({
5874
+ ...prev,
5875
+ ...cur.colorIdMap
5876
+ }), {})
5877
+ };
5878
+ const reshapeInfo = {
5879
+ id: `2D2M-${index}`,
5880
+ index,
5881
+ foldInfo: foldInfoList[0],
5882
+ unfoldInfo: unfoldInfo,
5883
+ foldInfoList: foldInfoList
5884
+ };
5885
+ datasetReshapeInfo.push(reshapeInfo);
5886
+ });
5887
+ return {
5888
+ ...result,
5889
+ dataset: datasetList,
5890
+ datasetReshapeInfo
5891
+ };
5892
+ };
5893
+ const encodingXYY = (advancedVSeed)=>{
5894
+ const result = {
5895
+ ...advancedVSeed
5896
+ };
5897
+ const { datasetReshapeInfo, dimensions } = advancedVSeed;
5898
+ if (!datasetReshapeInfo || !dimensions) return result;
5899
+ const xDimension = dimensions.find((item)=>'rowDimension' !== item.location && 'columnDimension' !== item.location) || dimensions[0];
5900
+ const isZeroDimension = 0 === dimensions.length;
5901
+ const encoding = datasetReshapeInfo.reduce((prev, cur)=>{
5902
+ const { foldInfoList, unfoldInfo } = cur;
5903
+ const x = [
5904
+ isZeroDimension ? foldInfoList[0].measureName : xDimension?.id
5905
+ ];
5906
+ const y = foldInfoList.map((d)=>d.measureValue);
5907
+ const group = [
5908
+ unfoldInfo.groupId
5909
+ ];
5910
+ const color = [
5911
+ foldInfoList[0].measureName
5912
+ ];
5913
+ return [
5914
+ ...prev,
5915
+ {
5916
+ x,
5917
+ y,
5918
+ group,
5919
+ color
5920
+ }
5921
+ ];
5922
+ }, []);
5923
+ return {
5924
+ ...result,
5925
+ encoding
5926
+ };
5927
+ };
5928
+ const dualAxisConfig = (advancedVSeed, context)=>{
5929
+ const { vseed } = context;
5930
+ const { chartType } = vseed;
5931
+ const result = {
5932
+ ...advancedVSeed
5933
+ };
5934
+ const config = chunk_2T7K3PFL_i(vseed, [
5935
+ 'backgroundColor',
5936
+ 'color',
5937
+ 'label',
5938
+ 'legend',
5939
+ 'tooltip',
5940
+ 'dualChartType',
5941
+ 'primaryYAxis',
5942
+ 'secondaryYAxis',
5943
+ 'crosshairLine'
5944
+ ]);
5945
+ result.config = {
5946
+ ...result.config || {},
5947
+ [chartType]: {
5948
+ ...config
5949
+ }
5950
+ };
5951
+ return result;
5952
+ };
5953
+ const autoDualMeasures = (advancedVSeed, context)=>{
5954
+ const result = {
5955
+ ...advancedVSeed
5956
+ };
5957
+ const { vseed } = context;
5958
+ const { dataset, dualMeasures, measures } = vseed;
5959
+ if (!dataset) throw new Error('dataset is required');
5960
+ if (0 === dataset.length) return result;
5961
+ if (dualMeasures) {
5962
+ result.measures = dualMeasuresToMeasureTree(dualMeasures);
5963
+ return result;
5964
+ }
5965
+ if (measures && measureDepth(measures) > 1) {
5966
+ result.measures = measures;
5967
+ return result;
5968
+ }
5969
+ const top100dataset = dataset.slice(0, 100);
5970
+ const sample = top100dataset.reduce((prev, cur)=>({
5971
+ ...prev,
5972
+ ...cur
5973
+ }), {});
5974
+ const newMeasures = measures || Object.keys(sample).filter((key)=>top100dataset.some((item)=>'number' == typeof item[key]) && ![
5975
+ '',
5976
+ null,
5977
+ void 0
5978
+ ].includes(key)).map((measure)=>({
5979
+ id: measure,
5980
+ alias: measure
5981
+ }));
5982
+ if (0 === newMeasures.length) result.measures = [];
5983
+ else if (1 === newMeasures.length) result.measures = [
5984
+ {
5985
+ id: 'primary',
5986
+ alias: 'primary',
5987
+ children: newMeasures
5988
+ }
5989
+ ];
5990
+ else if (newMeasures.length > 1) result.measures = [
5991
+ {
5992
+ id: 'primary',
5993
+ alias: 'primary',
5994
+ children: newMeasures.slice(0, 1)
5995
+ },
5996
+ {
5997
+ id: 'secondary',
5998
+ alias: 'secondary',
5999
+ children: newMeasures.slice(1)
6000
+ }
6001
+ ];
6002
+ return result;
6003
+ };
6004
+ const dualMeasuresToMeasureTree = (dualMeasures)=>{
6005
+ const measureTree = dualMeasures.map((item, index)=>{
6006
+ const { primaryMeasures, secondaryMeasures, primaryAlias, secondaryAlias } = item;
6007
+ const groupChildren = [];
6008
+ if (primaryMeasures) {
6009
+ const arrPrimaryMeasures = Array.isArray(primaryMeasures) ? primaryMeasures : [
6010
+ primaryMeasures
6011
+ ];
6012
+ groupChildren.push({
6013
+ id: `${index}-primary`,
6014
+ alias: primaryAlias || arrPrimaryMeasures.map((item)=>item.alias || item.id).toString(),
6015
+ children: arrPrimaryMeasures
6016
+ });
6017
+ }
6018
+ if (secondaryMeasures) {
6019
+ const arrSecondaryMeasures = Array.isArray(secondaryMeasures) ? secondaryMeasures : [
6020
+ secondaryMeasures
6021
+ ];
6022
+ groupChildren.push({
6023
+ id: `${index}-secondary`,
6024
+ alias: secondaryAlias || arrSecondaryMeasures.map((item)=>item.alias || item.id).toString(),
6025
+ children: arrSecondaryMeasures
6026
+ });
6027
+ }
6028
+ const id = [
6029
+ primaryAlias,
6030
+ secondaryAlias,
6031
+ index
6032
+ ].filter((d)=>!chunk_JK3VNB42_n(d)).join('-');
6033
+ return {
6034
+ id,
6035
+ alias: id,
6036
+ children: groupChildren
6037
+ };
6038
+ });
6039
+ if (1 === dualMeasures.length) return measureTree[0].children || [];
6040
+ return measureTree;
6041
+ };
6042
+ const dualAxisAdvancedPipeline = [
6043
+ initAdvancedVSeed_initAdvancedVSeed,
6044
+ autoDualMeasures,
6045
+ autoDimensions_autoDimensions,
6046
+ pivotAdapter([
6047
+ reshapeTo2D2M
6048
+ ], [
6049
+ pivotReshapeTo2D2M
6050
+ ]),
6051
+ encodingXYY,
6052
+ sortXBandAxis,
6053
+ sort_sortLegend,
6054
+ dualAxisConfig,
6055
+ theme_theme,
6056
+ markStyle_markStyle,
6057
+ annotation_annotation
6058
+ ];
6059
+ const initDualAxisPrimary = (spec, context)=>{
6060
+ const result = {
6061
+ ...spec
6062
+ };
6063
+ const { advancedVSeed } = context;
6064
+ const { encoding, datasetReshapeInfo } = advancedVSeed;
6065
+ if (!encoding[0].y || !encoding[0].x || !encoding[0].group) return result;
6066
+ result.id = `${datasetReshapeInfo[0].id}-primary-series`;
6067
+ result.type = 'bar';
6068
+ result.direction = 'vertical';
6069
+ result.xField = encoding[0].x[0];
6070
+ result.yField = encoding[0].y[0];
6071
+ result.seriesField = encoding[0].group[0];
6072
+ result.animation = true;
6073
+ return result;
6074
+ };
6075
+ const initDualAxisSecondary = (spec, context)=>{
6076
+ const result = {
6077
+ ...spec
6078
+ };
6079
+ const { advancedVSeed } = context;
6080
+ const { encoding, datasetReshapeInfo } = advancedVSeed;
6081
+ if (!encoding[0].y || !encoding[0].x || !encoding[0].group) return result;
6082
+ result.id = `${datasetReshapeInfo[0].id}-secondary-series`;
6083
+ result.type = 'line';
6084
+ result.direction = 'vertical';
6085
+ result.xField = encoding[0].x[0];
6086
+ result.yField = encoding[0].y[1];
6087
+ result.seriesField = encoding[0].group[0];
6088
+ result.animation = true;
6089
+ return result;
6090
+ };
6091
+ const dualChartTypePrimary = (spec, context)=>{
6092
+ const result = {
6093
+ ...spec
6094
+ };
6095
+ const { advancedVSeed, vseed } = context;
6096
+ const { chartType } = vseed;
6097
+ const { datasetReshapeInfo } = advancedVSeed;
6098
+ const index = datasetReshapeInfo[0].index;
6099
+ const config = advancedVSeed.config?.[chartType]?.dualChartType || {
6100
+ primary: 'column',
6101
+ secondary: 'line'
6102
+ };
6103
+ const primary = Array.isArray(config) ? config[index].primary || config[0].primary : config.primary;
6104
+ switch(primary){
6105
+ case 'line':
6106
+ result.type = 'line';
6107
+ break;
6108
+ case 'column':
6109
+ result.type = 'bar';
6110
+ break;
6111
+ case 'columnParallel':
6112
+ {
6113
+ const columnSpec = result;
6114
+ if (Array.isArray(columnSpec.xField)) columnSpec.xField.push(datasetReshapeInfo[0].unfoldInfo.groupId);
6115
+ else if (columnSpec.xField) columnSpec.xField = [
6116
+ columnSpec.xField,
6117
+ datasetReshapeInfo[0].unfoldInfo.groupId
6118
+ ];
6119
+ columnSpec.type = 'bar';
6120
+ break;
6121
+ }
6122
+ case 'columnPercent':
6123
+ result.type = 'bar';
6124
+ result.percent = true;
6125
+ break;
6126
+ case 'area':
6127
+ result.type = 'area';
6128
+ break;
6129
+ case 'areaPercent':
6130
+ result.type = 'area';
6131
+ result.percent = true;
6132
+ break;
6133
+ case 'scatter':
6134
+ result.type = 'scatter';
6135
+ break;
6136
+ default:
6137
+ result.type = primary;
6138
+ }
6139
+ return result;
6140
+ };
6141
+ const dualChartTypeSecondary = (spec, context)=>{
6142
+ const result = {
6143
+ ...spec
6144
+ };
6145
+ const { advancedVSeed, vseed } = context;
6146
+ const { chartType } = vseed;
6147
+ const { datasetReshapeInfo } = advancedVSeed;
6148
+ const config = advancedVSeed.config?.[chartType]?.dualChartType || {
6149
+ primary: 'column',
6150
+ secondary: 'line'
6151
+ };
6152
+ const index = datasetReshapeInfo[0].index;
6153
+ const secondary = Array.isArray(config) ? config[index].secondary || config[0].secondary : config.secondary;
6154
+ switch(secondary){
6155
+ case 'line':
6156
+ result.type = 'line';
6157
+ break;
6158
+ case 'column':
6159
+ result.type = 'bar';
6160
+ break;
6161
+ case 'columnParallel':
6162
+ {
6163
+ const columnSpec = result;
6164
+ if (Array.isArray(columnSpec.xField)) columnSpec.xField.push(datasetReshapeInfo[0].unfoldInfo.groupId);
6165
+ else if (columnSpec.xField) columnSpec.xField = [
6166
+ columnSpec.xField,
6167
+ datasetReshapeInfo[0].unfoldInfo.groupId
6168
+ ];
6169
+ columnSpec.type = 'bar';
6170
+ break;
6171
+ }
6172
+ case 'columnPercent':
6173
+ result.type = 'bar';
6174
+ result.percent = true;
6175
+ break;
6176
+ case 'area':
6177
+ result.type = 'area';
6178
+ break;
6179
+ case 'areaPercent':
6180
+ result.type = 'area';
6181
+ result.percent = true;
6182
+ break;
6183
+ case 'scatter':
6184
+ result.type = 'scatter';
6185
+ break;
6186
+ default:
6187
+ result.type = secondary;
6188
+ }
6189
+ return result;
6190
+ };
6191
+ const datasetPrimary = (spec, context)=>{
6192
+ const { advancedVSeed, vseed } = context;
6193
+ const { encoding, analysis, datasetReshapeInfo } = advancedVSeed;
6194
+ const { orderMapping = {} } = analysis ?? {};
6195
+ const x = encoding[0]?.x?.[0];
6196
+ const group = encoding[0]?.group?.[0];
6197
+ const id = datasetReshapeInfo[0].id;
6198
+ const fields = {};
6199
+ if (x) {
6200
+ const order = orderMapping[x];
6201
+ if (order) fields[x] = {
6202
+ sortIndex: 0,
6203
+ domain: order,
6204
+ lockStatisticsByDomain: true
6205
+ };
6206
+ else fields[x] = {
6207
+ sortIndex: 0
6208
+ };
6209
+ }
6210
+ if (group) {
6211
+ const order = orderMapping[group];
6212
+ if (order) fields[group] = {
6213
+ sortIndex: 0,
6214
+ domain: order,
6215
+ lockStatisticsByDomain: true
6216
+ };
6217
+ else fields[group] = {
6218
+ sortIndex: 0
6219
+ };
6220
+ }
6221
+ return {
6222
+ ...spec,
6223
+ data: {
6224
+ id: `${id}-primary-dataset`,
6225
+ values: isPivotChart(vseed) ? void 0 : advancedVSeed.dataset[0],
6226
+ fields: fields
6227
+ }
6228
+ };
6229
+ };
6230
+ const datasetSecondary = (spec, context)=>{
6231
+ const { advancedVSeed, vseed } = context;
6232
+ const { encoding, analysis, datasetReshapeInfo } = advancedVSeed;
6233
+ const { orderMapping = {} } = analysis ?? {};
6234
+ const x = encoding[0]?.x?.[0];
6235
+ const group = encoding[0]?.group?.[0];
6236
+ const id = datasetReshapeInfo[0].id;
6237
+ const fields = {};
6238
+ if (x) {
6239
+ const order = orderMapping[x];
6240
+ if (order) fields[x] = {
6241
+ sortIndex: 0,
6242
+ domain: order,
6243
+ lockStatisticsByDomain: true
6244
+ };
6245
+ else fields[x] = {
6246
+ sortIndex: 0
6247
+ };
6248
+ }
6249
+ if (group) {
6250
+ const order = orderMapping[group];
6251
+ if (order) fields[group] = {
6252
+ sortIndex: 0,
6253
+ domain: order,
6254
+ lockStatisticsByDomain: true
6255
+ };
6256
+ else fields[group] = {
6257
+ sortIndex: 0
6258
+ };
6259
+ }
6260
+ return {
6261
+ ...spec,
6262
+ data: {
6263
+ id: `${id}-secondary-dataset`,
6264
+ values: isPivotChart(vseed) ? void 0 : advancedVSeed.dataset[1],
6265
+ fields: fields
6266
+ }
6267
+ };
6268
+ };
6269
+ const labelPrimary = (spec, context)=>{
6270
+ const result = {
6271
+ ...spec
6272
+ };
6273
+ const { advancedVSeed } = context;
6274
+ const { measures, datasetReshapeInfo, locale } = advancedVSeed;
6275
+ const { chartType } = advancedVSeed;
6276
+ const baseConfig = advancedVSeed.config[chartType];
6277
+ if (!baseConfig || !baseConfig.label) return result;
6278
+ const foldInfoList = datasetReshapeInfo[0].foldInfoList;
6279
+ const { measureId, measureValue } = foldInfoList[0];
6280
+ const { label } = baseConfig;
6281
+ const { enable } = label;
6282
+ result.label = {
6283
+ visible: enable,
6284
+ formatMethod: (value, datum)=>{
6285
+ const result = [];
6286
+ const formatValue = (value)=>{
6287
+ const id = datum[measureId];
6288
+ const measure = findMeasureById(measures, id);
6289
+ if (!measure) return value;
6290
+ const { format = {}, autoFormat = true } = measure;
6291
+ if (!chunk_VCYTMP4D_n(format)) {
6292
+ const formatter = createFormatter(format);
6293
+ return formatter(value);
6294
+ }
6295
+ if (autoFormat) return autoFormatter(value, locale);
6296
+ return String(value);
6297
+ };
6298
+ result.push(formatValue(datum[measureValue]));
6299
+ return result.join(' ');
6300
+ }
6301
+ };
6302
+ return result;
6303
+ };
6304
+ const labelSecondary = (spec, context)=>{
6305
+ const result = {
6306
+ ...spec
6307
+ };
6308
+ const { advancedVSeed } = context;
6309
+ const { measures, datasetReshapeInfo, locale } = advancedVSeed;
6310
+ const { chartType } = advancedVSeed;
6311
+ const baseConfig = advancedVSeed.config[chartType];
6312
+ if (!baseConfig || !baseConfig.label) return result;
6313
+ if (chunk_JK3VNB42_n(datasetReshapeInfo[0].foldInfoList?.[1])) return result;
6314
+ const foldInfoList = datasetReshapeInfo[0].foldInfoList;
6315
+ const { measureId, measureValue } = foldInfoList[1];
6316
+ const { label } = baseConfig;
6317
+ const { enable } = label;
6318
+ result.label = {
6319
+ visible: enable,
6320
+ formatMethod: (value, datum)=>{
6321
+ const result = [];
6322
+ const formatValue = (value)=>{
6323
+ const id = datum[measureId];
6324
+ const measure = findMeasureById(measures, id);
6325
+ if (!measure) return value;
6326
+ const { format = {}, autoFormat = true } = measure;
6327
+ if (!chunk_VCYTMP4D_n(format)) {
6328
+ const formatter = createFormatter(format);
6329
+ return formatter(value);
6330
+ }
6331
+ if (autoFormat) return autoFormatter(value, locale);
6332
+ return String(value);
6333
+ };
6334
+ result.push(formatValue(datum[measureValue]));
6335
+ return result.join(' ');
6336
+ }
6337
+ };
6338
+ return result;
6339
+ };
6340
+ const tooltipPrimary = (spec, context)=>{
6341
+ const result = {
6342
+ ...spec
6343
+ };
6344
+ const { advancedVSeed } = context;
6345
+ const { measures, datasetReshapeInfo, chartType, locale, dimensions } = advancedVSeed;
6346
+ const baseConfig = advancedVSeed.config[chartType];
6347
+ const { tooltip = {
6348
+ enable: true
6349
+ } } = baseConfig;
6350
+ const { enable } = tooltip;
6351
+ const foldInfoList = datasetReshapeInfo[0].foldInfoList;
6352
+ const unfoldInfo = datasetReshapeInfo[0].unfoldInfo;
6353
+ const { measureId, measureValue, measureName } = foldInfoList[0];
6354
+ const { groupName } = unfoldInfo;
6355
+ result.tooltip = {
6356
+ visible: enable,
6357
+ mark: {
6358
+ title: {
6359
+ visible: true
6360
+ },
6361
+ content: [
6362
+ ...dimensions.map((item)=>({
6363
+ visible: true,
6364
+ hasShape: true,
6365
+ shapeType: 'rectRound',
6366
+ key: (datum)=>{
6367
+ if (item.alias || item.id) return item.alias || item.id;
6368
+ return datum && datum[item.id];
6369
+ },
6370
+ value: (datum)=>datum && datum[item.id]
6371
+ })),
6372
+ {
6373
+ visible: true,
6374
+ hasShape: true,
6375
+ key: (datum)=>datum && datum[measureName || groupName] || '',
6376
+ value: (datum)=>{
6377
+ if (!datum) return '';
6378
+ const value = datum[measureValue];
6379
+ const id = datum[measureId];
6380
+ const measure = findMeasureById(measures, id);
6381
+ if (!measure) return String(value);
6382
+ const { format = {}, autoFormat = true } = measure;
6383
+ if (!chunk_VCYTMP4D_n(format)) {
6384
+ const formatter = createFormatter(format);
6385
+ return formatter(value);
6386
+ }
6387
+ if (autoFormat) return autoFormatter(value, locale);
6388
+ return String(value);
6389
+ }
6390
+ }
6391
+ ]
6392
+ },
6393
+ dimension: {
6394
+ content: [
6395
+ {
6396
+ visible: true,
6397
+ key: (datum)=>datum && datum[groupName] || '',
6398
+ value: (datum)=>{
6399
+ if (!datum) return '';
6400
+ const value = datum[measureValue];
6401
+ const id = datum[measureId];
6402
+ const measure = findMeasureById(measures, id);
6403
+ if (!measure) return String(value);
6404
+ const { format = {}, autoFormat = true } = measure;
6405
+ if (!chunk_VCYTMP4D_n(format)) {
6406
+ const formatter = createFormatter(format);
6407
+ return formatter(value);
6408
+ }
6409
+ if (autoFormat) return autoFormatter(value, locale);
6410
+ return String(value);
6411
+ },
6412
+ shapeType: 'rectRound'
6413
+ }
6414
+ ]
6415
+ }
6416
+ };
6417
+ return result;
6418
+ };
6419
+ const tooltipSecondary = (spec, context)=>{
6420
+ const result = {
6421
+ ...spec
6422
+ };
6423
+ const { advancedVSeed } = context;
6424
+ const { measures, datasetReshapeInfo, chartType, locale, dimensions } = advancedVSeed;
6425
+ const baseConfig = advancedVSeed.config[chartType];
6426
+ const { tooltip = {
6427
+ enable: true
6428
+ } } = baseConfig;
6429
+ const { enable } = tooltip;
6430
+ if (chunk_JK3VNB42_n(datasetReshapeInfo[0].foldInfoList?.[1])) return result;
6431
+ const foldInfoList = datasetReshapeInfo[0].foldInfoList;
6432
+ const unfoldInfo = datasetReshapeInfo[0].unfoldInfo;
6433
+ const { measureId, measureValue, measureName } = foldInfoList[1];
6434
+ const { groupName } = unfoldInfo;
6435
+ result.tooltip = {
6436
+ visible: enable,
6437
+ mark: {
6438
+ title: {
6439
+ visible: true
6440
+ },
6441
+ content: [
6442
+ ...dimensions.map((item)=>({
6443
+ visible: true,
6444
+ hasShape: true,
6445
+ shapeType: 'rectRound',
6446
+ key: (datum)=>{
6447
+ if (item.alias || item.id) return item.alias || item.id;
6448
+ return datum && datum[item.id];
6449
+ },
6450
+ value: (datum)=>datum && datum[item.id]
6451
+ })),
6452
+ {
6453
+ visible: true,
6454
+ hasShape: true,
6455
+ key: (datum)=>datum && datum[measureName || groupName] || '',
6456
+ value: (datum)=>{
6457
+ if (!datum) return '';
6458
+ const value = datum[measureValue];
6459
+ const id = datum[measureId];
6460
+ const measure = findMeasureById(measures, id);
6461
+ if (!measure) return String(value);
6462
+ const { format = {}, autoFormat = true } = measure;
6463
+ if (!chunk_VCYTMP4D_n(format)) {
6464
+ const formatter = createFormatter(format);
6465
+ return formatter(value);
6466
+ }
6467
+ if (autoFormat) return autoFormatter(value, locale);
6468
+ return String(value);
6469
+ }
6470
+ }
6471
+ ]
6472
+ },
6473
+ dimension: {
6474
+ content: [
6475
+ {
6476
+ visible: true,
6477
+ key: (datum)=>datum && datum[groupName] || '',
6478
+ value: (datum)=>{
6479
+ if (!datum) return '';
6480
+ const value = datum[measureValue];
6481
+ const id = datum[measureId];
6482
+ const measure = findMeasureById(measures, id);
6483
+ if (!measure) return String(value);
6484
+ const { format = {}, autoFormat = true } = measure;
6485
+ if (!chunk_VCYTMP4D_n(format)) {
6486
+ const formatter = createFormatter(format);
6487
+ return formatter(value);
6488
+ }
6489
+ if (autoFormat) return autoFormatter(value, locale);
6490
+ return String(value);
6491
+ },
6492
+ shapeType: 'rectRound'
6493
+ }
6494
+ ]
6495
+ }
6496
+ };
6497
+ return result;
6498
+ };
6499
+ const yLinearPrimary = (spec, context)=>{
6500
+ const result = {
6501
+ ...spec
6502
+ };
6503
+ const { advancedVSeed, vseed } = context;
6504
+ const { chartType } = vseed;
6505
+ const { locale, datasetReshapeInfo } = advancedVSeed;
6506
+ const config = advancedVSeed.config?.[chartType]?.primaryYAxis;
6507
+ if (datasetReshapeInfo[0].foldInfoList?.[0] && chunk_VCYTMP4D_n(datasetReshapeInfo[0].foldInfoList[0].foldMap)) return result;
6508
+ const id = `${datasetReshapeInfo[0].id}-primary-axis`;
6509
+ const seriesId = `${datasetReshapeInfo[0].id}-primary-series`;
6510
+ if (!result.axes) result.axes = [];
6511
+ if (!config) {
6512
+ result.axes = [
6513
+ ...result.axes,
6514
+ {
6515
+ visible: true,
6516
+ id,
6517
+ seriesId,
6518
+ type: 'linear',
6519
+ orient: 'left',
6520
+ sync: {
6521
+ axisId: `${datasetReshapeInfo[0].id}-secondary-axis`,
6522
+ tickAlign: false,
6523
+ zeroAlign: true
6524
+ }
6525
+ }
6526
+ ];
6527
+ return result;
6528
+ }
6529
+ const { visible = true, label, tick, title, grid, line, zero, nice, inverse, max, min, log, logBase = 10 } = config;
6530
+ const linearAxis = {
6531
+ visible,
6532
+ id,
6533
+ seriesId,
6534
+ sync: {
6535
+ axisId: `${datasetReshapeInfo[0].id}-secondary-axis`,
6536
+ tickAlign: false,
6537
+ zeroAlign: true
6538
+ },
6539
+ type: log ? 'log' : 'linear',
6540
+ base: logBase,
6541
+ orient: 'left',
6542
+ nice,
6543
+ zero: log ? false : zero,
6544
+ inverse,
6545
+ max,
6546
+ min,
6547
+ label: {
6548
+ visible: label?.visible,
6549
+ formatMethod: (value)=>autoFormatter(value, locale),
6550
+ style: {
6551
+ fill: label?.labelColor,
6552
+ angle: label?.labelAngle,
6553
+ fontSize: label?.labelFontSize,
6554
+ fontWeight: label?.labelFontWeight
6555
+ }
6556
+ },
6557
+ title: {
6558
+ visible: title?.visible,
6559
+ text: title?.titleText,
6560
+ style: {
6561
+ fill: title?.titleColor,
6562
+ fontSize: title?.titleFontSize,
6563
+ fontWeight: title?.titleFontWeight
6564
+ }
6565
+ },
6566
+ tick: {
6567
+ visible: tick?.visible,
6568
+ tickSize: tick?.tickSize,
6569
+ inside: tick?.tickInside,
6570
+ style: {
6571
+ stroke: tick?.tickColor
6572
+ }
6573
+ },
6574
+ grid: {
6575
+ visible: grid?.visible,
6576
+ style: {
6577
+ lineWidth: grid?.gridWidth,
6578
+ stroke: grid?.gridColor
6579
+ }
6580
+ },
6581
+ domainLine: {
6582
+ visible: line?.visible,
6583
+ style: {
6584
+ lineWidth: line?.lineWidth,
6585
+ stroke: line?.lineColor
6586
+ }
6587
+ },
6588
+ innerOffset: {
6589
+ top: LINEAR_AXIS_INNER_OFFSET_TOP
5632
6590
  }
6591
+ };
6592
+ result.axes = [
6593
+ ...result.axes,
6594
+ linearAxis
5633
6595
  ];
5634
- result.animation = true;
5635
6596
  return result;
5636
6597
  };
5637
- const horizontalCrosshairLine = (spec, context)=>{
6598
+ const yLinearSecondary = (spec, context)=>{
5638
6599
  const result = {
5639
6600
  ...spec
5640
6601
  };
5641
6602
  const { advancedVSeed, vseed } = context;
5642
6603
  const { chartType } = vseed;
5643
- const config = advancedVSeed.config?.[chartType]?.crosshairLine;
5644
- if (!config) return result;
5645
- if (!result.crosshair) result.crosshair = {};
5646
- const { visible = true, lineColor, labelColor, labelVisible, labelBackgroundColor } = config;
5647
- const crosshair = result.crosshair;
5648
- crosshair.yField = {
6604
+ const { locale, datasetReshapeInfo } = advancedVSeed;
6605
+ const config = advancedVSeed.config?.[chartType]?.secondaryYAxis;
6606
+ if (chunk_JK3VNB42_n(datasetReshapeInfo[0].foldInfoList?.[1])) return result;
6607
+ const id = `${datasetReshapeInfo[0].id}-secondary-axis`;
6608
+ const seriesId = `${datasetReshapeInfo[0].id}-secondary-series`;
6609
+ if (!result.axes) result.axes = [];
6610
+ if (!config) {
6611
+ result.axes = [
6612
+ ...result.axes,
6613
+ {
6614
+ visible: true,
6615
+ id,
6616
+ seriesId,
6617
+ type: 'linear',
6618
+ orient: 'right'
6619
+ }
6620
+ ];
6621
+ return result;
6622
+ }
6623
+ const { visible = true, label, tick, title, grid, line, zero, nice, inverse, max, min, log, logBase = 10 } = config;
6624
+ const linearAxis = {
5649
6625
  visible,
5650
- line: {
5651
- type: 'line',
6626
+ id,
6627
+ seriesId,
6628
+ type: log ? 'log' : 'linear',
6629
+ base: logBase,
6630
+ orient: 'right',
6631
+ nice,
6632
+ zero: log ? false : zero,
6633
+ inverse,
6634
+ max,
6635
+ min,
6636
+ label: {
6637
+ visible: label?.visible,
6638
+ formatMethod: (value)=>autoFormatter(value, locale),
5652
6639
  style: {
5653
- lineWidth: 1,
5654
- opacity: 1,
5655
- stroke: lineColor,
5656
- lineDash: [
5657
- 4,
5658
- 2
5659
- ]
6640
+ fill: label?.labelColor,
6641
+ angle: label?.labelAngle,
6642
+ fontSize: label?.labelFontSize,
6643
+ fontWeight: label?.labelFontWeight
5660
6644
  }
5661
6645
  },
5662
- label: {
5663
- visible: labelVisible,
5664
- labelBackground: {
5665
- visible: labelVisible,
5666
- style: {
5667
- fill: labelBackgroundColor
5668
- }
5669
- },
6646
+ title: {
6647
+ visible: title?.visible,
6648
+ text: title?.titleText,
5670
6649
  style: {
5671
- fill: labelColor
6650
+ fill: title?.titleColor,
6651
+ fontSize: title?.titleFontSize,
6652
+ fontWeight: title?.titleFontWeight
6653
+ }
6654
+ },
6655
+ tick: {
6656
+ visible: tick?.visible,
6657
+ tickSize: tick?.tickSize,
6658
+ inside: tick?.tickInside,
6659
+ style: {
6660
+ stroke: tick?.tickColor
6661
+ }
6662
+ },
6663
+ grid: {
6664
+ visible: grid?.visible,
6665
+ style: {
6666
+ lineWidth: grid?.gridWidth,
6667
+ stroke: grid?.gridColor
6668
+ }
6669
+ },
6670
+ domainLine: {
6671
+ visible: line?.visible,
6672
+ style: {
6673
+ lineWidth: line?.lineWidth,
6674
+ stroke: line?.lineColor
5672
6675
  }
6676
+ },
6677
+ innerOffset: {
6678
+ top: LINEAR_AXIS_INNER_OFFSET_TOP
5673
6679
  }
5674
6680
  };
6681
+ result.axes = [
6682
+ ...result.axes,
6683
+ linearAxis
6684
+ ];
5675
6685
  return result;
5676
6686
  };
5677
- const scatter = [
5678
- initScatter,
6687
+ const dualAxis = [
6688
+ series([
6689
+ initDualAxisPrimary,
6690
+ dualChartTypePrimary,
6691
+ datasetPrimary,
6692
+ labelPrimary,
6693
+ tooltipPrimary,
6694
+ progressive,
6695
+ barStyle_barStyle,
6696
+ pointStyle_pointStyle,
6697
+ pointStateDimensionHover,
6698
+ lineStyle_lineStyle,
6699
+ areaStyle_areaStyle
6700
+ ], [
6701
+ initDualAxisSecondary,
6702
+ dualChartTypeSecondary,
6703
+ datasetSecondary,
6704
+ labelSecondary,
6705
+ tooltipSecondary,
6706
+ progressive,
6707
+ barStyle_barStyle,
6708
+ pointStyle_pointStyle,
6709
+ pointStateDimensionHover,
6710
+ lineStyle_lineStyle,
6711
+ areaStyle_areaStyle
6712
+ ]),
6713
+ xBand,
6714
+ yLinearPrimary,
6715
+ yLinearSecondary,
5679
6716
  color_color,
5680
6717
  background_backgroundColor,
5681
- datasetXY,
5682
- progressive,
5683
- xLinear,
5684
- yLinear,
5685
- label_label,
5686
- tooltip_tooltip,
5687
- verticalCrosshairLine,
5688
- horizontalCrosshairLine,
5689
6718
  discreteLegend,
5690
- pointStyle_pointStyle,
5691
- pointStateHover,
6719
+ verticalCrosshairRect,
5692
6720
  annotationPoint_annotationPoint,
5693
6721
  annotationVerticalLine_annotationVerticalLine,
5694
6722
  annotationHorizontalLine_annotationHorizontalLine,
5695
6723
  annotationArea_annotationArea
5696
6724
  ];
5697
- const pivotScatter = [
6725
+ const pivotDualAxis = [
5698
6726
  initPivot,
5699
6727
  pivotGridStyle,
5700
6728
  pivotIndicators_pivotIndicatorsAsRow,
5701
6729
  datasetPivot,
5702
6730
  pivotIndicators_pivotIndicators([
5703
- initScatter,
6731
+ series([
6732
+ initDualAxisPrimary,
6733
+ dualChartTypePrimary,
6734
+ datasetPrimary,
6735
+ labelPrimary,
6736
+ tooltipPrimary,
6737
+ progressive,
6738
+ barStyle_barStyle,
6739
+ pointStyle_pointStyle,
6740
+ pointStateDimensionHover,
6741
+ lineStyle_lineStyle,
6742
+ areaStyle_areaStyle
6743
+ ], [
6744
+ initDualAxisSecondary,
6745
+ dualChartTypeSecondary,
6746
+ datasetSecondary,
6747
+ labelSecondary,
6748
+ tooltipSecondary,
6749
+ progressive,
6750
+ barStyle_barStyle,
6751
+ pointStyle_pointStyle,
6752
+ pointStateDimensionHover,
6753
+ lineStyle_lineStyle,
6754
+ areaStyle_areaStyle
6755
+ ]),
6756
+ xBand,
6757
+ yLinearPrimary,
6758
+ yLinearSecondary,
5704
6759
  color_color,
5705
6760
  background_backgroundColor,
5706
- datasetXY,
5707
- progressive,
5708
- xLinear,
5709
- yLinear,
5710
- label_label,
5711
- tooltip_tooltip,
5712
- verticalCrosshairLine,
5713
- horizontalCrosshairLine,
5714
- pointStyle_pointStyle,
5715
- pointStateHover,
6761
+ verticalCrosshairRect,
5716
6762
  annotationPoint_annotationPoint,
5717
6763
  annotationVerticalLine_annotationVerticalLine,
5718
6764
  annotationHorizontalLine_annotationHorizontalLine,
@@ -5722,12 +6768,12 @@
5722
6768
  pivotColumnDimensions,
5723
6769
  pivotDiscreteLegend
5724
6770
  ];
5725
- const scatterSpecPipeline = [
5726
- pivotAdapter_pivotAdapter(scatter, pivotScatter)
6771
+ const dualAxisSpecPipeline = [
6772
+ pivotAdapter_pivotAdapter(dualAxis, pivotDualAxis)
5727
6773
  ];
5728
- const registerScatter = ()=>{
5729
- Builder._advancedPipelineMap.scatter = scatterAdvancedPipeline;
5730
- Builder._specPipelineMap.scatter = scatterSpecPipeline;
6774
+ const registerDualAxis = ()=>{
6775
+ Builder._advancedPipelineMap.dualAxis = dualAxisAdvancedPipeline;
6776
+ Builder._specPipelineMap.dualAxis = dualAxisSpecPipeline;
5731
6777
  };
5732
6778
  const dataReshapeFor1D1M_emptyReshapeResult = {
5733
6779
  dataset: [],
@@ -5807,6 +6853,7 @@
5807
6853
  datasetReshapeInfo: [
5808
6854
  {
5809
6855
  id: '1D1M',
6856
+ index: 0,
5810
6857
  foldInfo,
5811
6858
  unfoldInfo
5812
6859
  }
@@ -5828,7 +6875,7 @@
5828
6875
  });
5829
6876
  const newDatasets = [];
5830
6877
  const datasetReshapeInfo = [];
5831
- measureGroups.forEach((measureGroup)=>{
6878
+ measureGroups.forEach((measureGroup, index)=>{
5832
6879
  const measures = measureGroup.children;
5833
6880
  if (!measures) return;
5834
6881
  const commonDimensions = dimensions.filter((dim)=>'dimension' === dim.location);
@@ -5841,6 +6888,7 @@
5841
6888
  });
5842
6889
  const reshapeInfo = {
5843
6890
  id: groupId,
6891
+ index,
5844
6892
  foldInfo,
5845
6893
  unfoldInfo
5846
6894
  };
@@ -7194,6 +8242,22 @@
7194
8242
  },
7195
8243
  crosshairLine
7196
8244
  },
8245
+ dualAxis: {
8246
+ ...baseConfig,
8247
+ xAxis: bandAxis,
8248
+ primaryYAxis: linearAxis,
8249
+ secondaryYAxis: {
8250
+ ...linearAxis,
8251
+ grid: {
8252
+ visible: false
8253
+ }
8254
+ },
8255
+ dualChartType: {
8256
+ primary: 'column',
8257
+ secondary: 'line'
8258
+ },
8259
+ crosshairRect
8260
+ },
7197
8261
  pie: {
7198
8262
  ...baseConfig
7199
8263
  },
@@ -7516,6 +8580,22 @@
7516
8580
  },
7517
8581
  crosshairLine
7518
8582
  },
8583
+ dualAxis: {
8584
+ ...baseConfig,
8585
+ xAxis: bandAxis,
8586
+ primaryYAxis: linearAxis,
8587
+ secondaryYAxis: {
8588
+ ...linearAxis,
8589
+ grid: {
8590
+ visible: false
8591
+ }
8592
+ },
8593
+ dualChartType: {
8594
+ primary: 'column',
8595
+ secondary: 'line'
8596
+ },
8597
+ crosshairRect
8598
+ },
7519
8599
  pie: {
7520
8600
  ...baseConfig
7521
8601
  },
@@ -7581,6 +8661,7 @@
7581
8661
  registerAreaPercent();
7582
8662
  registerAreaRange();
7583
8663
  registerScatter();
8664
+ registerDualAxis();
7584
8665
  registerPie();
7585
8666
  registerDonut();
7586
8667
  registerRose();
@@ -10903,6 +11984,22 @@
10903
11984
  'funnel',
10904
11985
  'heatmap'
10905
11986
  ]);
11987
+ const zDualChartType = schemas_object({
11988
+ primary: schemas_enum([
11989
+ 'line',
11990
+ 'column',
11991
+ 'columnParallel',
11992
+ 'area',
11993
+ 'scatter'
11994
+ ]).default('column'),
11995
+ secondary: schemas_enum([
11996
+ 'line',
11997
+ 'column',
11998
+ 'columnParallel',
11999
+ 'area',
12000
+ 'scatter'
12001
+ ]).default('line')
12002
+ });
10906
12003
  const zDatum = record(schemas_string().or(schemas_number()), any());
10907
12004
  const zDataset = schemas_array(zDatum);
10908
12005
  const zDimension = schemas_object({
@@ -10968,6 +12065,14 @@
10968
12065
  });
10969
12066
  const zMeasures = schemas_array(zMeasure);
10970
12067
  const zMeasureTree = schemas_array(zMeasureGroup.or(zMeasure));
12068
+ const zDualMeasure = schemas_object({
12069
+ id: schemas_string(),
12070
+ primaryMeasures: schemas_array(zMeasure).or(zMeasure).optional(),
12071
+ primaryAlias: schemas_string().optional(),
12072
+ secondaryMeasures: schemas_array(zMeasure).or(zMeasure).optional(),
12073
+ secondaryAlias: schemas_string().optional()
12074
+ });
12075
+ const zDualMeasures = schemas_array(zDualMeasure);
10971
12076
  const zFoldInfo = schemas_object({
10972
12077
  foldMap: record(schemas_string(), schemas_string().or(schemas_undefined())),
10973
12078
  measureId: schemas_string(),
@@ -10982,7 +12087,9 @@
10982
12087
  });
10983
12088
  const zDatasetReshapeInfo = schemas_array(schemas_object({
10984
12089
  id: schemas_string(),
12090
+ index: schemas_number(),
10985
12091
  foldInfo: zFoldInfo,
12092
+ foldInfoList: schemas_array(zFoldInfo).optional(),
10986
12093
  unfoldInfo: zUnfoldInfo
10987
12094
  }));
10988
12095
  const zEncoding = schemas_array(schemas_object({
@@ -11262,7 +12369,12 @@
11262
12369
  label: zLabel.optional(),
11263
12370
  color: zColor.optional(),
11264
12371
  tooltip: zTooltip.optional(),
11265
- legend: zLegend.optional()
12372
+ legend: zLegend.optional(),
12373
+ dualChartType: schemas_array(zDualChartType).or(zDualChartType).optional(),
12374
+ primaryYAxis: schemas_array(zYLinearAxis).or(zYLinearAxis).optional(),
12375
+ secondaryYAxis: schemas_array(zYLinearAxis).or(zYLinearAxis).optional(),
12376
+ xAxis: zXBandAxis.optional(),
12377
+ crosshairRect: zCrosshairRect.optional()
11266
12378
  });
11267
12379
  const zScatterConfig = schemas_object({
11268
12380
  backgroundColor: zBackgroundColor.optional(),
@@ -11306,8 +12418,8 @@
11306
12418
  area: zAreaConfig.optional(),
11307
12419
  areaPercent: zAreaPercentConfig.optional(),
11308
12420
  areaRange: zAreaRangeConfig.optional(),
11309
- dualAxis: zDualAxisConfig.optional(),
11310
12421
  scatter: zScatterConfig.optional(),
12422
+ dualAxis: zDualAxisConfig.optional(),
11311
12423
  rose: zRoseConfig.optional(),
11312
12424
  roseParallel: zRoseParallelConfig.optional(),
11313
12425
  pie: zPieConfig.optional(),
@@ -11960,6 +13072,35 @@
11960
13072
  annotationArea: schemas_array(zAnnotationArea).or(zAnnotationArea).optional(),
11961
13073
  locale: zLocale.optional()
11962
13074
  });
13075
+ const zDualAxis = schemas_object({
13076
+ chartType: literal('dualAxis'),
13077
+ dataset: zDataset.optional(),
13078
+ dimensions: zDimensions.optional(),
13079
+ measures: zMeasureTree.optional(),
13080
+ dualMeasures: zDualMeasures.optional(),
13081
+ dualChartType: schemas_array(zDualChartType).or(zDualChartType).optional(),
13082
+ primaryYAxis: schemas_array(zYLinearAxis).or(zYLinearAxis).optional(),
13083
+ secondaryYAxis: schemas_array(zYLinearAxis).or(zYLinearAxis).optional(),
13084
+ xAxis: zXBandAxis.optional(),
13085
+ backgroundColor: zBackgroundColor.optional(),
13086
+ color: zColor.optional(),
13087
+ label: zLabel.optional(),
13088
+ legend: zLegend.optional(),
13089
+ tooltip: zTooltip.optional(),
13090
+ crosshairRect: zCrosshairRect.optional(),
13091
+ sort: zSort.optional(),
13092
+ sortLegend: zSortLegend.optional(),
13093
+ theme: zTheme.optional(),
13094
+ barStyle: schemas_array(zBarStyle).or(zBarStyle).optional(),
13095
+ pointStyle: schemas_array(zPointStyle).or(zPointStyle).optional(),
13096
+ lineStyle: schemas_array(zLineStyle).or(zLineStyle).optional(),
13097
+ areaStyle: schemas_array(zAreaStyle).or(zAreaStyle).optional(),
13098
+ annotationPoint: schemas_array(zAnnotationPoint).or(zAnnotationPoint).optional(),
13099
+ annotationVerticalLine: schemas_array(zAnnotationVerticalLine).or(zAnnotationVerticalLine).optional(),
13100
+ annotationHorizontalLine: schemas_array(zAnnotationHorizontalLine).or(zAnnotationHorizontalLine).optional(),
13101
+ annotationArea: schemas_array(zAnnotationArea).or(zAnnotationArea).optional(),
13102
+ locale: zLocale.optional()
13103
+ });
11963
13104
  const zRose = schemas_object({
11964
13105
  chartType: literal('rose'),
11965
13106
  dataset: zDataset.optional(),
@@ -12065,6 +13206,7 @@
12065
13206
  zAreaPercent,
12066
13207
  zAreaRange,
12067
13208
  zScatter,
13209
+ zDualAxis,
12068
13210
  zPie,
12069
13211
  zDonut,
12070
13212
  zRose,