@visactor/vseed 0.0.6 → 0.0.7

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.
package/dist/index.cjs CHANGED
@@ -24,9 +24,10 @@ var __webpack_require__ = {};
24
24
  var __webpack_exports__ = {};
25
25
  __webpack_require__.r(__webpack_exports__);
26
26
  __webpack_require__.d(__webpack_exports__, {
27
- columnPercentSpecPipeline: ()=>columnPercentSpecPipeline,
27
+ registerBar: ()=>registerBar,
28
28
  isVChart: ()=>isVChart,
29
- registerAll: ()=>all_registerAll,
29
+ columnPercentSpecPipeline: ()=>columnPercentSpecPipeline,
30
+ pieAdvancedPipeline: ()=>pieAdvancedPipeline,
30
31
  execPipeline: ()=>execPipeline,
31
32
  areaSpecPipeline: ()=>areaSpecPipeline,
32
33
  registerCustomTheme: ()=>registerCustomTheme,
@@ -48,8 +49,9 @@ __webpack_require__.d(__webpack_exports__, {
48
49
  zDimension: ()=>zDimension,
49
50
  lightTheme: ()=>lightTheme,
50
51
  registerColumnParallel: ()=>registerColumnParallel,
52
+ isPivotChart: ()=>isPivotChart,
51
53
  zCustomTheme: ()=>zCustomTheme,
52
- dataReshapeFor1D1M: ()=>dataReshapeFor1D1M_dataReshapeFor1D1M,
54
+ dataReshapeFor1D1M: ()=>dataReshapeFor1D1M,
53
55
  registerArea: ()=>registerArea,
54
56
  zDataset: ()=>zDataset,
55
57
  barPercentAdvancedPipeline: ()=>barPercentAdvancedPipeline,
@@ -76,6 +78,7 @@ __webpack_require__.d(__webpack_exports__, {
76
78
  barParallelAdvancedPipeline: ()=>barParallelAdvancedPipeline,
77
79
  barPercentSpecPipeline: ()=>barPercentSpecPipeline,
78
80
  lineAdvancedPipeline: ()=>lineAdvancedPipeline,
81
+ pieSpecPipeline: ()=>pieSpecPipeline,
79
82
  zTooltip: ()=>zTooltip,
80
83
  barSpecPipeline: ()=>barSpecPipeline,
81
84
  lineSpecPipeline: ()=>lineSpecPipeline,
@@ -85,15 +88,15 @@ __webpack_require__.d(__webpack_exports__, {
85
88
  areaPercentSpecPipeline: ()=>areaPercentSpecPipeline,
86
89
  Builder: ()=>Builder,
87
90
  barParallelSpecPipeline: ()=>barParallelSpecPipeline,
88
- registerBar: ()=>registerBar
91
+ registerAll: ()=>all_registerAll
89
92
  });
90
- const constant_FoldMeasureName = '__MeaName__';
91
- const constant_FoldMeasureValue = '__MeaValue__';
92
- const constant_FoldMeasureId = '__MeaId__';
93
- const constant_UnfoldDimensionGroup = '__DimGroup__';
93
+ const FoldMeasureName = '__MeaName__';
94
+ const FoldMeasureValue = '__MeaValue__';
95
+ const FoldMeasureId = '__MeaId__';
96
+ const UnfoldDimensionGroup = '__DimGroup__';
94
97
  const Separator = '-';
95
98
  const external_remeda_namespaceObject = require("remeda");
96
- const unfoldDimensions = (dataset, dimensions, measures, unfoldStartIndex = 0, foldGroupName = constant_UnfoldDimensionGroup, dimensionsSeparator = Separator)=>{
99
+ const unfoldDimensions = (dataset, dimensions, measures, unfoldStartIndex = 0, foldGroupName = UnfoldDimensionGroup, dimensionsSeparator = Separator)=>{
97
100
  if (unfoldStartIndex < 0 || unfoldStartIndex >= dimensions.length) throw new Error('unfoldStartIndex is out of range');
98
101
  const dimensionsToBeUnfolded = dimensions.slice(unfoldStartIndex);
99
102
  const unfoldInfo = {
@@ -121,7 +124,7 @@ const unfoldDimensions = (dataset, dimensions, measures, unfoldStartIndex = 0, f
121
124
  };
122
125
  };
123
126
  const generateDimGroupName = (dimensionsToBeGrouped, datum, dimensionsSeparator)=>dimensionsToBeGrouped.map((dim)=>String(datum[dim.id])).join(dimensionsSeparator);
124
- const foldMeasures = (dataset, measures, measureId = constant_FoldMeasureId, measureName = constant_FoldMeasureName, measureValue = constant_FoldMeasureValue)=>{
127
+ const foldMeasures = (dataset, measures, measureId = FoldMeasureId, measureName = FoldMeasureName, measureValue = FoldMeasureValue)=>{
125
128
  const foldInfo = {
126
129
  measureId,
127
130
  measureName,
@@ -161,7 +164,7 @@ const emptyReshapeResult = {
161
164
  }
162
165
  };
163
166
  const dataReshapeFor2D1M = (dataset, dimensions, measures, options)=>{
164
- const { foldMeasureId = constant_FoldMeasureId, foldMeasureName = constant_FoldMeasureName, foldMeasureValue = constant_FoldMeasureValue, unfoldDimensionGroup = constant_UnfoldDimensionGroup } = options || {};
167
+ const { foldMeasureId = FoldMeasureId, foldMeasureName = FoldMeasureName, foldMeasureValue = FoldMeasureValue, unfoldDimensionGroup = UnfoldDimensionGroup } = options || {};
165
168
  if (0 === dimensions.length && 0 === measures.length) return emptyReshapeResult;
166
169
  const { dataset: foldedDataset, foldInfo } = foldMeasures(dataset, measures, foldMeasureId, foldMeasureName, foldMeasureValue);
167
170
  if (0 === dimensions.length) {
@@ -222,8 +225,8 @@ const dataReshapeFor1D1M_emptyReshapeResult = {
222
225
  colorItems: []
223
226
  }
224
227
  };
225
- const dataReshapeFor1D1M_dataReshapeFor1D1M = (dataset, dimensions, measures, options)=>{
226
- const { foldMeasureId = constant_FoldMeasureId, foldMeasureName = constant_FoldMeasureName, foldMeasureValue = constant_FoldMeasureValue, unfoldDimensionGroup = constant_UnfoldDimensionGroup } = options || {};
228
+ const dataReshapeFor1D1M = (dataset, dimensions, measures, options)=>{
229
+ const { foldMeasureId = FoldMeasureId, foldMeasureName = FoldMeasureName, foldMeasureValue = FoldMeasureValue, unfoldDimensionGroup = UnfoldDimensionGroup } = options || {};
227
230
  if (0 === dimensions.length && 0 === measures.length) return dataReshapeFor1D1M_emptyReshapeResult;
228
231
  const { dataset: foldedDataset, foldInfo } = foldMeasures(dataset, measures, foldMeasureId, foldMeasureName, foldMeasureValue);
229
232
  if (0 === dimensions.length) {
@@ -290,6 +293,67 @@ const reshapeTo2D1M = (advancedVSeed, context)=>{
290
293
  measures
291
294
  };
292
295
  };
296
+ const reshapeTo1D1M = (advancedVSeed, context)=>{
297
+ const result = {
298
+ ...advancedVSeed
299
+ };
300
+ const { vseed } = context;
301
+ const { dataset } = vseed;
302
+ const { dimensions, measures } = advancedVSeed;
303
+ if (!measures || !dimensions || !dataset) return result;
304
+ if (0 === measures.length) throw new Error('measures can not be empty');
305
+ const { dataset: newDatasets, foldInfo, unfoldInfo } = dataReshapeFor1D1M(dataset, dimensions, measures);
306
+ return {
307
+ ...result,
308
+ dataset: newDatasets,
309
+ datasetReshapeInfo: [
310
+ {
311
+ id: '1D1M',
312
+ foldInfo,
313
+ unfoldInfo
314
+ }
315
+ ]
316
+ };
317
+ };
318
+ const pivotReshapeTo1D1M = (advancedVSeed, context)=>{
319
+ const result = {
320
+ ...advancedVSeed
321
+ };
322
+ const { vseed } = context;
323
+ const { dataset } = vseed;
324
+ const { dimensions, measures } = advancedVSeed;
325
+ if (!measures || !dimensions) return result;
326
+ const measureGroups = [];
327
+ if (measures) measures.forEach((measure)=>{
328
+ if (measure.children && measure.children.length > 0) measureGroups.push(measure);
329
+ });
330
+ const newDatasets = [];
331
+ const datasetReshapeInfo = [];
332
+ measureGroups.forEach((measureGroup)=>{
333
+ const measures = measureGroup.children;
334
+ if (!measures) return;
335
+ const commonDimensions = dimensions.filter((dim)=>'dimension' === dim.location);
336
+ const groupId = measureGroup.id;
337
+ const { dataset: newSubDataset, foldInfo, unfoldInfo } = dataReshapeFor1D1M(dataset, commonDimensions, measures, {
338
+ foldMeasureId: FoldMeasureId,
339
+ foldMeasureName: FoldMeasureName,
340
+ foldMeasureValue: FoldMeasureValue + groupId,
341
+ unfoldDimensionGroup: UnfoldDimensionGroup
342
+ });
343
+ const reshapeInfo = {
344
+ id: groupId,
345
+ foldInfo,
346
+ unfoldInfo
347
+ };
348
+ newDatasets.push(newSubDataset);
349
+ datasetReshapeInfo.push(reshapeInfo);
350
+ });
351
+ return {
352
+ ...result,
353
+ dataset: newDatasets,
354
+ datasetReshapeInfo: datasetReshapeInfo
355
+ };
356
+ };
293
357
  const pivotReshapeTo2D1M = (advancedVSeed, context)=>{
294
358
  const result = {
295
359
  ...advancedVSeed
@@ -302,17 +366,18 @@ const pivotReshapeTo2D1M = (advancedVSeed, context)=>{
302
366
  if (measures) measures.forEach((measure)=>{
303
367
  if (measure.children && measure.children.length > 0) measureGroups.push(measure);
304
368
  });
369
+ const commonDimensions = dimensions.filter((dim)=>'dimension' === dim.location);
305
370
  const newDatasets = [];
306
371
  const datasetReshapeInfo = [];
307
372
  measureGroups.forEach((measureGroup)=>{
308
373
  const measures = measureGroup.children;
309
374
  if (!measures) return;
310
375
  const groupId = measureGroup.id;
311
- const { dataset: newSubDataset, foldInfo, unfoldInfo } = dataReshapeFor2D1M(dataset, dimensions, measures, {
312
- foldMeasureId: constant_FoldMeasureId + groupId,
313
- foldMeasureName: constant_FoldMeasureName + groupId,
314
- foldMeasureValue: constant_FoldMeasureValue + groupId,
315
- unfoldDimensionGroup: constant_UnfoldDimensionGroup + groupId
376
+ const { dataset: newSubDataset, foldInfo, unfoldInfo } = dataReshapeFor2D1M(dataset, commonDimensions, measures, {
377
+ foldMeasureId: FoldMeasureId + groupId,
378
+ foldMeasureName: FoldMeasureName + groupId,
379
+ foldMeasureValue: FoldMeasureValue + groupId,
380
+ unfoldDimensionGroup: UnfoldDimensionGroup + groupId
316
381
  });
317
382
  const reshapeInfo = {
318
383
  id: groupId,
@@ -400,6 +465,41 @@ const encodingYX = (advancedVSeed)=>{
400
465
  encoding
401
466
  };
402
467
  };
468
+ const encodingPolar = (advancedVSeed)=>{
469
+ const result = {
470
+ ...advancedVSeed
471
+ };
472
+ const { datasetReshapeInfo, dimensions } = advancedVSeed;
473
+ if (!datasetReshapeInfo || !dimensions) return result;
474
+ const encoding = datasetReshapeInfo.reduce((prev, cur)=>{
475
+ const { foldInfo, unfoldInfo } = cur;
476
+ const radius = [
477
+ foldInfo.measureValue
478
+ ];
479
+ const angle = [
480
+ unfoldInfo.groupName
481
+ ];
482
+ const group = [
483
+ unfoldInfo.groupName
484
+ ];
485
+ const color = [
486
+ unfoldInfo.groupName
487
+ ];
488
+ return [
489
+ ...prev,
490
+ {
491
+ angle,
492
+ radius,
493
+ group,
494
+ color
495
+ }
496
+ ];
497
+ }, []);
498
+ return {
499
+ ...result,
500
+ encoding
501
+ };
502
+ };
403
503
  const initAdvancedVSeed = (advancedVSeed, context)=>{
404
504
  const { vseed } = context;
405
505
  const { chartType = 'table' } = vseed;
@@ -408,6 +508,17 @@ const initAdvancedVSeed = (advancedVSeed, context)=>{
408
508
  chartType
409
509
  };
410
510
  };
511
+ const isVTable = (chartType)=>[
512
+ 'table',
513
+ 'pivotTable'
514
+ ].includes(chartType);
515
+ const isVChart = (chartType)=>!isVTable(chartType);
516
+ const isPivotChart = (vseed)=>{
517
+ const { measures, dimensions } = vseed;
518
+ const hasRowOrColumnDimension = dimensions && dimensions.some((dimension)=>'rowDimension' === dimension.location || 'columnDimension' === dimension.location);
519
+ const hasMeasureGroup = measures && measures.find((measure)=>measure && measure.children);
520
+ return hasRowOrColumnDimension || hasMeasureGroup;
521
+ };
411
522
  const autoMeasures = (advancedVSeed, context)=>{
412
523
  const result = {
413
524
  ...advancedVSeed
@@ -416,6 +527,7 @@ const autoMeasures = (advancedVSeed, context)=>{
416
527
  const { measures, dataset } = vseed;
417
528
  if (!dataset) throw new Error('dataset is required');
418
529
  if (0 === dataset.length) return result;
530
+ if (isPivotChart(vseed)) return autoMeasureGroup(advancedVSeed, context);
419
531
  if (measures) {
420
532
  result.measures = measures;
421
533
  return result;
@@ -435,6 +547,49 @@ const autoMeasures = (advancedVSeed, context)=>{
435
547
  }));
436
548
  return result;
437
549
  };
550
+ const autoMeasureGroup = (advancedVSeed, context)=>{
551
+ const { vseed } = context;
552
+ const { measures } = vseed;
553
+ const hasMeasureGroup = measures?.some((measure)=>measure.children);
554
+ if (!measures) return advancedVSeed;
555
+ if (!hasMeasureGroup) {
556
+ const newMeasures = [
557
+ {
558
+ id: 'measureGroup',
559
+ alias: 'measureGroup',
560
+ children: measures
561
+ }
562
+ ];
563
+ return {
564
+ ...advancedVSeed,
565
+ measures: newMeasures
566
+ };
567
+ }
568
+ let currentGroup = createEmptyMeasureGroup();
569
+ const measureGroups = [];
570
+ for (const measure of measures)if ('children' in measure) {
571
+ if (currentGroup.children?.length) {
572
+ currentGroup.id = currentGroup.children.map((item)=>item.id).join('-');
573
+ currentGroup.alias = currentGroup.children.map((item)=>item.alias).join('-');
574
+ measureGroups.push(currentGroup);
575
+ currentGroup = createEmptyMeasureGroup();
576
+ }
577
+ measureGroups.push(measure);
578
+ } else currentGroup.children?.push(measure);
579
+ if (currentGroup.children?.length) {
580
+ currentGroup.id = currentGroup.children.map((item)=>item.id).join('-');
581
+ currentGroup.alias = currentGroup.children.map((item)=>item.alias).join('-');
582
+ measureGroups.push(currentGroup);
583
+ currentGroup = createEmptyMeasureGroup();
584
+ }
585
+ advancedVSeed.measures = measureGroups;
586
+ return advancedVSeed;
587
+ };
588
+ const createEmptyMeasureGroup = ()=>({
589
+ id: '',
590
+ alias: '',
591
+ children: []
592
+ });
438
593
  const autoDimensions = (advancedVSeed, context)=>{
439
594
  const result = {
440
595
  ...advancedVSeed
@@ -505,8 +660,8 @@ const execPipeline = (pipeline, context, initialValue = {})=>{
505
660
  };
506
661
  const pivotAdapter = (pipeline, pivotPipeline)=>(advancedVSeed, context)=>{
507
662
  const { vseed } = context;
508
- const { measures } = vseed;
509
- if (measures && measures.find((measure)=>measure && measure.children)) return execPipeline(pivotPipeline, context, advancedVSeed);
663
+ const usePivotChart = isPivotChart(vseed);
664
+ if (usePivotChart) return execPipeline(pivotPipeline, context, advancedVSeed);
510
665
  return execPipeline(pipeline, context, advancedVSeed);
511
666
  };
512
667
  const lineAdvancedPipeline = [
@@ -626,6 +781,19 @@ const areaPercentAdvancedPipeline = [
626
781
  vchartBaseConfig,
627
782
  vchartTheme
628
783
  ];
784
+ const pieAdvancedPipeline = [
785
+ initAdvancedVSeed,
786
+ autoMeasures,
787
+ autoDimensions,
788
+ pivotAdapter([
789
+ reshapeTo1D1M
790
+ ], [
791
+ pivotReshapeTo1D1M
792
+ ]),
793
+ encodingPolar,
794
+ vchartBaseConfig,
795
+ vchartTheme
796
+ ];
629
797
  const dataset_dataset = (spec, context)=>{
630
798
  const { advancedVSeed } = context;
631
799
  return {
@@ -755,6 +923,22 @@ const initColumnParallel = (spec, context)=>{
755
923
  result.padding = 0;
756
924
  return result;
757
925
  };
926
+ const initPie = (spec, context)=>{
927
+ const result = {
928
+ ...spec
929
+ };
930
+ const { advancedVSeed } = context;
931
+ const { encoding } = advancedVSeed;
932
+ if (!encoding[0].angle || !encoding[0].radius || !encoding[0].group) return result;
933
+ result.type = 'pie';
934
+ result.outerRadius = 0.8;
935
+ result.innerRadius = 0;
936
+ result.valueField = encoding[0].radius[0];
937
+ result.categoryField = encoding[0].angle[0];
938
+ result.seriesField = encoding[0].group[0];
939
+ result.padding = 0;
940
+ return result;
941
+ };
758
942
  const initPivot = (spec)=>{
759
943
  const result = {
760
944
  ...spec
@@ -920,11 +1104,11 @@ const pivotLegend = (spec, context)=>{
920
1104
  const { legend, color } = baseConfig;
921
1105
  const { enable } = legend;
922
1106
  const { colorScheme } = color;
923
- result.legends = {
1107
+ const legends = {
924
1108
  visible: enable,
925
1109
  alignSelf: 'end',
926
1110
  type: 'discrete',
927
- position: 'start',
1111
+ position: 'middle',
928
1112
  data: colorItems.map((d, index)=>({
929
1113
  label: d,
930
1114
  shape: {
@@ -932,9 +1116,29 @@ const pivotLegend = (spec, context)=>{
932
1116
  fill: colorScheme[index]
933
1117
  }
934
1118
  })),
1119
+ item: {
1120
+ background: {
1121
+ visible: true,
1122
+ state: {
1123
+ selectedHover: {
1124
+ fill: '#000000',
1125
+ fillOpacity: 0.05
1126
+ }
1127
+ }
1128
+ },
1129
+ label: {
1130
+ style: {
1131
+ fontSize: 12,
1132
+ fill: '#6F6F6F'
1133
+ }
1134
+ }
1135
+ },
935
1136
  orient: 'bottom'
936
1137
  };
937
- return result;
1138
+ return {
1139
+ ...result,
1140
+ legends
1141
+ };
938
1142
  };
939
1143
  const color_color = (spec, context)=>{
940
1144
  const result = {
@@ -956,9 +1160,9 @@ const color_color = (spec, context)=>{
956
1160
  return result;
957
1161
  };
958
1162
  const pivotAdapter_pivotAdapter = (pipeline, pivotPipeline)=>(spec, context)=>{
959
- const { advancedVSeed } = context;
960
- const { measures } = advancedVSeed;
961
- if (measures && measures.find((measure)=>measure && measure.children)) return execPipeline(pivotPipeline, context, spec);
1163
+ const { vseed } = context;
1164
+ const usePivotChart = isPivotChart(vseed);
1165
+ if (usePivotChart) return execPipeline(pivotPipeline, context, spec);
962
1166
  return execPipeline(pipeline, context, spec);
963
1167
  };
964
1168
  const pivotIndicators = (chartPipeline)=>(spec, context)=>{
@@ -1030,6 +1234,154 @@ const pivotIndicators_pivotIndicatorsAsCol = (spec)=>{
1030
1234
  indicatorsAsCol: true
1031
1235
  };
1032
1236
  };
1237
+ const pivotGridStyle = (spec)=>{
1238
+ const result = {
1239
+ ...spec
1240
+ };
1241
+ const transparent = 'rgba(0,0,0,0)';
1242
+ return {
1243
+ ...result,
1244
+ theme: {
1245
+ underlayBackgroundColor: transparent,
1246
+ bodyStyle: {
1247
+ borderColor: 'rgba(0,4,20,0.2)',
1248
+ borderLineWidth: [
1249
+ 0,
1250
+ 0,
1251
+ 2,
1252
+ 0
1253
+ ],
1254
+ bgColor: transparent,
1255
+ padding: [
1256
+ 0,
1257
+ 0,
1258
+ 1,
1259
+ 0
1260
+ ]
1261
+ },
1262
+ headerStyle: {
1263
+ borderColor: 'rgba(0,4,20,0.2)',
1264
+ fontSize: 12,
1265
+ color: '#333333',
1266
+ textAlign: 'center',
1267
+ borderLineWidth: 0,
1268
+ bgColor: transparent,
1269
+ hover: {
1270
+ cellBgColor: 'rgba(178,186,207, 0.2)'
1271
+ }
1272
+ },
1273
+ rowHeaderStyle: {
1274
+ borderColor: 'rgba(0,4,20,0.2)',
1275
+ fontSize: 12,
1276
+ color: '#333333',
1277
+ borderLineWidth: 0,
1278
+ bgColor: transparent,
1279
+ hover: {
1280
+ cellBgColor: 'rgba(178,186,207, 0.2)'
1281
+ }
1282
+ },
1283
+ cornerHeaderStyle: {
1284
+ borderColor: 'rgba(0,4,20,0.2)',
1285
+ textAlign: 'center',
1286
+ fontSize: 12,
1287
+ color: '#333333',
1288
+ fontWeight: 'bold',
1289
+ borderLineWidth: [
1290
+ 0,
1291
+ 0,
1292
+ 0,
1293
+ 0
1294
+ ],
1295
+ bgColor: transparent,
1296
+ hover: {
1297
+ cellBgColor: ''
1298
+ }
1299
+ },
1300
+ cornerRightTopCellStyle: {
1301
+ borderColor: 'rgba(0,4,20,0.2)',
1302
+ borderLineWidth: 0,
1303
+ bgColor: transparent,
1304
+ hover: {
1305
+ cellBgColor: ''
1306
+ }
1307
+ },
1308
+ cornerLeftBottomCellStyle: {
1309
+ borderColor: 'rgba(0,4,20,0.2)',
1310
+ borderLineWidth: 0,
1311
+ bgColor: transparent,
1312
+ hover: {
1313
+ cellBgColor: ''
1314
+ }
1315
+ },
1316
+ cornerRightBottomCellStyle: {
1317
+ borderColor: 'rgba(0,4,20,0.2)',
1318
+ borderLineWidth: 0,
1319
+ bgColor: transparent,
1320
+ hover: {
1321
+ cellBgColor: ''
1322
+ }
1323
+ },
1324
+ rightFrozenStyle: {
1325
+ borderColor: 'rgba(0,4,20,0.2)',
1326
+ borderLineWidth: 0,
1327
+ bgColor: transparent,
1328
+ hover: {
1329
+ cellBgColor: 'rgba(178,186,207, 0.2)'
1330
+ }
1331
+ },
1332
+ bottomFrozenStyle: {
1333
+ borderColor: 'rgba(0,4,20,0.2)',
1334
+ borderLineWidth: 0,
1335
+ bgColor: transparent,
1336
+ hover: {
1337
+ cellBgColor: 'rgba(178,186,207, 0.2)'
1338
+ }
1339
+ },
1340
+ selectionStyle: {
1341
+ cellBgColor: '',
1342
+ cellBorderColor: ''
1343
+ },
1344
+ frameStyle: {
1345
+ borderLineWidth: 0,
1346
+ bgColor: transparent
1347
+ }
1348
+ }
1349
+ };
1350
+ };
1351
+ const pivotColumnDimensions = (spec, context)=>{
1352
+ const result = {
1353
+ ...spec
1354
+ };
1355
+ const { advancedVSeed } = context;
1356
+ const { dimensions } = advancedVSeed;
1357
+ if (!dimensions) return result;
1358
+ const columnDimensions = dimensions.filter((dim)=>'columnDimension' === dim.location);
1359
+ const columns = columnDimensions.map((dim)=>({
1360
+ dimensionKey: dim.id,
1361
+ title: dim.alias || dim.id
1362
+ }));
1363
+ return {
1364
+ ...result,
1365
+ columns: columns
1366
+ };
1367
+ };
1368
+ const pivotRowDimensions = (spec, context)=>{
1369
+ const result = {
1370
+ ...spec
1371
+ };
1372
+ const { advancedVSeed } = context;
1373
+ const { dimensions } = advancedVSeed;
1374
+ if (!dimensions) return result;
1375
+ const rowDimensions = dimensions.filter((dim)=>'rowDimension' === dim.location);
1376
+ const rows = rowDimensions.map((dim)=>({
1377
+ dimensionKey: dim.id,
1378
+ title: dim.alias || dim.id
1379
+ }));
1380
+ return {
1381
+ ...result,
1382
+ rows: rows
1383
+ };
1384
+ };
1033
1385
  const line = [
1034
1386
  initLine,
1035
1387
  color_color,
@@ -1043,6 +1395,7 @@ const line = [
1043
1395
  ];
1044
1396
  const pivotLine = [
1045
1397
  initPivot,
1398
+ pivotGridStyle,
1046
1399
  pivotIndicators_pivotIndicatorsAsRow,
1047
1400
  datasetPivot,
1048
1401
  pivotIndicators([
@@ -1055,6 +1408,8 @@ const pivotLine = [
1055
1408
  label_label,
1056
1409
  tooltip_tooltip
1057
1410
  ]),
1411
+ pivotRowDimensions,
1412
+ pivotColumnDimensions,
1058
1413
  pivotLegend
1059
1414
  ];
1060
1415
  const lineSpecPipeline = [
@@ -1073,6 +1428,7 @@ const column = [
1073
1428
  ];
1074
1429
  const pivotColumn = [
1075
1430
  initPivot,
1431
+ pivotGridStyle,
1076
1432
  pivotIndicators_pivotIndicatorsAsRow,
1077
1433
  datasetPivot,
1078
1434
  pivotIndicators([
@@ -1085,6 +1441,8 @@ const pivotColumn = [
1085
1441
  label_label,
1086
1442
  tooltip_tooltip
1087
1443
  ]),
1444
+ pivotRowDimensions,
1445
+ pivotColumnDimensions,
1088
1446
  pivotLegend
1089
1447
  ];
1090
1448
  const columnSpecPipeline = [
@@ -1103,6 +1461,7 @@ const columnParallel = [
1103
1461
  ];
1104
1462
  const pivotColumnParallel = [
1105
1463
  initPivot,
1464
+ pivotGridStyle,
1106
1465
  pivotIndicators_pivotIndicatorsAsRow,
1107
1466
  datasetPivot,
1108
1467
  pivotIndicators([
@@ -1115,6 +1474,8 @@ const pivotColumnParallel = [
1115
1474
  label_label,
1116
1475
  tooltip_tooltip
1117
1476
  ]),
1477
+ pivotRowDimensions,
1478
+ pivotColumnDimensions,
1118
1479
  pivotLegend
1119
1480
  ];
1120
1481
  const columnParallelSpecPipeline = [
@@ -1134,6 +1495,7 @@ const columnPercent = [
1134
1495
  ];
1135
1496
  const pivotColumnPercent = [
1136
1497
  initPivot,
1498
+ pivotGridStyle,
1137
1499
  pivotIndicators_pivotIndicatorsAsRow,
1138
1500
  datasetPivot,
1139
1501
  pivotIndicators([
@@ -1147,6 +1509,8 @@ const pivotColumnPercent = [
1147
1509
  label_label,
1148
1510
  tooltip_tooltip
1149
1511
  ]),
1512
+ pivotRowDimensions,
1513
+ pivotColumnDimensions,
1150
1514
  pivotLegend
1151
1515
  ];
1152
1516
  const columnPercentSpecPipeline = [
@@ -1165,6 +1529,7 @@ const bar = [
1165
1529
  ];
1166
1530
  const pivotBar = [
1167
1531
  initPivot,
1532
+ pivotGridStyle,
1168
1533
  pivotIndicators_pivotIndicatorsAsCol,
1169
1534
  datasetPivot,
1170
1535
  pivotIndicators([
@@ -1177,6 +1542,8 @@ const pivotBar = [
1177
1542
  label_label,
1178
1543
  tooltip_tooltip
1179
1544
  ]),
1545
+ pivotRowDimensions,
1546
+ pivotColumnDimensions,
1180
1547
  pivotLegend
1181
1548
  ];
1182
1549
  const barSpecPipeline = [
@@ -1195,6 +1562,7 @@ const barParallel = [
1195
1562
  ];
1196
1563
  const pivotBarParallel = [
1197
1564
  initPivot,
1565
+ pivotGridStyle,
1198
1566
  pivotIndicators_pivotIndicatorsAsCol,
1199
1567
  datasetPivot,
1200
1568
  pivotIndicators([
@@ -1207,6 +1575,8 @@ const pivotBarParallel = [
1207
1575
  label_label,
1208
1576
  tooltip_tooltip
1209
1577
  ]),
1578
+ pivotRowDimensions,
1579
+ pivotColumnDimensions,
1210
1580
  pivotLegend
1211
1581
  ];
1212
1582
  const barParallelSpecPipeline = [
@@ -1226,6 +1596,7 @@ const barPercent = [
1226
1596
  ];
1227
1597
  const pivotBarPercent = [
1228
1598
  initPivot,
1599
+ pivotGridStyle,
1229
1600
  pivotIndicators_pivotIndicatorsAsCol,
1230
1601
  datasetPivot,
1231
1602
  pivotIndicators([
@@ -1239,6 +1610,8 @@ const pivotBarPercent = [
1239
1610
  label_label,
1240
1611
  tooltip_tooltip
1241
1612
  ]),
1613
+ pivotRowDimensions,
1614
+ pivotColumnDimensions,
1242
1615
  pivotLegend
1243
1616
  ];
1244
1617
  const barPercentSpecPipeline = [
@@ -1258,6 +1631,7 @@ const area_area = [
1258
1631
  ];
1259
1632
  const pivotArea = [
1260
1633
  initPivot,
1634
+ pivotGridStyle,
1261
1635
  pivotIndicators_pivotIndicatorsAsRow,
1262
1636
  datasetPivot,
1263
1637
  pivotIndicators([
@@ -1271,6 +1645,8 @@ const pivotArea = [
1271
1645
  label_label,
1272
1646
  tooltip_tooltip
1273
1647
  ]),
1648
+ pivotRowDimensions,
1649
+ pivotColumnDimensions,
1274
1650
  pivotLegend
1275
1651
  ];
1276
1652
  const areaSpecPipeline = [
@@ -1290,6 +1666,7 @@ const areaPercent = [
1290
1666
  ];
1291
1667
  const pivotAreaPercent = [
1292
1668
  initPivot,
1669
+ pivotGridStyle,
1293
1670
  pivotIndicators_pivotIndicatorsAsRow,
1294
1671
  datasetPivot,
1295
1672
  pivotIndicators([
@@ -1303,16 +1680,42 @@ const pivotAreaPercent = [
1303
1680
  label_label,
1304
1681
  tooltip_tooltip
1305
1682
  ]),
1683
+ pivotRowDimensions,
1684
+ pivotColumnDimensions,
1306
1685
  pivotLegend
1307
1686
  ];
1308
1687
  const areaPercentSpecPipeline = [
1309
1688
  pivotAdapter_pivotAdapter(areaPercent, pivotAreaPercent)
1310
1689
  ];
1311
- const isVTable = (chartType)=>[
1312
- 'table',
1313
- 'pivotTable'
1314
- ].includes(chartType);
1315
- const isVChart = (chartType)=>!isVTable(chartType);
1690
+ const pie = [
1691
+ initPie,
1692
+ color_color,
1693
+ background_backgroundColor,
1694
+ dataset_dataset,
1695
+ label_label,
1696
+ tooltip_tooltip,
1697
+ legend_legend
1698
+ ];
1699
+ const pivotPie = [
1700
+ initPivot,
1701
+ pivotGridStyle,
1702
+ pivotIndicators_pivotIndicatorsAsRow,
1703
+ datasetPivot,
1704
+ pivotIndicators([
1705
+ initPie,
1706
+ color_color,
1707
+ background_backgroundColor,
1708
+ datasetPivotPlaceholder,
1709
+ label_label,
1710
+ tooltip_tooltip
1711
+ ]),
1712
+ pivotRowDimensions,
1713
+ pivotColumnDimensions,
1714
+ pivotLegend
1715
+ ];
1716
+ const pieSpecPipeline = [
1717
+ pivotAdapter_pivotAdapter(pie, pivotPie)
1718
+ ];
1316
1719
  const buildAdvanced = (builder)=>{
1317
1720
  const { chartType } = builder.vseed;
1318
1721
  if (!chartType) throw new Error('chartType is nil in buildAdvanced');
@@ -1420,6 +1823,10 @@ const registerBarParallel = ()=>{
1420
1823
  Builder._advancedPipelineMap.barParallel = barParallelAdvancedPipeline;
1421
1824
  Builder._specPipelineMap.barParallel = barParallelSpecPipeline;
1422
1825
  };
1826
+ const registerPie = ()=>{
1827
+ Builder._advancedPipelineMap.pie = pieAdvancedPipeline;
1828
+ Builder._specPipelineMap.pie = pieSpecPipeline;
1829
+ };
1423
1830
  const lightTheme = ()=>({
1424
1831
  baseConfig: {
1425
1832
  vtable: {
@@ -1505,6 +1912,7 @@ const all_registerAll = ()=>{
1505
1912
  registerBarPercent();
1506
1913
  registerArea();
1507
1914
  registerAreaPercent();
1915
+ registerPie();
1508
1916
  registerLightTheme();
1509
1917
  registerDarkTheme();
1510
1918
  };
@@ -1651,11 +2059,14 @@ exports.dataReshapeFor1D1M = __webpack_exports__.dataReshapeFor1D1M;
1651
2059
  exports.dataReshapeFor2D1M = __webpack_exports__.dataReshapeFor2D1M;
1652
2060
  exports.execPipeline = __webpack_exports__.execPipeline;
1653
2061
  exports.foldMeasures = __webpack_exports__.foldMeasures;
2062
+ exports.isPivotChart = __webpack_exports__.isPivotChart;
1654
2063
  exports.isVChart = __webpack_exports__.isVChart;
1655
2064
  exports.isVTable = __webpack_exports__.isVTable;
1656
2065
  exports.lightTheme = __webpack_exports__.lightTheme;
1657
2066
  exports.lineAdvancedPipeline = __webpack_exports__.lineAdvancedPipeline;
1658
2067
  exports.lineSpecPipeline = __webpack_exports__.lineSpecPipeline;
2068
+ exports.pieAdvancedPipeline = __webpack_exports__.pieAdvancedPipeline;
2069
+ exports.pieSpecPipeline = __webpack_exports__.pieSpecPipeline;
1659
2070
  exports.registerAll = __webpack_exports__.registerAll;
1660
2071
  exports.registerArea = __webpack_exports__.registerArea;
1661
2072
  exports.registerAreaPercent = __webpack_exports__.registerAreaPercent;
@@ -1714,11 +2125,14 @@ for(var __webpack_i__ in __webpack_exports__)if (-1 === [
1714
2125
  "dataReshapeFor2D1M",
1715
2126
  "execPipeline",
1716
2127
  "foldMeasures",
2128
+ "isPivotChart",
1717
2129
  "isVChart",
1718
2130
  "isVTable",
1719
2131
  "lightTheme",
1720
2132
  "lineAdvancedPipeline",
1721
2133
  "lineSpecPipeline",
2134
+ "pieAdvancedPipeline",
2135
+ "pieSpecPipeline",
1722
2136
  "registerAll",
1723
2137
  "registerArea",
1724
2138
  "registerAreaPercent",