@visactor/vseed 0.0.33 → 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 (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 +1352 -202
  8. package/dist/index.cjs.map +1 -1
  9. package/dist/index.js +1279 -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 +507 -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 +1963 -0
  54. package/dist/types/chartType/index.d.ts +1 -1
  55. package/dist/types/properties/chartType/dualChartType.d.ts +22 -0
  56. package/dist/types/properties/chartType/index.d.ts +2 -0
  57. package/dist/types/properties/config/config.d.ts +493 -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 +500 -14
  65. package/dist/types/vseed.d.ts +1961 -0
  66. package/dist/umd/index.js +1272 -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,1125 @@
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 config = advancedVSeed.config?.[chartType]?.dualChartType || {
6099
+ primary: 'column',
6100
+ secondary: 'line'
6101
+ };
6102
+ if (Array.isArray(config)) return result;
6103
+ switch(config.primary){
6104
+ case 'line':
6105
+ result.type = 'line';
6106
+ break;
6107
+ case 'column':
6108
+ result.type = 'bar';
6109
+ break;
6110
+ case 'columnParallel':
6111
+ {
6112
+ const columnSpec = result;
6113
+ if (Array.isArray(columnSpec.xField)) columnSpec.xField.push(datasetReshapeInfo[0].unfoldInfo.groupId);
6114
+ else if (columnSpec.xField) columnSpec.xField = [
6115
+ columnSpec.xField,
6116
+ datasetReshapeInfo[0].unfoldInfo.groupId
6117
+ ];
6118
+ columnSpec.type = 'bar';
6119
+ break;
6120
+ }
6121
+ case 'columnPercent':
6122
+ result.type = 'bar';
6123
+ result.percent = true;
6124
+ break;
6125
+ case 'area':
6126
+ result.type = 'area';
6127
+ break;
6128
+ case 'areaPercent':
6129
+ result.type = 'area';
6130
+ result.percent = true;
6131
+ break;
6132
+ case 'scatter':
6133
+ result.type = 'scatter';
6134
+ break;
6135
+ default:
6136
+ result.type = config.primary;
6137
+ }
6138
+ return result;
6139
+ };
6140
+ const dualChartTypeSecondary = (spec, context)=>{
6141
+ const result = {
6142
+ ...spec
6143
+ };
6144
+ const { advancedVSeed, vseed } = context;
6145
+ const { chartType } = vseed;
6146
+ const { datasetReshapeInfo } = advancedVSeed;
6147
+ const config = advancedVSeed.config?.[chartType]?.dualChartType || {
6148
+ primary: 'column',
6149
+ secondary: 'line'
6150
+ };
6151
+ if (Array.isArray(config)) return result;
6152
+ switch(config.secondary){
6153
+ case 'line':
6154
+ result.type = 'line';
6155
+ break;
6156
+ case 'column':
6157
+ result.type = 'bar';
6158
+ break;
6159
+ case 'columnParallel':
6160
+ {
6161
+ const columnSpec = result;
6162
+ if (Array.isArray(columnSpec.xField)) columnSpec.xField.push(datasetReshapeInfo[0].unfoldInfo.groupId);
6163
+ else if (columnSpec.xField) columnSpec.xField = [
6164
+ columnSpec.xField,
6165
+ datasetReshapeInfo[0].unfoldInfo.groupId
6166
+ ];
6167
+ columnSpec.type = 'bar';
6168
+ break;
6169
+ }
6170
+ case 'columnPercent':
6171
+ result.type = 'bar';
6172
+ result.percent = true;
6173
+ break;
6174
+ case 'area':
6175
+ result.type = 'area';
6176
+ break;
6177
+ case 'areaPercent':
6178
+ result.type = 'area';
6179
+ result.percent = true;
6180
+ break;
6181
+ case 'scatter':
6182
+ result.type = 'scatter';
6183
+ break;
6184
+ default:
6185
+ result.type = config.secondary;
6186
+ }
6187
+ return result;
6188
+ };
6189
+ const datasetPrimary = (spec, context)=>{
6190
+ const { advancedVSeed, vseed } = context;
6191
+ const { encoding, analysis, datasetReshapeInfo } = advancedVSeed;
6192
+ const { orderMapping = {} } = analysis ?? {};
6193
+ const x = encoding[0]?.x?.[0];
6194
+ const group = encoding[0]?.group?.[0];
6195
+ const id = datasetReshapeInfo[0].id;
6196
+ const fields = {};
6197
+ if (x) {
6198
+ const order = orderMapping[x];
6199
+ if (order) fields[x] = {
6200
+ sortIndex: 0,
6201
+ domain: order,
6202
+ lockStatisticsByDomain: true
6203
+ };
6204
+ else fields[x] = {
6205
+ sortIndex: 0
6206
+ };
6207
+ }
6208
+ if (group) {
6209
+ const order = orderMapping[group];
6210
+ if (order) fields[group] = {
6211
+ sortIndex: 0,
6212
+ domain: order,
6213
+ lockStatisticsByDomain: true
6214
+ };
6215
+ else fields[group] = {
6216
+ sortIndex: 0
6217
+ };
6218
+ }
6219
+ return {
6220
+ ...spec,
6221
+ data: {
6222
+ id: `${id}-primary-dataset`,
6223
+ values: isPivotChart(vseed) ? void 0 : advancedVSeed.dataset[0],
6224
+ fields: fields
6225
+ }
6226
+ };
6227
+ };
6228
+ const datasetSecondary = (spec, context)=>{
6229
+ const { advancedVSeed, vseed } = context;
6230
+ const { encoding, analysis, datasetReshapeInfo } = advancedVSeed;
6231
+ const { orderMapping = {} } = analysis ?? {};
6232
+ const x = encoding[0]?.x?.[0];
6233
+ const group = encoding[0]?.group?.[0];
6234
+ const id = datasetReshapeInfo[0].id;
6235
+ const fields = {};
6236
+ if (x) {
6237
+ const order = orderMapping[x];
6238
+ if (order) fields[x] = {
6239
+ sortIndex: 0,
6240
+ domain: order,
6241
+ lockStatisticsByDomain: true
6242
+ };
6243
+ else fields[x] = {
6244
+ sortIndex: 0
6245
+ };
6246
+ }
6247
+ if (group) {
6248
+ const order = orderMapping[group];
6249
+ if (order) fields[group] = {
6250
+ sortIndex: 0,
6251
+ domain: order,
6252
+ lockStatisticsByDomain: true
6253
+ };
6254
+ else fields[group] = {
6255
+ sortIndex: 0
6256
+ };
6257
+ }
6258
+ return {
6259
+ ...spec,
6260
+ data: {
6261
+ id: `${id}-secondary-dataset`,
6262
+ values: isPivotChart(vseed) ? void 0 : advancedVSeed.dataset[1],
6263
+ fields: fields
6264
+ }
6265
+ };
6266
+ };
6267
+ const labelPrimary = (spec, context)=>{
6268
+ const result = {
6269
+ ...spec
6270
+ };
6271
+ const { advancedVSeed } = context;
6272
+ const { measures, datasetReshapeInfo, locale } = advancedVSeed;
6273
+ const { chartType } = advancedVSeed;
6274
+ const baseConfig = advancedVSeed.config[chartType];
6275
+ if (!baseConfig || !baseConfig.label) return result;
6276
+ const foldInfoList = datasetReshapeInfo[0].foldInfoList;
6277
+ const { measureId, measureValue } = foldInfoList[0];
6278
+ const { label } = baseConfig;
6279
+ const { enable } = label;
6280
+ result.label = {
6281
+ visible: enable,
6282
+ formatMethod: (value, datum)=>{
6283
+ const result = [];
6284
+ const formatValue = (value)=>{
6285
+ const id = datum[measureId];
6286
+ const measure = findMeasureById(measures, id);
6287
+ if (!measure) return value;
6288
+ const { format = {}, autoFormat = true } = measure;
6289
+ if (!chunk_VCYTMP4D_n(format)) {
6290
+ const formatter = createFormatter(format);
6291
+ return formatter(value);
6292
+ }
6293
+ if (autoFormat) return autoFormatter(value, locale);
6294
+ return String(value);
6295
+ };
6296
+ result.push(formatValue(datum[measureValue]));
6297
+ return result.join(' ');
6298
+ }
6299
+ };
6300
+ return result;
6301
+ };
6302
+ const labelSecondary = (spec, context)=>{
6303
+ const result = {
6304
+ ...spec
6305
+ };
6306
+ const { advancedVSeed } = context;
6307
+ const { measures, datasetReshapeInfo, locale } = advancedVSeed;
6308
+ const { chartType } = advancedVSeed;
6309
+ const baseConfig = advancedVSeed.config[chartType];
6310
+ if (!baseConfig || !baseConfig.label) return result;
6311
+ if (chunk_JK3VNB42_n(datasetReshapeInfo[0].foldInfoList?.[1])) return result;
6312
+ const foldInfoList = datasetReshapeInfo[0].foldInfoList;
6313
+ const { measureId, measureValue } = foldInfoList[1];
6314
+ const { label } = baseConfig;
6315
+ const { enable } = label;
6316
+ result.label = {
6317
+ visible: enable,
6318
+ formatMethod: (value, datum)=>{
6319
+ const result = [];
6320
+ const formatValue = (value)=>{
6321
+ const id = datum[measureId];
6322
+ const measure = findMeasureById(measures, id);
6323
+ if (!measure) return value;
6324
+ const { format = {}, autoFormat = true } = measure;
6325
+ if (!chunk_VCYTMP4D_n(format)) {
6326
+ const formatter = createFormatter(format);
6327
+ return formatter(value);
6328
+ }
6329
+ if (autoFormat) return autoFormatter(value, locale);
6330
+ return String(value);
6331
+ };
6332
+ result.push(formatValue(datum[measureValue]));
6333
+ return result.join(' ');
6334
+ }
6335
+ };
6336
+ return result;
6337
+ };
6338
+ const tooltipPrimary = (spec, context)=>{
6339
+ const result = {
6340
+ ...spec
6341
+ };
6342
+ const { advancedVSeed } = context;
6343
+ const { measures, datasetReshapeInfo, chartType, locale, dimensions } = advancedVSeed;
6344
+ const baseConfig = advancedVSeed.config[chartType];
6345
+ const { tooltip = {
6346
+ enable: true
6347
+ } } = baseConfig;
6348
+ const { enable } = tooltip;
6349
+ const foldInfoList = datasetReshapeInfo[0].foldInfoList;
6350
+ const unfoldInfo = datasetReshapeInfo[0].unfoldInfo;
6351
+ const { measureId, measureValue, measureName } = foldInfoList[0];
6352
+ const { groupName } = unfoldInfo;
6353
+ result.tooltip = {
6354
+ visible: enable,
6355
+ mark: {
6356
+ title: {
6357
+ visible: true
6358
+ },
6359
+ content: [
6360
+ ...dimensions.map((item)=>({
6361
+ visible: true,
6362
+ hasShape: true,
6363
+ shapeType: 'rectRound',
6364
+ key: (datum)=>{
6365
+ if (item.alias || item.id) return item.alias || item.id;
6366
+ return datum && datum[item.id];
6367
+ },
6368
+ value: (datum)=>datum && datum[item.id]
6369
+ })),
6370
+ {
6371
+ visible: true,
6372
+ hasShape: true,
6373
+ key: (datum)=>datum && datum[measureName || groupName] || '',
6374
+ value: (datum)=>{
6375
+ if (!datum) return '';
6376
+ const value = datum[measureValue];
6377
+ const id = datum[measureId];
6378
+ const measure = findMeasureById(measures, id);
6379
+ if (!measure) return String(value);
6380
+ const { format = {}, autoFormat = true } = measure;
6381
+ if (!chunk_VCYTMP4D_n(format)) {
6382
+ const formatter = createFormatter(format);
6383
+ return formatter(value);
6384
+ }
6385
+ if (autoFormat) return autoFormatter(value, locale);
6386
+ return String(value);
6387
+ }
6388
+ }
6389
+ ]
6390
+ },
6391
+ dimension: {
6392
+ content: [
6393
+ {
6394
+ visible: true,
6395
+ key: (datum)=>datum && datum[groupName] || '',
6396
+ value: (datum)=>{
6397
+ if (!datum) return '';
6398
+ const value = datum[measureValue];
6399
+ const id = datum[measureId];
6400
+ const measure = findMeasureById(measures, id);
6401
+ if (!measure) return String(value);
6402
+ const { format = {}, autoFormat = true } = measure;
6403
+ if (!chunk_VCYTMP4D_n(format)) {
6404
+ const formatter = createFormatter(format);
6405
+ return formatter(value);
6406
+ }
6407
+ if (autoFormat) return autoFormatter(value, locale);
6408
+ return String(value);
6409
+ },
6410
+ shapeType: 'rectRound'
6411
+ }
6412
+ ]
6413
+ }
6414
+ };
6415
+ return result;
6416
+ };
6417
+ const tooltipSecondary = (spec, context)=>{
6418
+ const result = {
6419
+ ...spec
6420
+ };
6421
+ const { advancedVSeed } = context;
6422
+ const { measures, datasetReshapeInfo, chartType, locale, dimensions } = advancedVSeed;
6423
+ const baseConfig = advancedVSeed.config[chartType];
6424
+ const { tooltip = {
6425
+ enable: true
6426
+ } } = baseConfig;
6427
+ const { enable } = tooltip;
6428
+ if (chunk_JK3VNB42_n(datasetReshapeInfo[0].foldInfoList?.[1])) return result;
6429
+ const foldInfoList = datasetReshapeInfo[0].foldInfoList;
6430
+ const unfoldInfo = datasetReshapeInfo[0].unfoldInfo;
6431
+ const { measureId, measureValue, measureName } = foldInfoList[1];
6432
+ const { groupName } = unfoldInfo;
6433
+ result.tooltip = {
6434
+ visible: enable,
6435
+ mark: {
6436
+ title: {
6437
+ visible: true
6438
+ },
6439
+ content: [
6440
+ ...dimensions.map((item)=>({
6441
+ visible: true,
6442
+ hasShape: true,
6443
+ shapeType: 'rectRound',
6444
+ key: (datum)=>{
6445
+ if (item.alias || item.id) return item.alias || item.id;
6446
+ return datum && datum[item.id];
6447
+ },
6448
+ value: (datum)=>datum && datum[item.id]
6449
+ })),
6450
+ {
6451
+ visible: true,
6452
+ hasShape: true,
6453
+ key: (datum)=>datum && datum[measureName || groupName] || '',
6454
+ value: (datum)=>{
6455
+ if (!datum) return '';
6456
+ const value = datum[measureValue];
6457
+ const id = datum[measureId];
6458
+ const measure = findMeasureById(measures, id);
6459
+ if (!measure) return String(value);
6460
+ const { format = {}, autoFormat = true } = measure;
6461
+ if (!chunk_VCYTMP4D_n(format)) {
6462
+ const formatter = createFormatter(format);
6463
+ return formatter(value);
6464
+ }
6465
+ if (autoFormat) return autoFormatter(value, locale);
6466
+ return String(value);
6467
+ }
6468
+ }
6469
+ ]
6470
+ },
6471
+ dimension: {
6472
+ content: [
6473
+ {
6474
+ visible: true,
6475
+ key: (datum)=>datum && datum[groupName] || '',
6476
+ value: (datum)=>{
6477
+ if (!datum) return '';
6478
+ const value = datum[measureValue];
6479
+ const id = datum[measureId];
6480
+ const measure = findMeasureById(measures, id);
6481
+ if (!measure) return String(value);
6482
+ const { format = {}, autoFormat = true } = measure;
6483
+ if (!chunk_VCYTMP4D_n(format)) {
6484
+ const formatter = createFormatter(format);
6485
+ return formatter(value);
6486
+ }
6487
+ if (autoFormat) return autoFormatter(value, locale);
6488
+ return String(value);
6489
+ },
6490
+ shapeType: 'rectRound'
6491
+ }
6492
+ ]
6493
+ }
6494
+ };
6495
+ return result;
6496
+ };
6497
+ const yLinearPrimary = (spec, context)=>{
6498
+ const result = {
6499
+ ...spec
6500
+ };
6501
+ const { advancedVSeed, vseed } = context;
6502
+ const { chartType } = vseed;
6503
+ const { locale, datasetReshapeInfo } = advancedVSeed;
6504
+ const config = advancedVSeed.config?.[chartType]?.primaryYAxis;
6505
+ if (datasetReshapeInfo[0].foldInfoList?.[0] && chunk_VCYTMP4D_n(datasetReshapeInfo[0].foldInfoList[0].foldMap)) return result;
6506
+ const id = `${datasetReshapeInfo[0].id}-primary-axis`;
6507
+ const seriesId = `${datasetReshapeInfo[0].id}-primary-series`;
6508
+ if (!result.axes) result.axes = [];
6509
+ if (!config) {
6510
+ result.axes = [
6511
+ ...result.axes,
6512
+ {
6513
+ visible: true,
6514
+ id,
6515
+ seriesId,
6516
+ type: 'linear',
6517
+ orient: 'left',
6518
+ sync: {
6519
+ axisId: `${datasetReshapeInfo[0].id}-secondary-axis`,
6520
+ tickAlign: false,
6521
+ zeroAlign: true
6522
+ }
6523
+ }
6524
+ ];
6525
+ return result;
6526
+ }
6527
+ const { visible = true, label, tick, title, grid, line, zero, nice, inverse, max, min, log, logBase = 10 } = config;
6528
+ const linearAxis = {
6529
+ visible,
6530
+ id,
6531
+ seriesId,
6532
+ sync: {
6533
+ axisId: `${datasetReshapeInfo[0].id}-secondary-axis`,
6534
+ tickAlign: false,
6535
+ zeroAlign: true
6536
+ },
6537
+ type: log ? 'log' : 'linear',
6538
+ base: logBase,
6539
+ orient: 'left',
6540
+ nice,
6541
+ zero: log ? false : zero,
6542
+ inverse,
6543
+ max,
6544
+ min,
6545
+ label: {
6546
+ visible: label?.visible,
6547
+ formatMethod: (value)=>autoFormatter(value, locale),
6548
+ style: {
6549
+ fill: label?.labelColor,
6550
+ angle: label?.labelAngle,
6551
+ fontSize: label?.labelFontSize,
6552
+ fontWeight: label?.labelFontWeight
6553
+ }
6554
+ },
6555
+ title: {
6556
+ visible: title?.visible,
6557
+ text: title?.titleText,
6558
+ style: {
6559
+ fill: title?.titleColor,
6560
+ fontSize: title?.titleFontSize,
6561
+ fontWeight: title?.titleFontWeight
6562
+ }
6563
+ },
6564
+ tick: {
6565
+ visible: tick?.visible,
6566
+ tickSize: tick?.tickSize,
6567
+ inside: tick?.tickInside,
6568
+ style: {
6569
+ stroke: tick?.tickColor
6570
+ }
6571
+ },
6572
+ grid: {
6573
+ visible: grid?.visible,
6574
+ style: {
6575
+ lineWidth: grid?.gridWidth,
6576
+ stroke: grid?.gridColor
6577
+ }
6578
+ },
6579
+ domainLine: {
6580
+ visible: line?.visible,
6581
+ style: {
6582
+ lineWidth: line?.lineWidth,
6583
+ stroke: line?.lineColor
6584
+ }
6585
+ },
6586
+ innerOffset: {
6587
+ top: LINEAR_AXIS_INNER_OFFSET_TOP
5632
6588
  }
6589
+ };
6590
+ result.axes = [
6591
+ ...result.axes,
6592
+ linearAxis
5633
6593
  ];
5634
- result.animation = true;
5635
6594
  return result;
5636
6595
  };
5637
- const horizontalCrosshairLine = (spec, context)=>{
6596
+ const yLinearSecondary = (spec, context)=>{
5638
6597
  const result = {
5639
6598
  ...spec
5640
6599
  };
5641
6600
  const { advancedVSeed, vseed } = context;
5642
6601
  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 = {
6602
+ const { locale, datasetReshapeInfo } = advancedVSeed;
6603
+ const config = advancedVSeed.config?.[chartType]?.secondaryYAxis;
6604
+ if (chunk_JK3VNB42_n(datasetReshapeInfo[0].foldInfoList?.[1])) return result;
6605
+ const id = `${datasetReshapeInfo[0].id}-secondary-axis`;
6606
+ const seriesId = `${datasetReshapeInfo[0].id}-secondary-series`;
6607
+ if (!result.axes) result.axes = [];
6608
+ if (!config) {
6609
+ result.axes = [
6610
+ ...result.axes,
6611
+ {
6612
+ visible: true,
6613
+ id,
6614
+ seriesId,
6615
+ type: 'linear',
6616
+ orient: 'right'
6617
+ }
6618
+ ];
6619
+ return result;
6620
+ }
6621
+ const { visible = true, label, tick, title, grid, line, zero, nice, inverse, max, min, log, logBase = 10 } = config;
6622
+ const linearAxis = {
5649
6623
  visible,
5650
- line: {
5651
- type: 'line',
6624
+ id,
6625
+ seriesId,
6626
+ type: log ? 'log' : 'linear',
6627
+ base: logBase,
6628
+ orient: 'right',
6629
+ nice,
6630
+ zero: log ? false : zero,
6631
+ inverse,
6632
+ max,
6633
+ min,
6634
+ label: {
6635
+ visible: label?.visible,
6636
+ formatMethod: (value)=>autoFormatter(value, locale),
5652
6637
  style: {
5653
- lineWidth: 1,
5654
- opacity: 1,
5655
- stroke: lineColor,
5656
- lineDash: [
5657
- 4,
5658
- 2
5659
- ]
6638
+ fill: label?.labelColor,
6639
+ angle: label?.labelAngle,
6640
+ fontSize: label?.labelFontSize,
6641
+ fontWeight: label?.labelFontWeight
5660
6642
  }
5661
6643
  },
5662
- label: {
5663
- visible: labelVisible,
5664
- labelBackground: {
5665
- visible: labelVisible,
5666
- style: {
5667
- fill: labelBackgroundColor
5668
- }
5669
- },
6644
+ title: {
6645
+ visible: title?.visible,
6646
+ text: title?.titleText,
5670
6647
  style: {
5671
- fill: labelColor
6648
+ fill: title?.titleColor,
6649
+ fontSize: title?.titleFontSize,
6650
+ fontWeight: title?.titleFontWeight
6651
+ }
6652
+ },
6653
+ tick: {
6654
+ visible: tick?.visible,
6655
+ tickSize: tick?.tickSize,
6656
+ inside: tick?.tickInside,
6657
+ style: {
6658
+ stroke: tick?.tickColor
6659
+ }
6660
+ },
6661
+ grid: {
6662
+ visible: grid?.visible,
6663
+ style: {
6664
+ lineWidth: grid?.gridWidth,
6665
+ stroke: grid?.gridColor
5672
6666
  }
6667
+ },
6668
+ domainLine: {
6669
+ visible: line?.visible,
6670
+ style: {
6671
+ lineWidth: line?.lineWidth,
6672
+ stroke: line?.lineColor
6673
+ }
6674
+ },
6675
+ innerOffset: {
6676
+ top: LINEAR_AXIS_INNER_OFFSET_TOP
5673
6677
  }
5674
6678
  };
6679
+ result.axes = [
6680
+ ...result.axes,
6681
+ linearAxis
6682
+ ];
5675
6683
  return result;
5676
6684
  };
5677
- const scatter = [
5678
- initScatter,
6685
+ const dualAxis = [
6686
+ series([
6687
+ initDualAxisPrimary,
6688
+ dualChartTypePrimary,
6689
+ datasetPrimary,
6690
+ labelPrimary,
6691
+ tooltipPrimary,
6692
+ progressive,
6693
+ barStyle_barStyle,
6694
+ pointStyle_pointStyle,
6695
+ pointStateDimensionHover,
6696
+ lineStyle_lineStyle,
6697
+ areaStyle_areaStyle
6698
+ ], [
6699
+ initDualAxisSecondary,
6700
+ dualChartTypeSecondary,
6701
+ datasetSecondary,
6702
+ labelSecondary,
6703
+ tooltipSecondary,
6704
+ progressive,
6705
+ barStyle_barStyle,
6706
+ pointStyle_pointStyle,
6707
+ pointStateDimensionHover,
6708
+ lineStyle_lineStyle,
6709
+ areaStyle_areaStyle
6710
+ ]),
6711
+ xBand,
6712
+ yLinearPrimary,
6713
+ yLinearSecondary,
5679
6714
  color_color,
5680
6715
  background_backgroundColor,
5681
- datasetXY,
5682
- progressive,
5683
- xLinear,
5684
- yLinear,
5685
- label_label,
5686
- tooltip_tooltip,
5687
- verticalCrosshairLine,
5688
- horizontalCrosshairLine,
5689
6716
  discreteLegend,
5690
- pointStyle_pointStyle,
5691
- pointStateHover,
6717
+ verticalCrosshairRect,
5692
6718
  annotationPoint_annotationPoint,
5693
6719
  annotationVerticalLine_annotationVerticalLine,
5694
6720
  annotationHorizontalLine_annotationHorizontalLine,
5695
6721
  annotationArea_annotationArea
5696
6722
  ];
5697
- const pivotScatter = [
6723
+ const pivotDualAxis = [
5698
6724
  initPivot,
5699
6725
  pivotGridStyle,
5700
6726
  pivotIndicators_pivotIndicatorsAsRow,
5701
6727
  datasetPivot,
5702
6728
  pivotIndicators_pivotIndicators([
5703
- initScatter,
6729
+ series([
6730
+ initDualAxisPrimary,
6731
+ datasetPrimary,
6732
+ labelPrimary,
6733
+ tooltipPrimary,
6734
+ progressive,
6735
+ barStyle_barStyle,
6736
+ pointStyle_pointStyle,
6737
+ pointStateDimensionHover,
6738
+ lineStyle_lineStyle,
6739
+ areaStyle_areaStyle
6740
+ ], [
6741
+ initDualAxisSecondary,
6742
+ datasetSecondary,
6743
+ labelSecondary,
6744
+ tooltipSecondary,
6745
+ progressive,
6746
+ barStyle_barStyle,
6747
+ pointStyle_pointStyle,
6748
+ pointStateDimensionHover,
6749
+ lineStyle_lineStyle,
6750
+ areaStyle_areaStyle
6751
+ ]),
6752
+ xBand,
6753
+ yLinearPrimary,
6754
+ yLinearSecondary,
5704
6755
  color_color,
5705
6756
  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,
6757
+ verticalCrosshairRect,
5716
6758
  annotationPoint_annotationPoint,
5717
6759
  annotationVerticalLine_annotationVerticalLine,
5718
6760
  annotationHorizontalLine_annotationHorizontalLine,
@@ -5722,12 +6764,12 @@
5722
6764
  pivotColumnDimensions,
5723
6765
  pivotDiscreteLegend
5724
6766
  ];
5725
- const scatterSpecPipeline = [
5726
- pivotAdapter_pivotAdapter(scatter, pivotScatter)
6767
+ const dualAxisSpecPipeline = [
6768
+ pivotAdapter_pivotAdapter(dualAxis, pivotDualAxis)
5727
6769
  ];
5728
- const registerScatter = ()=>{
5729
- Builder._advancedPipelineMap.scatter = scatterAdvancedPipeline;
5730
- Builder._specPipelineMap.scatter = scatterSpecPipeline;
6770
+ const registerDualAxis = ()=>{
6771
+ Builder._advancedPipelineMap.dualAxis = dualAxisAdvancedPipeline;
6772
+ Builder._specPipelineMap.dualAxis = dualAxisSpecPipeline;
5731
6773
  };
5732
6774
  const dataReshapeFor1D1M_emptyReshapeResult = {
5733
6775
  dataset: [],
@@ -5807,6 +6849,7 @@
5807
6849
  datasetReshapeInfo: [
5808
6850
  {
5809
6851
  id: '1D1M',
6852
+ index: 0,
5810
6853
  foldInfo,
5811
6854
  unfoldInfo
5812
6855
  }
@@ -5828,7 +6871,7 @@
5828
6871
  });
5829
6872
  const newDatasets = [];
5830
6873
  const datasetReshapeInfo = [];
5831
- measureGroups.forEach((measureGroup)=>{
6874
+ measureGroups.forEach((measureGroup, index)=>{
5832
6875
  const measures = measureGroup.children;
5833
6876
  if (!measures) return;
5834
6877
  const commonDimensions = dimensions.filter((dim)=>'dimension' === dim.location);
@@ -5841,6 +6884,7 @@
5841
6884
  });
5842
6885
  const reshapeInfo = {
5843
6886
  id: groupId,
6887
+ index,
5844
6888
  foldInfo,
5845
6889
  unfoldInfo
5846
6890
  };
@@ -7194,6 +8238,17 @@
7194
8238
  },
7195
8239
  crosshairLine
7196
8240
  },
8241
+ dualAxis: {
8242
+ ...baseConfig,
8243
+ xAxis: bandAxis,
8244
+ primaryYAxis: linearAxis,
8245
+ secondaryYAxis: linearAxis,
8246
+ dualChartType: {
8247
+ primary: 'column',
8248
+ secondary: 'line'
8249
+ },
8250
+ crosshairRect
8251
+ },
7197
8252
  pie: {
7198
8253
  ...baseConfig
7199
8254
  },
@@ -7516,6 +8571,17 @@
7516
8571
  },
7517
8572
  crosshairLine
7518
8573
  },
8574
+ dualAxis: {
8575
+ ...baseConfig,
8576
+ xAxis: bandAxis,
8577
+ primaryYAxis: linearAxis,
8578
+ secondaryYAxis: linearAxis,
8579
+ dualChartType: {
8580
+ primary: 'column',
8581
+ secondary: 'line'
8582
+ },
8583
+ crosshairRect
8584
+ },
7519
8585
  pie: {
7520
8586
  ...baseConfig
7521
8587
  },
@@ -7581,6 +8647,7 @@
7581
8647
  registerAreaPercent();
7582
8648
  registerAreaRange();
7583
8649
  registerScatter();
8650
+ registerDualAxis();
7584
8651
  registerPie();
7585
8652
  registerDonut();
7586
8653
  registerRose();
@@ -10903,6 +11970,26 @@
10903
11970
  'funnel',
10904
11971
  'heatmap'
10905
11972
  ]);
11973
+ const zDualChartType = schemas_object({
11974
+ primary: schemas_enum([
11975
+ 'line',
11976
+ 'column',
11977
+ 'columnPercent',
11978
+ 'columnParallel',
11979
+ 'area',
11980
+ 'areaPercent',
11981
+ 'scatter'
11982
+ ]).default('column'),
11983
+ secondary: schemas_enum([
11984
+ 'line',
11985
+ 'column',
11986
+ 'columnPercent',
11987
+ 'columnParallel',
11988
+ 'area',
11989
+ 'areaPercent',
11990
+ 'scatter'
11991
+ ]).default('line')
11992
+ });
10906
11993
  const zDatum = record(schemas_string().or(schemas_number()), any());
10907
11994
  const zDataset = schemas_array(zDatum);
10908
11995
  const zDimension = schemas_object({
@@ -10968,6 +12055,14 @@
10968
12055
  });
10969
12056
  const zMeasures = schemas_array(zMeasure);
10970
12057
  const zMeasureTree = schemas_array(zMeasureGroup.or(zMeasure));
12058
+ const zDualMeasure = schemas_object({
12059
+ id: schemas_string(),
12060
+ primaryMeasures: schemas_array(zMeasure).or(zMeasure).optional(),
12061
+ primaryAlias: schemas_string().optional(),
12062
+ secondaryMeasures: schemas_array(zMeasure).or(zMeasure).optional(),
12063
+ secondaryAlias: schemas_string().optional()
12064
+ });
12065
+ const zDualMeasures = schemas_array(zDualMeasure);
10971
12066
  const zFoldInfo = schemas_object({
10972
12067
  foldMap: record(schemas_string(), schemas_string().or(schemas_undefined())),
10973
12068
  measureId: schemas_string(),
@@ -10982,7 +12077,9 @@
10982
12077
  });
10983
12078
  const zDatasetReshapeInfo = schemas_array(schemas_object({
10984
12079
  id: schemas_string(),
12080
+ index: schemas_number(),
10985
12081
  foldInfo: zFoldInfo,
12082
+ foldInfoList: schemas_array(zFoldInfo).optional(),
10986
12083
  unfoldInfo: zUnfoldInfo
10987
12084
  }));
10988
12085
  const zEncoding = schemas_array(schemas_object({
@@ -11262,7 +12359,12 @@
11262
12359
  label: zLabel.optional(),
11263
12360
  color: zColor.optional(),
11264
12361
  tooltip: zTooltip.optional(),
11265
- legend: zLegend.optional()
12362
+ legend: zLegend.optional(),
12363
+ dualChartType: schemas_array(zDualChartType).or(zDualChartType).optional(),
12364
+ primaryYAxis: schemas_array(zYLinearAxis).or(zYLinearAxis).optional(),
12365
+ secondaryYAxis: schemas_array(zYLinearAxis).or(zYLinearAxis).optional(),
12366
+ xAxis: zXBandAxis.optional(),
12367
+ crosshairRect: zCrosshairRect.optional()
11266
12368
  });
11267
12369
  const zScatterConfig = schemas_object({
11268
12370
  backgroundColor: zBackgroundColor.optional(),
@@ -11306,8 +12408,8 @@
11306
12408
  area: zAreaConfig.optional(),
11307
12409
  areaPercent: zAreaPercentConfig.optional(),
11308
12410
  areaRange: zAreaRangeConfig.optional(),
11309
- dualAxis: zDualAxisConfig.optional(),
11310
12411
  scatter: zScatterConfig.optional(),
12412
+ dualAxis: zDualAxisConfig.optional(),
11311
12413
  rose: zRoseConfig.optional(),
11312
12414
  roseParallel: zRoseParallelConfig.optional(),
11313
12415
  pie: zPieConfig.optional(),
@@ -11960,6 +13062,35 @@
11960
13062
  annotationArea: schemas_array(zAnnotationArea).or(zAnnotationArea).optional(),
11961
13063
  locale: zLocale.optional()
11962
13064
  });
13065
+ const zDualAxis = schemas_object({
13066
+ chartType: literal('dualAxis'),
13067
+ dataset: zDataset.optional(),
13068
+ dimensions: zDimensions.optional(),
13069
+ measures: zMeasureTree.optional(),
13070
+ dualMeasures: zDualMeasures.optional(),
13071
+ dualChartType: schemas_array(zDualChartType).or(zDualChartType).optional(),
13072
+ primaryYAxis: schemas_array(zYLinearAxis).or(zYLinearAxis).optional(),
13073
+ secondaryYAxis: schemas_array(zYLinearAxis).or(zYLinearAxis).optional(),
13074
+ xAxis: zXBandAxis.optional(),
13075
+ backgroundColor: zBackgroundColor.optional(),
13076
+ color: zColor.optional(),
13077
+ label: zLabel.optional(),
13078
+ legend: zLegend.optional(),
13079
+ tooltip: zTooltip.optional(),
13080
+ crosshairRect: zCrosshairRect.optional(),
13081
+ sort: zSort.optional(),
13082
+ sortLegend: zSortLegend.optional(),
13083
+ theme: zTheme.optional(),
13084
+ barStyle: schemas_array(zBarStyle).or(zBarStyle).optional(),
13085
+ pointStyle: schemas_array(zPointStyle).or(zPointStyle).optional(),
13086
+ lineStyle: schemas_array(zLineStyle).or(zLineStyle).optional(),
13087
+ areaStyle: schemas_array(zAreaStyle).or(zAreaStyle).optional(),
13088
+ annotationPoint: schemas_array(zAnnotationPoint).or(zAnnotationPoint).optional(),
13089
+ annotationVerticalLine: schemas_array(zAnnotationVerticalLine).or(zAnnotationVerticalLine).optional(),
13090
+ annotationHorizontalLine: schemas_array(zAnnotationHorizontalLine).or(zAnnotationHorizontalLine).optional(),
13091
+ annotationArea: schemas_array(zAnnotationArea).or(zAnnotationArea).optional(),
13092
+ locale: zLocale.optional()
13093
+ });
11963
13094
  const zRose = schemas_object({
11964
13095
  chartType: literal('rose'),
11965
13096
  dataset: zDataset.optional(),
@@ -12065,6 +13196,7 @@
12065
13196
  zAreaPercent,
12066
13197
  zAreaRange,
12067
13198
  zScatter,
13199
+ zDualAxis,
12068
13200
  zPie,
12069
13201
  zDonut,
12070
13202
  zRose,