@visactor/vseed 0.0.5 → 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.
Files changed (57) hide show
  1. package/dist/builder/builder/build.d.ts +2 -2
  2. package/dist/builder/builder/buildSpec.d.ts +2 -2
  3. package/dist/builder/builder/builder.d.ts +8 -5
  4. package/dist/builder/register/chartType.d.ts +1 -0
  5. package/dist/dataReshape/constant.d.ts +1 -1
  6. package/dist/dataReshape/dataReshapeFor1D1M.d.ts +6 -1
  7. package/dist/dataReshape/dataReshapeFor2D1M.d.ts +6 -1
  8. package/dist/index.cjs +1174 -349
  9. package/dist/index.cjs.map +1 -1
  10. package/dist/index.js +920 -104
  11. package/dist/index.js.map +1 -1
  12. package/dist/pipeline/advanced/pipeline/index.d.ts +1 -0
  13. package/dist/pipeline/advanced/pipeline/line copy.d.ts +2 -0
  14. package/dist/pipeline/advanced/pipeline/pie.d.ts +2 -0
  15. package/dist/pipeline/advanced/pipes/encoding/encodingPolar.d.ts +2 -0
  16. package/dist/pipeline/advanced/pipes/encoding/{encodingCartesian.d.ts → encodingXY copy.d.ts } +0 -1
  17. package/dist/pipeline/advanced/pipes/encoding/encodingXY.d.ts +2 -0
  18. package/dist/pipeline/advanced/pipes/encoding/encodingYX.d.ts +2 -0
  19. package/dist/pipeline/advanced/pipes/encoding/index.d.ts +3 -1
  20. package/dist/pipeline/advanced/pipes/index.d.ts +1 -0
  21. package/dist/pipeline/advanced/pipes/pivot/index.d.ts +1 -0
  22. package/dist/pipeline/advanced/pipes/pivot/pivotAdapter.d.ts +2 -0
  23. package/dist/pipeline/advanced/pipes/reshape/index.d.ts +2 -0
  24. package/dist/pipeline/advanced/pipes/reshape/pivotReshapeTo1D1M.d.ts +8 -0
  25. package/dist/pipeline/advanced/pipes/reshape/pivotReshapeTo2D1M.d.ts +8 -0
  26. package/dist/pipeline/spec/pipeline/area.d.ts +1 -2
  27. package/dist/pipeline/spec/pipeline/areaPercent.d.ts +1 -2
  28. package/dist/pipeline/spec/pipeline/column.d.ts +1 -2
  29. package/dist/pipeline/spec/pipeline/index.d.ts +1 -0
  30. package/dist/pipeline/spec/pipeline/pie.d.ts +2 -0
  31. package/dist/pipeline/spec/pipes/dataset/datasetPivot.d.ts +3 -0
  32. package/dist/pipeline/spec/pipes/dataset/index.d.ts +1 -0
  33. package/dist/pipeline/spec/pipes/index.d.ts +1 -0
  34. package/dist/pipeline/spec/pipes/init/index.d.ts +2 -0
  35. package/dist/pipeline/spec/pipes/init/line copy.d.ts +2 -0
  36. package/dist/pipeline/spec/pipes/init/pie.d.ts +2 -0
  37. package/dist/pipeline/spec/pipes/init/pivot.d.ts +4 -0
  38. package/dist/pipeline/spec/pipes/legend/index.d.ts +1 -0
  39. package/dist/pipeline/spec/pipes/legend/pivotLegend.d.ts +2 -0
  40. package/dist/pipeline/spec/pipes/pivotChart/index.d.ts +5 -0
  41. package/dist/pipeline/spec/pipes/pivotChart/pivotAdapter.d.ts +2 -0
  42. package/dist/pipeline/spec/pipes/pivotChart/pivotColumnDimensions.d.ts +2 -0
  43. package/dist/pipeline/spec/pipes/pivotChart/pivotGridStyle copy.d.ts +2 -0
  44. package/dist/pipeline/spec/pipes/pivotChart/pivotGridStyle.d.ts +2 -0
  45. package/dist/pipeline/spec/pipes/pivotChart/pivotIndicators.d.ts +4 -0
  46. package/dist/pipeline/spec/pipes/pivotChart/pivotRowDimensions copy.d.ts +2 -0
  47. package/dist/pipeline/spec/pipes/pivotChart/pivotRowDimensions.d.ts +2 -0
  48. package/dist/pipeline/utils/chatType.d.ts +37 -1
  49. package/dist/pipeline/utils/index.d.ts +1 -1
  50. package/dist/types/advancedVSeed.d.ts +3 -2
  51. package/dist/types/builder/builder.d.ts +3 -3
  52. package/dist/types/builder/index.d.ts +1 -0
  53. package/dist/types/builder/spec.d.ts +3 -0
  54. package/dist/types/pipeline/spec/spec.d.ts +2 -2
  55. package/dist/types/properties/datasetReshapeInfo/datasetReshapeInfo.d.ts +3 -2
  56. package/dist/types/properties/datasetReshapeInfo/index.d.ts +1 -1
  57. package/package.json +1 -1
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,6 +49,7 @@ __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
54
  dataReshapeFor1D1M: ()=>dataReshapeFor1D1M,
53
55
  registerArea: ()=>registerArea,
@@ -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,40 +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
93
  const FoldMeasureName = '__MeaName__';
91
94
  const FoldMeasureValue = '__MeaValue__';
92
95
  const FoldMeasureId = '__MeaId__';
93
- const FoldDimensionGroup = '__DimGroup__';
96
+ const UnfoldDimensionGroup = '__DimGroup__';
94
97
  const Separator = '-';
95
- const foldMeasures = (dataset, measures, measureId = FoldMeasureId, measureName = FoldMeasureName, measureValue = FoldMeasureValue)=>{
96
- const foldInfo = {
97
- measureId,
98
- measureName,
99
- measureValue,
100
- foldMap: {}
101
- };
102
- const result = new Array(dataset.length * measures.length);
103
- let index = 0;
104
- for(let i = 0; i < dataset.length; i++)for(let j = 0; j < measures.length; j++){
105
- const datum = {
106
- ...dataset[i]
107
- };
108
- const measure = measures[j];
109
- const { id, alias } = measure;
110
- datum[measureId] = id;
111
- datum[measureName] = alias;
112
- datum[measureValue] = dataset[i][id];
113
- foldInfo.foldMap[id] = alias;
114
- result[index++] = datum;
115
- }
116
- return {
117
- dataset: result,
118
- foldInfo
119
- };
120
- };
121
- const unfoldDimensions = (dataset, dimensions, measures, unfoldStartIndex = 0, foldGroupName = FoldDimensionGroup, dimensionsSeparator = Separator)=>{
98
+ const external_remeda_namespaceObject = require("remeda");
99
+ const unfoldDimensions = (dataset, dimensions, measures, unfoldStartIndex = 0, foldGroupName = UnfoldDimensionGroup, dimensionsSeparator = Separator)=>{
122
100
  if (unfoldStartIndex < 0 || unfoldStartIndex >= dimensions.length) throw new Error('unfoldStartIndex is out of range');
123
101
  const dimensionsToBeUnfolded = dimensions.slice(unfoldStartIndex);
124
102
  const unfoldInfo = {
@@ -139,13 +117,39 @@ const unfoldDimensions = (dataset, dimensions, measures, unfoldStartIndex = 0, f
139
117
  datum[foldGroupName] = colorItem;
140
118
  colorItems.push(colorItem);
141
119
  }
142
- unfoldInfo.colorItems = colorItems;
120
+ unfoldInfo.colorItems = (0, external_remeda_namespaceObject.unique)(colorItems);
143
121
  return {
144
122
  dataset,
145
123
  unfoldInfo
146
124
  };
147
125
  };
148
126
  const generateDimGroupName = (dimensionsToBeGrouped, datum, dimensionsSeparator)=>dimensionsToBeGrouped.map((dim)=>String(datum[dim.id])).join(dimensionsSeparator);
127
+ const foldMeasures = (dataset, measures, measureId = FoldMeasureId, measureName = FoldMeasureName, measureValue = FoldMeasureValue)=>{
128
+ const foldInfo = {
129
+ measureId,
130
+ measureName,
131
+ measureValue,
132
+ foldMap: {}
133
+ };
134
+ const result = new Array(dataset.length * measures.length);
135
+ let index = 0;
136
+ for(let i = 0; i < dataset.length; i++)for(let j = 0; j < measures.length; j++){
137
+ const datum = {
138
+ ...dataset[i]
139
+ };
140
+ const measure = measures[j];
141
+ const { id, alias } = measure;
142
+ datum[measureId] = id;
143
+ datum[measureName] = alias;
144
+ datum[measureValue] = dataset[i][id];
145
+ foldInfo.foldMap[id] = alias;
146
+ result[index++] = datum;
147
+ }
148
+ return {
149
+ dataset: result,
150
+ foldInfo
151
+ };
152
+ };
149
153
  const emptyReshapeResult = {
150
154
  dataset: [],
151
155
  foldInfo: {
@@ -159,27 +163,85 @@ const emptyReshapeResult = {
159
163
  groupName: ''
160
164
  }
161
165
  };
162
- const dataReshapeFor2D1M = (dataset, dimensions, measures)=>{
166
+ const dataReshapeFor2D1M = (dataset, dimensions, measures, options)=>{
167
+ const { foldMeasureId = FoldMeasureId, foldMeasureName = FoldMeasureName, foldMeasureValue = FoldMeasureValue, unfoldDimensionGroup = UnfoldDimensionGroup } = options || {};
163
168
  if (0 === dimensions.length && 0 === measures.length) return emptyReshapeResult;
164
- const { dataset: foldedDataset, foldInfo } = foldMeasures(dataset, measures, FoldMeasureId, FoldMeasureName, FoldMeasureValue);
169
+ const { dataset: foldedDataset, foldInfo } = foldMeasures(dataset, measures, foldMeasureId, foldMeasureName, foldMeasureValue);
165
170
  if (0 === dimensions.length) {
166
171
  const { dataset: finalDataset, unfoldInfo } = unfoldDimensions(foldedDataset, [
167
172
  {
168
- id: FoldMeasureId,
173
+ id: foldMeasureId,
169
174
  alias: "\u6307\u6807Id",
170
175
  location: 'dimension'
171
176
  },
172
177
  {
173
- id: FoldMeasureName,
178
+ id: foldMeasureName,
179
+ alias: "\u6307\u6807\u540D\u79F0",
180
+ location: 'dimension'
181
+ }
182
+ ], [
183
+ {
184
+ id: foldMeasureValue,
185
+ alias: "\u6307\u6807\u503C"
186
+ }
187
+ ], 1, unfoldDimensionGroup);
188
+ return {
189
+ dataset: finalDataset,
190
+ foldInfo,
191
+ unfoldInfo
192
+ };
193
+ }
194
+ {
195
+ const { dataset: finalDataset, unfoldInfo } = unfoldDimensions(foldedDataset, [
196
+ ...dimensions,
197
+ {
198
+ id: foldMeasureName,
199
+ alias: "\u6307\u6807\u540D\u79F0",
200
+ location: 'dimension'
201
+ }
202
+ ], [
203
+ {
204
+ id: foldMeasureValue,
205
+ alias: "\u6307\u6807\u503C"
206
+ }
207
+ ], 1, unfoldDimensionGroup);
208
+ return {
209
+ dataset: finalDataset,
210
+ foldInfo,
211
+ unfoldInfo
212
+ };
213
+ }
214
+ };
215
+ const dataReshapeFor1D1M_emptyReshapeResult = {
216
+ dataset: [],
217
+ foldInfo: {
218
+ foldMap: {},
219
+ measureId: '',
220
+ measureName: '',
221
+ measureValue: ''
222
+ },
223
+ unfoldInfo: {
224
+ groupName: '',
225
+ colorItems: []
226
+ }
227
+ };
228
+ const dataReshapeFor1D1M = (dataset, dimensions, measures, options)=>{
229
+ const { foldMeasureId = FoldMeasureId, foldMeasureName = FoldMeasureName, foldMeasureValue = FoldMeasureValue, unfoldDimensionGroup = UnfoldDimensionGroup } = options || {};
230
+ if (0 === dimensions.length && 0 === measures.length) return dataReshapeFor1D1M_emptyReshapeResult;
231
+ const { dataset: foldedDataset, foldInfo } = foldMeasures(dataset, measures, foldMeasureId, foldMeasureName, foldMeasureValue);
232
+ if (0 === dimensions.length) {
233
+ const { dataset: finalDataset, unfoldInfo } = unfoldDimensions(foldedDataset, [
234
+ {
235
+ id: foldMeasureName,
174
236
  alias: "\u6307\u6807\u540D\u79F0",
175
237
  location: 'dimension'
176
238
  }
177
239
  ], [
178
240
  {
179
- id: FoldMeasureValue,
241
+ id: foldMeasureValue,
180
242
  alias: "\u6307\u6807\u503C"
181
243
  }
182
- ], 1, FoldDimensionGroup);
244
+ ], 0, unfoldDimensionGroup);
183
245
  return {
184
246
  dataset: finalDataset,
185
247
  foldInfo,
@@ -190,16 +252,16 @@ const dataReshapeFor2D1M = (dataset, dimensions, measures)=>{
190
252
  const { dataset: finalDataset, unfoldInfo } = unfoldDimensions(foldedDataset, [
191
253
  ...dimensions,
192
254
  {
193
- id: FoldMeasureName,
255
+ id: foldMeasureName,
194
256
  alias: "\u6307\u6807\u540D\u79F0",
195
257
  location: 'dimension'
196
258
  }
197
259
  ], [
198
260
  {
199
- id: FoldMeasureValue,
261
+ id: foldMeasureValue,
200
262
  alias: "\u6307\u6807\u503C"
201
263
  }
202
- ], 1, FoldDimensionGroup);
264
+ ], 0, unfoldDimensionGroup);
203
265
  return {
204
266
  dataset: finalDataset,
205
267
  foldInfo,
@@ -220,42 +282,148 @@ const reshapeTo2D1M = (advancedVSeed, context)=>{
220
282
  return {
221
283
  ...result,
222
284
  dataset: newDatasets,
223
- datasetReshapeInfo: {
224
- foldInfo,
225
- unfoldInfo
226
- },
285
+ datasetReshapeInfo: [
286
+ {
287
+ id: '2D1M',
288
+ foldInfo,
289
+ unfoldInfo
290
+ }
291
+ ],
227
292
  dimensions,
228
293
  measures
229
294
  };
230
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
+ };
357
+ const pivotReshapeTo2D1M = (advancedVSeed, context)=>{
358
+ const result = {
359
+ ...advancedVSeed
360
+ };
361
+ const { vseed } = context;
362
+ const { dataset } = vseed;
363
+ const { dimensions, measures } = advancedVSeed;
364
+ if (!measures || !dimensions) return result;
365
+ const measureGroups = [];
366
+ if (measures) measures.forEach((measure)=>{
367
+ if (measure.children && measure.children.length > 0) measureGroups.push(measure);
368
+ });
369
+ const commonDimensions = dimensions.filter((dim)=>'dimension' === dim.location);
370
+ const newDatasets = [];
371
+ const datasetReshapeInfo = [];
372
+ measureGroups.forEach((measureGroup)=>{
373
+ const measures = measureGroup.children;
374
+ if (!measures) return;
375
+ const groupId = measureGroup.id;
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
381
+ });
382
+ const reshapeInfo = {
383
+ id: groupId,
384
+ foldInfo,
385
+ unfoldInfo
386
+ };
387
+ newDatasets.push(newSubDataset);
388
+ datasetReshapeInfo.push(reshapeInfo);
389
+ });
390
+ return {
391
+ ...result,
392
+ dataset: newDatasets,
393
+ datasetReshapeInfo: datasetReshapeInfo
394
+ };
395
+ };
231
396
  const encodingXY = (advancedVSeed)=>{
232
397
  const result = {
233
398
  ...advancedVSeed
234
399
  };
235
400
  const { datasetReshapeInfo, dimensions } = advancedVSeed;
236
401
  if (!datasetReshapeInfo || !dimensions) return result;
237
- const { foldInfo, unfoldInfo } = datasetReshapeInfo;
238
- const isSingleDimension = 0 === dimensions.length;
239
- const x = [
240
- isSingleDimension ? foldInfo.measureName : dimensions[0].id
241
- ];
242
- const y = [
243
- foldInfo.measureValue
244
- ];
245
- const group = [
246
- isSingleDimension ? foldInfo.measureName : unfoldInfo.groupName
247
- ];
248
- const color = [
249
- foldInfo.measureName
250
- ];
251
- const encoding = [
252
- {
253
- x,
254
- y,
255
- group,
256
- color
257
- }
258
- ];
402
+ const encoding = datasetReshapeInfo.reduce((prev, cur)=>{
403
+ const { foldInfo, unfoldInfo } = cur;
404
+ const isSingleDimension = 0 === dimensions.length;
405
+ const x = [
406
+ isSingleDimension ? foldInfo.measureName : dimensions[0].id
407
+ ];
408
+ const y = [
409
+ foldInfo.measureValue
410
+ ];
411
+ const group = [
412
+ isSingleDimension ? foldInfo.measureName : unfoldInfo.groupName
413
+ ];
414
+ const color = [
415
+ foldInfo.measureName
416
+ ];
417
+ return [
418
+ ...prev,
419
+ {
420
+ x,
421
+ y,
422
+ group,
423
+ color
424
+ }
425
+ ];
426
+ }, []);
259
427
  return {
260
428
  ...result,
261
429
  encoding
@@ -267,28 +435,66 @@ const encodingYX = (advancedVSeed)=>{
267
435
  };
268
436
  const { datasetReshapeInfo, dimensions } = advancedVSeed;
269
437
  if (!datasetReshapeInfo || !dimensions) return result;
270
- const { foldInfo, unfoldInfo } = datasetReshapeInfo;
271
- const isSingleDimension = 0 === dimensions.length;
272
- const y = [
273
- isSingleDimension ? foldInfo.measureName : dimensions[0].id
274
- ];
275
- const x = [
276
- foldInfo.measureValue
277
- ];
278
- const group = [
279
- isSingleDimension ? foldInfo.measureName : unfoldInfo.groupName
280
- ];
281
- const color = [
282
- foldInfo.measureName
283
- ];
284
- const encoding = [
285
- {
286
- x,
287
- y,
288
- group,
289
- color
290
- }
291
- ];
438
+ const encoding = datasetReshapeInfo.reduce((prev, cur)=>{
439
+ const { foldInfo, unfoldInfo } = cur;
440
+ const isSingleDimension = 0 === dimensions.length;
441
+ const y = [
442
+ isSingleDimension ? foldInfo.measureName : dimensions[0].id
443
+ ];
444
+ const x = [
445
+ foldInfo.measureValue
446
+ ];
447
+ const group = [
448
+ isSingleDimension ? foldInfo.measureName : unfoldInfo.groupName
449
+ ];
450
+ const color = [
451
+ foldInfo.measureName
452
+ ];
453
+ return [
454
+ ...prev,
455
+ {
456
+ x,
457
+ y,
458
+ group,
459
+ color
460
+ }
461
+ ];
462
+ }, []);
463
+ return {
464
+ ...result,
465
+ encoding
466
+ };
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
+ }, []);
292
498
  return {
293
499
  ...result,
294
500
  encoding
@@ -302,6 +508,17 @@ const initAdvancedVSeed = (advancedVSeed, context)=>{
302
508
  chartType
303
509
  };
304
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
+ };
305
522
  const autoMeasures = (advancedVSeed, context)=>{
306
523
  const result = {
307
524
  ...advancedVSeed
@@ -310,6 +527,7 @@ const autoMeasures = (advancedVSeed, context)=>{
310
527
  const { measures, dataset } = vseed;
311
528
  if (!dataset) throw new Error('dataset is required');
312
529
  if (0 === dataset.length) return result;
530
+ if (isPivotChart(vseed)) return autoMeasureGroup(advancedVSeed, context);
313
531
  if (measures) {
314
532
  result.measures = measures;
315
533
  return result;
@@ -329,6 +547,49 @@ const autoMeasures = (advancedVSeed, context)=>{
329
547
  }));
330
548
  return result;
331
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
+ });
332
593
  const autoDimensions = (advancedVSeed, context)=>{
333
594
  const result = {
334
595
  ...advancedVSeed
@@ -358,7 +619,6 @@ const autoDimensions = (advancedVSeed, context)=>{
358
619
  }));
359
620
  return result;
360
621
  };
361
- const external_remeda_namespaceObject = require("remeda");
362
622
  const vchartBaseConfig = (advancedVSeed, context)=>{
363
623
  const { vseed } = context;
364
624
  const result = {
@@ -394,11 +654,25 @@ const vchartTheme = (advancedVSeed, context)=>{
394
654
  };
395
655
  return result;
396
656
  };
657
+ const execPipeline = (pipeline, context, initialValue = {})=>{
658
+ const result = pipeline.reduce((prev, cur)=>cur(prev, context), initialValue);
659
+ return result;
660
+ };
661
+ const pivotAdapter = (pipeline, pivotPipeline)=>(advancedVSeed, context)=>{
662
+ const { vseed } = context;
663
+ const usePivotChart = isPivotChart(vseed);
664
+ if (usePivotChart) return execPipeline(pivotPipeline, context, advancedVSeed);
665
+ return execPipeline(pipeline, context, advancedVSeed);
666
+ };
397
667
  const lineAdvancedPipeline = [
398
668
  initAdvancedVSeed,
399
669
  autoMeasures,
400
670
  autoDimensions,
401
- reshapeTo2D1M,
671
+ pivotAdapter([
672
+ reshapeTo2D1M
673
+ ], [
674
+ pivotReshapeTo2D1M
675
+ ]),
402
676
  encodingXY,
403
677
  vchartBaseConfig,
404
678
  vchartTheme
@@ -407,7 +681,11 @@ const barAdvancedPipeline = [
407
681
  initAdvancedVSeed,
408
682
  autoMeasures,
409
683
  autoDimensions,
410
- reshapeTo2D1M,
684
+ pivotAdapter([
685
+ reshapeTo2D1M
686
+ ], [
687
+ pivotReshapeTo2D1M
688
+ ]),
411
689
  encodingYX,
412
690
  vchartBaseConfig,
413
691
  vchartTheme
@@ -416,7 +694,11 @@ const barParallelAdvancedPipeline = [
416
694
  initAdvancedVSeed,
417
695
  autoMeasures,
418
696
  autoDimensions,
419
- reshapeTo2D1M,
697
+ pivotAdapter([
698
+ reshapeTo2D1M
699
+ ], [
700
+ pivotReshapeTo2D1M
701
+ ]),
420
702
  encodingYX,
421
703
  vchartBaseConfig,
422
704
  vchartTheme
@@ -425,7 +707,11 @@ const barPercentAdvancedPipeline = [
425
707
  initAdvancedVSeed,
426
708
  autoMeasures,
427
709
  autoDimensions,
428
- reshapeTo2D1M,
710
+ pivotAdapter([
711
+ reshapeTo2D1M
712
+ ], [
713
+ pivotReshapeTo2D1M
714
+ ]),
429
715
  encodingYX,
430
716
  vchartBaseConfig,
431
717
  vchartTheme
@@ -434,7 +720,11 @@ const columnAdvancedPipeline = [
434
720
  initAdvancedVSeed,
435
721
  autoMeasures,
436
722
  autoDimensions,
437
- reshapeTo2D1M,
723
+ pivotAdapter([
724
+ reshapeTo2D1M
725
+ ], [
726
+ pivotReshapeTo2D1M
727
+ ]),
438
728
  encodingXY,
439
729
  vchartBaseConfig,
440
730
  vchartTheme
@@ -443,7 +733,11 @@ const columnParallelAdvancedPipeline = [
443
733
  initAdvancedVSeed,
444
734
  autoMeasures,
445
735
  autoDimensions,
446
- reshapeTo2D1M,
736
+ pivotAdapter([
737
+ reshapeTo2D1M
738
+ ], [
739
+ pivotReshapeTo2D1M
740
+ ]),
447
741
  encodingXY,
448
742
  vchartBaseConfig,
449
743
  vchartTheme
@@ -452,7 +746,11 @@ const columnPercentAdvancedPipeline = [
452
746
  initAdvancedVSeed,
453
747
  autoMeasures,
454
748
  autoDimensions,
455
- reshapeTo2D1M,
749
+ pivotAdapter([
750
+ reshapeTo2D1M
751
+ ], [
752
+ pivotReshapeTo2D1M
753
+ ]),
456
754
  encodingXY,
457
755
  vchartBaseConfig,
458
756
  vchartTheme
@@ -461,7 +759,11 @@ const areaAdvancedPipeline = [
461
759
  initAdvancedVSeed,
462
760
  autoMeasures,
463
761
  autoDimensions,
464
- reshapeTo2D1M,
762
+ pivotAdapter([
763
+ reshapeTo2D1M
764
+ ], [
765
+ pivotReshapeTo2D1M
766
+ ]),
465
767
  encodingXY,
466
768
  vchartBaseConfig,
467
769
  vchartTheme
@@ -470,19 +772,67 @@ const areaPercentAdvancedPipeline = [
470
772
  initAdvancedVSeed,
471
773
  autoMeasures,
472
774
  autoDimensions,
473
- reshapeTo2D1M,
775
+ pivotAdapter([
776
+ reshapeTo2D1M
777
+ ], [
778
+ pivotReshapeTo2D1M
779
+ ]),
474
780
  encodingXY,
475
781
  vchartBaseConfig,
476
782
  vchartTheme
477
783
  ];
478
- const initLine = (spec, context)=>{
784
+ const pieAdvancedPipeline = [
785
+ initAdvancedVSeed,
786
+ autoMeasures,
787
+ autoDimensions,
788
+ pivotAdapter([
789
+ reshapeTo1D1M
790
+ ], [
791
+ pivotReshapeTo1D1M
792
+ ]),
793
+ encodingPolar,
794
+ vchartBaseConfig,
795
+ vchartTheme
796
+ ];
797
+ const dataset_dataset = (spec, context)=>{
798
+ const { advancedVSeed } = context;
799
+ return {
800
+ ...spec,
801
+ data: {
802
+ values: advancedVSeed.dataset
803
+ }
804
+ };
805
+ };
806
+ const datasetPivot = (spec, context)=>{
807
+ const result = {
808
+ ...spec
809
+ };
810
+ const { advancedVSeed } = context;
811
+ const { dataset, datasetReshapeInfo } = advancedVSeed;
812
+ const records = dataset.reduce((pre, cur, index)=>{
813
+ const id = datasetReshapeInfo[index].id;
814
+ pre[id] = cur;
815
+ return pre;
816
+ }, {});
817
+ return {
818
+ ...result,
819
+ records: records
820
+ };
821
+ };
822
+ const datasetPivotPlaceholder = (spec)=>({
823
+ ...spec,
824
+ data: {
825
+ id: 'placeholderDataId'
826
+ }
827
+ });
828
+ const initColumn = (spec, context)=>{
479
829
  const result = {
480
830
  ...spec
481
831
  };
482
832
  const { advancedVSeed } = context;
483
833
  const { encoding } = advancedVSeed;
484
834
  if (!encoding[0].y || !encoding[0].x || !encoding[0].group) return result;
485
- result.type = 'line';
835
+ result.type = 'bar';
486
836
  result.direction = 'vertical';
487
837
  result.xField = encoding[0].x[0];
488
838
  result.yField = encoding[0].y[0];
@@ -490,45 +840,118 @@ const initLine = (spec, context)=>{
490
840
  result.padding = 0;
491
841
  return result;
492
842
  };
493
- const color_color = (spec, context)=>{
843
+ const initBar = (spec, context)=>{
494
844
  const result = {
495
845
  ...spec
496
846
  };
497
847
  const { advancedVSeed } = context;
498
- const { datasetReshapeInfo } = advancedVSeed;
499
- const { unfoldInfo } = datasetReshapeInfo;
500
- const baseConfig = advancedVSeed.baseConfig.vchart;
501
- if (!baseConfig || !baseConfig.color) return result;
502
- const { color } = baseConfig;
503
- const { colorScheme, colorMapping } = color;
504
- result.color = {
505
- type: 'ordinal',
506
- domain: unfoldInfo.colorItems,
507
- range: colorScheme,
508
- specified: colorMapping
509
- };
848
+ const { encoding } = advancedVSeed;
849
+ if (!encoding[0].y || !encoding[0].x || !encoding[0].group) return result;
850
+ result.type = 'bar';
851
+ result.direction = 'horizontal';
852
+ result.yField = encoding[0].y?.[0];
853
+ result.xField = encoding[0].x?.[0];
854
+ result.seriesField = encoding[0].group?.[0];
855
+ result.padding = 0;
510
856
  return result;
511
857
  };
512
- const background_backgroundColor = (spec, context)=>{
858
+ const initBarParallel = (spec, context)=>{
513
859
  const result = {
514
860
  ...spec
515
861
  };
516
862
  const { advancedVSeed } = context;
517
- const { baseConfig } = advancedVSeed;
518
- if (!baseConfig?.vchart) return result;
519
- const { backgroundColor } = baseConfig.vchart;
520
- return {
521
- ...result,
522
- background: backgroundColor
863
+ const { encoding, datasetReshapeInfo } = advancedVSeed;
864
+ const { unfoldInfo } = datasetReshapeInfo[0];
865
+ if (!encoding[0].y || !encoding[0].x || !encoding[0].group) return result;
866
+ result.type = 'bar';
867
+ result.direction = 'horizontal';
868
+ result.yField = [
869
+ encoding[0].y[0],
870
+ unfoldInfo.groupName
871
+ ];
872
+ result.xField = encoding[0].x[0];
873
+ result.seriesField = encoding[0].group[0];
874
+ result.padding = 0;
875
+ return result;
876
+ };
877
+ const initArea = (spec, context)=>{
878
+ const result = {
879
+ ...spec
523
880
  };
881
+ const { advancedVSeed } = context;
882
+ const { encoding } = advancedVSeed;
883
+ if (!encoding[0].y || !encoding[0].x || !encoding[0].group) return result;
884
+ result.type = 'area';
885
+ result.direction = 'vertical';
886
+ result.xField = encoding[0].x[0];
887
+ result.yField = encoding[0].y[0];
888
+ result.seriesField = encoding[0].group[0];
889
+ result.padding = 0;
890
+ return result;
524
891
  };
525
- const dataset_dataset = (spec, context)=>{
892
+ const initLine = (spec, context)=>{
893
+ const result = {
894
+ ...spec
895
+ };
896
+ const { advancedVSeed } = context;
897
+ const { encoding } = advancedVSeed;
898
+ if (!encoding[0].y || !encoding[0].x || !encoding[0].group) return result;
899
+ result.type = 'line';
900
+ result.direction = 'vertical';
901
+ result.xField = encoding[0].x[0];
902
+ result.yField = encoding[0].y[0];
903
+ result.seriesField = encoding[0].group[0];
904
+ result.padding = 0;
905
+ return result;
906
+ };
907
+ const initColumnParallel = (spec, context)=>{
908
+ const result = {
909
+ ...spec
910
+ };
911
+ const { advancedVSeed } = context;
912
+ const { encoding, datasetReshapeInfo } = advancedVSeed;
913
+ const { unfoldInfo } = datasetReshapeInfo[0];
914
+ if (!encoding[0].y || !encoding[0].x || !encoding[0].group) return result;
915
+ result.type = 'bar';
916
+ result.direction = 'vertical';
917
+ result.xField = [
918
+ encoding[0].x[0],
919
+ unfoldInfo.groupName
920
+ ];
921
+ result.yField = encoding[0].y[0];
922
+ result.seriesField = encoding[0].group[0];
923
+ result.padding = 0;
924
+ return result;
925
+ };
926
+ const initPie = (spec, context)=>{
927
+ const result = {
928
+ ...spec
929
+ };
526
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
+ };
942
+ const initPivot = (spec)=>{
943
+ const result = {
944
+ ...spec
945
+ };
527
946
  return {
528
- ...spec,
529
- data: {
530
- values: advancedVSeed.dataset
531
- }
947
+ ...result,
948
+ rows: [],
949
+ columns: [],
950
+ indicators: [],
951
+ records: [],
952
+ widthMode: 'adaptive',
953
+ heightMode: 'adaptive',
954
+ indicatorsAsCol: false
532
955
  };
533
956
  };
534
957
  const xBand = (spec)=>{
@@ -546,7 +969,7 @@ const xBand = (spec)=>{
546
969
  ];
547
970
  return result;
548
971
  };
549
- const yLinear = (spec)=>{
972
+ const xLinear = (spec)=>{
550
973
  const result = {
551
974
  ...spec
552
975
  };
@@ -556,11 +979,88 @@ const yLinear = (spec)=>{
556
979
  {
557
980
  visible: true,
558
981
  type: 'linear',
982
+ orient: 'bottom',
983
+ nice: true,
984
+ zero: true
985
+ }
986
+ ];
987
+ return result;
988
+ };
989
+ const yBand = (spec)=>{
990
+ const result = {
991
+ ...spec
992
+ };
993
+ if (!result.axes) result.axes = [];
994
+ result.axes = [
995
+ ...result.axes,
996
+ {
997
+ visible: true,
998
+ type: 'band',
559
999
  orient: 'left'
560
1000
  }
561
1001
  ];
562
1002
  return result;
563
1003
  };
1004
+ const yLinear = (spec)=>{
1005
+ const result = {
1006
+ ...spec
1007
+ };
1008
+ if (!result.axes) result.axes = [];
1009
+ result.axes = [
1010
+ ...result.axes,
1011
+ {
1012
+ visible: true,
1013
+ type: 'linear',
1014
+ orient: 'left',
1015
+ nice: true,
1016
+ zero: true
1017
+ }
1018
+ ];
1019
+ return result;
1020
+ };
1021
+ const percent = (spec, context)=>{
1022
+ const result = {
1023
+ ...spec
1024
+ };
1025
+ result.percent = true;
1026
+ return result;
1027
+ };
1028
+ const stack = (spec, context)=>{
1029
+ const result = {
1030
+ ...spec
1031
+ };
1032
+ result.stack = true;
1033
+ return result;
1034
+ };
1035
+ const background_backgroundColor = (spec, context)=>{
1036
+ const result = {
1037
+ ...spec
1038
+ };
1039
+ const { advancedVSeed } = context;
1040
+ const { baseConfig } = advancedVSeed;
1041
+ if (!baseConfig?.vchart) return result;
1042
+ const { backgroundColor } = baseConfig.vchart;
1043
+ return {
1044
+ ...result,
1045
+ background: backgroundColor
1046
+ };
1047
+ };
1048
+ const defaultTooltip = {
1049
+ enable: true
1050
+ };
1051
+ const tooltip_tooltip = (spec, context)=>{
1052
+ const result = {
1053
+ ...spec
1054
+ };
1055
+ const { advancedVSeed } = context;
1056
+ const baseConfig = advancedVSeed.baseConfig.vchart;
1057
+ const { tooltip = defaultTooltip } = baseConfig;
1058
+ const { enable } = tooltip;
1059
+ result.tooltip = {
1060
+ visible: enable
1061
+ };
1062
+ return result;
1063
+ };
564
1064
  const label_label = (spec, context)=>{
565
1065
  const result = {
566
1066
  ...spec
@@ -575,40 +1075,314 @@ const label_label = (spec, context)=>{
575
1075
  };
576
1076
  return result;
577
1077
  };
578
- const defaultTooltip = {
1078
+ const defaultLegend = {
579
1079
  enable: true
580
1080
  };
581
- const tooltip_tooltip = (spec, context)=>{
1081
+ const legend_legend = (spec, context)=>{
1082
+ const result = {
1083
+ ...spec
1084
+ };
1085
+ const { advancedVSeed } = context;
1086
+ const baseConfig = advancedVSeed.baseConfig.vchart;
1087
+ if (!baseConfig || !baseConfig.legend) return result;
1088
+ const { legend = defaultLegend } = baseConfig;
1089
+ const { enable } = legend;
1090
+ result.legends = {
1091
+ visible: enable
1092
+ };
1093
+ return result;
1094
+ };
1095
+ const pivotLegend = (spec, context)=>{
1096
+ const result = {
1097
+ ...spec
1098
+ };
1099
+ const { advancedVSeed } = context;
1100
+ const baseConfig = advancedVSeed.baseConfig.vchart;
1101
+ if (!baseConfig || !baseConfig.legend) return result;
1102
+ const { datasetReshapeInfo } = advancedVSeed;
1103
+ const colorItems = (0, external_remeda_namespaceObject.unique)(datasetReshapeInfo.flatMap((d)=>d.unfoldInfo.colorItems));
1104
+ const { legend, color } = baseConfig;
1105
+ const { enable } = legend;
1106
+ const { colorScheme } = color;
1107
+ const legends = {
1108
+ visible: enable,
1109
+ alignSelf: 'end',
1110
+ type: 'discrete',
1111
+ position: 'middle',
1112
+ data: colorItems.map((d, index)=>({
1113
+ label: d,
1114
+ shape: {
1115
+ symbolType: 'square',
1116
+ fill: colorScheme[index]
1117
+ }
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
+ },
1136
+ orient: 'bottom'
1137
+ };
1138
+ return {
1139
+ ...result,
1140
+ legends
1141
+ };
1142
+ };
1143
+ const color_color = (spec, context)=>{
1144
+ const result = {
1145
+ ...spec
1146
+ };
1147
+ const { advancedVSeed } = context;
1148
+ const { datasetReshapeInfo } = advancedVSeed;
1149
+ const { unfoldInfo } = datasetReshapeInfo[0];
1150
+ const baseConfig = advancedVSeed.baseConfig.vchart;
1151
+ if (!baseConfig || !baseConfig.color) return result;
1152
+ const { color } = baseConfig;
1153
+ const { colorScheme, colorMapping } = color;
1154
+ result.color = {
1155
+ type: 'ordinal',
1156
+ domain: unfoldInfo.colorItems,
1157
+ range: colorScheme,
1158
+ specified: colorMapping
1159
+ };
1160
+ return result;
1161
+ };
1162
+ const pivotAdapter_pivotAdapter = (pipeline, pivotPipeline)=>(spec, context)=>{
1163
+ const { vseed } = context;
1164
+ const usePivotChart = isPivotChart(vseed);
1165
+ if (usePivotChart) return execPipeline(pivotPipeline, context, spec);
1166
+ return execPipeline(pipeline, context, spec);
1167
+ };
1168
+ const pivotIndicators = (chartPipeline)=>(spec, context)=>{
1169
+ const result = {
1170
+ ...spec
1171
+ };
1172
+ const { advancedVSeed } = context;
1173
+ const { measures, datasetReshapeInfo, encoding } = advancedVSeed;
1174
+ const colorItems = (0, external_remeda_namespaceObject.unique)(datasetReshapeInfo.flatMap((d)=>d.unfoldInfo.colorItems));
1175
+ const indicators = datasetReshapeInfo.map((reshapeInfo, index)=>{
1176
+ const measure = measures?.find((d)=>d.id === reshapeInfo.id);
1177
+ const newEncoding = [
1178
+ encoding[index]
1179
+ ];
1180
+ const newDatasetReshapeInfo = [
1181
+ {
1182
+ ...reshapeInfo,
1183
+ unfoldInfo: {
1184
+ ...reshapeInfo.unfoldInfo,
1185
+ colorItems
1186
+ }
1187
+ }
1188
+ ];
1189
+ const newContext = {
1190
+ ...context,
1191
+ advancedVSeed: {
1192
+ ...advancedVSeed,
1193
+ datasetReshapeInfo: newDatasetReshapeInfo,
1194
+ encoding: newEncoding
1195
+ }
1196
+ };
1197
+ const chartSpec = execPipeline(chartPipeline, newContext, {});
1198
+ return {
1199
+ indicatorKey: reshapeInfo.id,
1200
+ title: measure?.alias,
1201
+ cellType: 'chart',
1202
+ chartModule: 'vchart',
1203
+ chartSpec: chartSpec,
1204
+ style: {
1205
+ padding: [
1206
+ 1,
1207
+ 1,
1208
+ 0,
1209
+ 1
1210
+ ]
1211
+ }
1212
+ };
1213
+ });
1214
+ return {
1215
+ ...result,
1216
+ indicators: indicators
1217
+ };
1218
+ };
1219
+ const pivotIndicators_pivotIndicatorsAsRow = (spec)=>{
1220
+ const result = {
1221
+ ...spec
1222
+ };
1223
+ return {
1224
+ ...result,
1225
+ indicatorsAsCol: false
1226
+ };
1227
+ };
1228
+ const pivotIndicators_pivotIndicatorsAsCol = (spec)=>{
1229
+ const result = {
1230
+ ...spec
1231
+ };
1232
+ return {
1233
+ ...result,
1234
+ indicatorsAsCol: true
1235
+ };
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)=>{
582
1352
  const result = {
583
1353
  ...spec
584
1354
  };
585
1355
  const { advancedVSeed } = context;
586
- const baseConfig = advancedVSeed.baseConfig.vchart;
587
- const { tooltip = defaultTooltip } = baseConfig;
588
- const { enable } = tooltip;
589
- result.tooltip = {
590
- visible: enable
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
591
1366
  };
592
- return result;
593
- };
594
- const defaultLegend = {
595
- enable: true
596
1367
  };
597
- const legend_legend = (spec, context)=>{
1368
+ const pivotRowDimensions = (spec, context)=>{
598
1369
  const result = {
599
1370
  ...spec
600
1371
  };
601
1372
  const { advancedVSeed } = context;
602
- const baseConfig = advancedVSeed.baseConfig.vchart;
603
- if (!baseConfig || !baseConfig.legend) return result;
604
- const { legend = defaultLegend } = baseConfig;
605
- const { enable } = legend;
606
- result.legends = {
607
- visible: enable
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
608
1383
  };
609
- return result;
610
1384
  };
611
- const lineSpecPipeline = [
1385
+ const line = [
612
1386
  initLine,
613
1387
  color_color,
614
1388
  background_backgroundColor,
@@ -619,22 +1393,29 @@ const lineSpecPipeline = [
619
1393
  tooltip_tooltip,
620
1394
  legend_legend
621
1395
  ];
622
- const initColumn = (spec, context)=>{
623
- const result = {
624
- ...spec
625
- };
626
- const { advancedVSeed } = context;
627
- const { encoding } = advancedVSeed;
628
- if (!encoding[0].y || !encoding[0].x || !encoding[0].group) return result;
629
- result.type = 'bar';
630
- result.direction = 'vertical';
631
- result.xField = encoding[0].x[0];
632
- result.yField = encoding[0].y[0];
633
- result.seriesField = encoding[0].group[0];
634
- result.padding = 0;
635
- return result;
636
- };
637
- const columnSpecPipeline = [
1396
+ const pivotLine = [
1397
+ initPivot,
1398
+ pivotGridStyle,
1399
+ pivotIndicators_pivotIndicatorsAsRow,
1400
+ datasetPivot,
1401
+ pivotIndicators([
1402
+ initLine,
1403
+ color_color,
1404
+ background_backgroundColor,
1405
+ datasetPivotPlaceholder,
1406
+ xBand,
1407
+ yLinear,
1408
+ label_label,
1409
+ tooltip_tooltip
1410
+ ]),
1411
+ pivotRowDimensions,
1412
+ pivotColumnDimensions,
1413
+ pivotLegend
1414
+ ];
1415
+ const lineSpecPipeline = [
1416
+ pivotAdapter_pivotAdapter(line, pivotLine)
1417
+ ];
1418
+ const column = [
638
1419
  initColumn,
639
1420
  color_color,
640
1421
  background_backgroundColor,
@@ -645,26 +1426,29 @@ const columnSpecPipeline = [
645
1426
  tooltip_tooltip,
646
1427
  legend_legend
647
1428
  ];
648
- const initColumnParallel = (spec, context)=>{
649
- const result = {
650
- ...spec
651
- };
652
- const { advancedVSeed } = context;
653
- const { encoding, datasetReshapeInfo } = advancedVSeed;
654
- const { unfoldInfo } = datasetReshapeInfo;
655
- if (!encoding[0].y || !encoding[0].x || !encoding[0].group) return result;
656
- result.type = 'bar';
657
- result.direction = 'vertical';
658
- result.xField = [
659
- encoding[0].x[0],
660
- unfoldInfo.groupName
661
- ];
662
- result.yField = encoding[0].y[0];
663
- result.seriesField = encoding[0].group[0];
664
- result.padding = 0;
665
- return result;
666
- };
667
- const columnParallelSpecPipeline = [
1429
+ const pivotColumn = [
1430
+ initPivot,
1431
+ pivotGridStyle,
1432
+ pivotIndicators_pivotIndicatorsAsRow,
1433
+ datasetPivot,
1434
+ pivotIndicators([
1435
+ initColumn,
1436
+ color_color,
1437
+ background_backgroundColor,
1438
+ datasetPivotPlaceholder,
1439
+ xBand,
1440
+ yLinear,
1441
+ label_label,
1442
+ tooltip_tooltip
1443
+ ]),
1444
+ pivotRowDimensions,
1445
+ pivotColumnDimensions,
1446
+ pivotLegend
1447
+ ];
1448
+ const columnSpecPipeline = [
1449
+ pivotAdapter_pivotAdapter(column, pivotColumn)
1450
+ ];
1451
+ const columnParallel = [
668
1452
  initColumnParallel,
669
1453
  color_color,
670
1454
  background_backgroundColor,
@@ -675,14 +1459,29 @@ const columnParallelSpecPipeline = [
675
1459
  tooltip_tooltip,
676
1460
  legend_legend
677
1461
  ];
678
- const percent = (spec, context)=>{
679
- const result = {
680
- ...spec
681
- };
682
- result.percent = true;
683
- return result;
684
- };
685
- const columnPercentSpecPipeline = [
1462
+ const pivotColumnParallel = [
1463
+ initPivot,
1464
+ pivotGridStyle,
1465
+ pivotIndicators_pivotIndicatorsAsRow,
1466
+ datasetPivot,
1467
+ pivotIndicators([
1468
+ initColumnParallel,
1469
+ color_color,
1470
+ background_backgroundColor,
1471
+ datasetPivotPlaceholder,
1472
+ xBand,
1473
+ yLinear,
1474
+ label_label,
1475
+ tooltip_tooltip
1476
+ ]),
1477
+ pivotRowDimensions,
1478
+ pivotColumnDimensions,
1479
+ pivotLegend
1480
+ ];
1481
+ const columnParallelSpecPipeline = [
1482
+ pivotAdapter_pivotAdapter(columnParallel, pivotColumnParallel)
1483
+ ];
1484
+ const columnPercent = [
686
1485
  initColumn,
687
1486
  color_color,
688
1487
  background_backgroundColor,
@@ -694,52 +1493,30 @@ const columnPercentSpecPipeline = [
694
1493
  tooltip_tooltip,
695
1494
  legend_legend
696
1495
  ];
697
- const initBar = (spec, context)=>{
698
- const result = {
699
- ...spec
700
- };
701
- const { advancedVSeed } = context;
702
- const { encoding } = advancedVSeed;
703
- if (!encoding[0].y || !encoding[0].x || !encoding[0].group) return result;
704
- result.type = 'bar';
705
- result.direction = 'horizontal';
706
- result.yField = encoding[0].y?.[0];
707
- result.xField = encoding[0].x?.[0];
708
- result.seriesField = encoding[0].group?.[0];
709
- result.padding = 0;
710
- return result;
711
- };
712
- const xLinear = (spec)=>{
713
- const result = {
714
- ...spec
715
- };
716
- if (!result.axes) result.axes = [];
717
- result.axes = [
718
- ...result.axes,
719
- {
720
- visible: true,
721
- type: 'linear',
722
- orient: 'bottom'
723
- }
724
- ];
725
- return result;
726
- };
727
- const yBand = (spec)=>{
728
- const result = {
729
- ...spec
730
- };
731
- if (!result.axes) result.axes = [];
732
- result.axes = [
733
- ...result.axes,
734
- {
735
- visible: true,
736
- type: 'band',
737
- orient: 'left'
738
- }
739
- ];
740
- return result;
741
- };
742
- const barSpecPipeline = [
1496
+ const pivotColumnPercent = [
1497
+ initPivot,
1498
+ pivotGridStyle,
1499
+ pivotIndicators_pivotIndicatorsAsRow,
1500
+ datasetPivot,
1501
+ pivotIndicators([
1502
+ initColumn,
1503
+ color_color,
1504
+ percent,
1505
+ background_backgroundColor,
1506
+ datasetPivotPlaceholder,
1507
+ xBand,
1508
+ yLinear,
1509
+ label_label,
1510
+ tooltip_tooltip
1511
+ ]),
1512
+ pivotRowDimensions,
1513
+ pivotColumnDimensions,
1514
+ pivotLegend
1515
+ ];
1516
+ const columnPercentSpecPipeline = [
1517
+ pivotAdapter_pivotAdapter(columnPercent, pivotColumnPercent)
1518
+ ];
1519
+ const bar = [
743
1520
  initBar,
744
1521
  color_color,
745
1522
  background_backgroundColor,
@@ -750,26 +1527,29 @@ const barSpecPipeline = [
750
1527
  tooltip_tooltip,
751
1528
  legend_legend
752
1529
  ];
753
- const initBarParallel = (spec, context)=>{
754
- const result = {
755
- ...spec
756
- };
757
- const { advancedVSeed } = context;
758
- const { encoding, datasetReshapeInfo } = advancedVSeed;
759
- const { unfoldInfo } = datasetReshapeInfo;
760
- if (!encoding[0].y || !encoding[0].x || !encoding[0].group) return result;
761
- result.type = 'bar';
762
- result.direction = 'horizontal';
763
- result.yField = [
764
- encoding[0].y[0],
765
- unfoldInfo.groupName
766
- ];
767
- result.xField = encoding[0].x[0];
768
- result.seriesField = encoding[0].group[0];
769
- result.padding = 0;
770
- return result;
771
- };
772
- const barParallelSpecPipeline = [
1530
+ const pivotBar = [
1531
+ initPivot,
1532
+ pivotGridStyle,
1533
+ pivotIndicators_pivotIndicatorsAsCol,
1534
+ datasetPivot,
1535
+ pivotIndicators([
1536
+ initBar,
1537
+ color_color,
1538
+ background_backgroundColor,
1539
+ datasetPivotPlaceholder,
1540
+ yBand,
1541
+ label_label,
1542
+ label_label,
1543
+ tooltip_tooltip
1544
+ ]),
1545
+ pivotRowDimensions,
1546
+ pivotColumnDimensions,
1547
+ pivotLegend
1548
+ ];
1549
+ const barSpecPipeline = [
1550
+ pivotAdapter_pivotAdapter(bar, pivotBar)
1551
+ ];
1552
+ const barParallel = [
773
1553
  initBarParallel,
774
1554
  color_color,
775
1555
  background_backgroundColor,
@@ -780,7 +1560,29 @@ const barParallelSpecPipeline = [
780
1560
  tooltip_tooltip,
781
1561
  legend_legend
782
1562
  ];
783
- const barPercentSpecPipeline = [
1563
+ const pivotBarParallel = [
1564
+ initPivot,
1565
+ pivotGridStyle,
1566
+ pivotIndicators_pivotIndicatorsAsCol,
1567
+ datasetPivot,
1568
+ pivotIndicators([
1569
+ initBarParallel,
1570
+ color_color,
1571
+ background_backgroundColor,
1572
+ datasetPivotPlaceholder,
1573
+ yBand,
1574
+ xLinear,
1575
+ label_label,
1576
+ tooltip_tooltip
1577
+ ]),
1578
+ pivotRowDimensions,
1579
+ pivotColumnDimensions,
1580
+ pivotLegend
1581
+ ];
1582
+ const barParallelSpecPipeline = [
1583
+ pivotAdapter_pivotAdapter(barParallel, pivotBarParallel)
1584
+ ];
1585
+ const barPercent = [
784
1586
  initBar,
785
1587
  color_color,
786
1588
  background_backgroundColor,
@@ -792,29 +1594,30 @@ const barPercentSpecPipeline = [
792
1594
  tooltip_tooltip,
793
1595
  legend_legend
794
1596
  ];
795
- const initArea = (spec, context)=>{
796
- const result = {
797
- ...spec
798
- };
799
- const { advancedVSeed } = context;
800
- const { encoding } = advancedVSeed;
801
- if (!encoding[0].y || !encoding[0].x || !encoding[0].group) return result;
802
- result.type = 'area';
803
- result.direction = 'vertical';
804
- result.xField = encoding[0].x[0];
805
- result.yField = encoding[0].y[0];
806
- result.seriesField = encoding[0].group[0];
807
- result.padding = 0;
808
- return result;
809
- };
810
- const stack = (spec, context)=>{
811
- const result = {
812
- ...spec
813
- };
814
- result.stack = true;
815
- return result;
816
- };
817
- const areaSpecPipeline = [
1597
+ const pivotBarPercent = [
1598
+ initPivot,
1599
+ pivotGridStyle,
1600
+ pivotIndicators_pivotIndicatorsAsCol,
1601
+ datasetPivot,
1602
+ pivotIndicators([
1603
+ initBar,
1604
+ color_color,
1605
+ background_backgroundColor,
1606
+ percent,
1607
+ datasetPivotPlaceholder,
1608
+ yBand,
1609
+ xLinear,
1610
+ label_label,
1611
+ tooltip_tooltip
1612
+ ]),
1613
+ pivotRowDimensions,
1614
+ pivotColumnDimensions,
1615
+ pivotLegend
1616
+ ];
1617
+ const barPercentSpecPipeline = [
1618
+ pivotAdapter_pivotAdapter(barPercent, pivotBarPercent)
1619
+ ];
1620
+ const area_area = [
818
1621
  initArea,
819
1622
  color_color,
820
1623
  background_backgroundColor,
@@ -826,7 +1629,30 @@ const areaSpecPipeline = [
826
1629
  tooltip_tooltip,
827
1630
  legend_legend
828
1631
  ];
829
- const areaPercentSpecPipeline = [
1632
+ const pivotArea = [
1633
+ initPivot,
1634
+ pivotGridStyle,
1635
+ pivotIndicators_pivotIndicatorsAsRow,
1636
+ datasetPivot,
1637
+ pivotIndicators([
1638
+ initArea,
1639
+ color_color,
1640
+ background_backgroundColor,
1641
+ stack,
1642
+ datasetPivotPlaceholder,
1643
+ xBand,
1644
+ yLinear,
1645
+ label_label,
1646
+ tooltip_tooltip
1647
+ ]),
1648
+ pivotRowDimensions,
1649
+ pivotColumnDimensions,
1650
+ pivotLegend
1651
+ ];
1652
+ const areaSpecPipeline = [
1653
+ pivotAdapter_pivotAdapter(area_area, pivotArea)
1654
+ ];
1655
+ const areaPercent = [
830
1656
  initArea,
831
1657
  color_color,
832
1658
  background_backgroundColor,
@@ -838,15 +1664,58 @@ const areaPercentSpecPipeline = [
838
1664
  tooltip_tooltip,
839
1665
  legend_legend
840
1666
  ];
841
- const execPipeline = (pipeline, context, initialValue = {})=>{
842
- const result = pipeline.reduce((prev, cur)=>cur(prev, context), initialValue);
843
- return result;
844
- };
845
- const isVTable = (chartType)=>[
846
- 'table',
847
- 'pivotTable'
848
- ].includes(chartType);
849
- const isVChart = (chartType)=>!isVTable(chartType);
1667
+ const pivotAreaPercent = [
1668
+ initPivot,
1669
+ pivotGridStyle,
1670
+ pivotIndicators_pivotIndicatorsAsRow,
1671
+ datasetPivot,
1672
+ pivotIndicators([
1673
+ initArea,
1674
+ color_color,
1675
+ background_backgroundColor,
1676
+ percent,
1677
+ datasetPivotPlaceholder,
1678
+ xBand,
1679
+ yLinear,
1680
+ label_label,
1681
+ tooltip_tooltip
1682
+ ]),
1683
+ pivotRowDimensions,
1684
+ pivotColumnDimensions,
1685
+ pivotLegend
1686
+ ];
1687
+ const areaPercentSpecPipeline = [
1688
+ pivotAdapter_pivotAdapter(areaPercent, pivotAreaPercent)
1689
+ ];
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
+ ];
850
1719
  const buildAdvanced = (builder)=>{
851
1720
  const { chartType } = builder.vseed;
852
1721
  if (!chartType) throw new Error('chartType is nil in buildAdvanced');
@@ -954,6 +1823,10 @@ const registerBarParallel = ()=>{
954
1823
  Builder._advancedPipelineMap.barParallel = barParallelAdvancedPipeline;
955
1824
  Builder._specPipelineMap.barParallel = barParallelSpecPipeline;
956
1825
  };
1826
+ const registerPie = ()=>{
1827
+ Builder._advancedPipelineMap.pie = pieAdvancedPipeline;
1828
+ Builder._specPipelineMap.pie = pieSpecPipeline;
1829
+ };
957
1830
  const lightTheme = ()=>({
958
1831
  baseConfig: {
959
1832
  vtable: {
@@ -1039,6 +1912,7 @@ const all_registerAll = ()=>{
1039
1912
  registerBarPercent();
1040
1913
  registerArea();
1041
1914
  registerAreaPercent();
1915
+ registerPie();
1042
1916
  registerLightTheme();
1043
1917
  registerDarkTheme();
1044
1918
  };
@@ -1116,10 +1990,11 @@ const zUnfoldInfo = external_zod_namespaceObject.z.object({
1116
1990
  colorItems: external_zod_namespaceObject.z.array(external_zod_namespaceObject.z.string()),
1117
1991
  groupName: external_zod_namespaceObject.z.string()
1118
1992
  });
1119
- const zDatasetReshapeInfo = external_zod_namespaceObject.z.object({
1993
+ const zDatasetReshapeInfo = external_zod_namespaceObject.z.array(external_zod_namespaceObject.z.object({
1994
+ id: external_zod_namespaceObject.z.string(),
1120
1995
  foldInfo: zFoldInfo,
1121
1996
  unfoldInfo: zUnfoldInfo
1122
- });
1997
+ }));
1123
1998
  const zEncoding = external_zod_namespaceObject.z.array(external_zod_namespaceObject.z.object({
1124
1999
  x: external_zod_namespaceObject.z.array(external_zod_namespaceObject.z.string()).optional(),
1125
2000
  y: external_zod_namespaceObject.z.array(external_zod_namespaceObject.z.string()).optional(),
@@ -1162,62 +2037,6 @@ const zCustomThemeConfig = external_zod_namespaceObject.z.object({
1162
2037
  });
1163
2038
  const zCustomTheme = external_zod_namespaceObject.z.record(external_zod_namespaceObject.z.string(), zCustomThemeConfig).optional();
1164
2039
  const zTheme = external_zod_namespaceObject.z.string();
1165
- const dataReshapeFor1D1M_emptyReshapeResult = {
1166
- dataset: [],
1167
- foldInfo: {
1168
- foldMap: {},
1169
- measureId: '',
1170
- measureName: '',
1171
- measureValue: ''
1172
- },
1173
- unfoldInfo: {
1174
- groupName: '',
1175
- colorItems: []
1176
- }
1177
- };
1178
- const dataReshapeFor1D1M = (dataset, dimensions, measures)=>{
1179
- if (0 === dimensions.length && 0 === measures.length) return dataReshapeFor1D1M_emptyReshapeResult;
1180
- const { dataset: foldedDataset, foldInfo } = foldMeasures(dataset, measures, FoldMeasureId, FoldMeasureName, FoldMeasureValue);
1181
- if (0 === dimensions.length) {
1182
- const { dataset: finalDataset, unfoldInfo } = unfoldDimensions(foldedDataset, [
1183
- {
1184
- id: FoldMeasureName,
1185
- alias: "\u6307\u6807\u540D\u79F0",
1186
- location: 'dimension'
1187
- }
1188
- ], [
1189
- {
1190
- id: FoldMeasureValue,
1191
- alias: "\u6307\u6807\u503C"
1192
- }
1193
- ], 0, FoldDimensionGroup);
1194
- return {
1195
- dataset: finalDataset,
1196
- foldInfo,
1197
- unfoldInfo
1198
- };
1199
- }
1200
- {
1201
- const { dataset: finalDataset, unfoldInfo } = unfoldDimensions(foldedDataset, [
1202
- ...dimensions,
1203
- {
1204
- id: FoldMeasureName,
1205
- alias: "\u6307\u6807\u540D\u79F0",
1206
- location: 'dimension'
1207
- }
1208
- ], [
1209
- {
1210
- id: FoldMeasureValue,
1211
- alias: "\u6307\u6807\u503C"
1212
- }
1213
- ], 0, FoldDimensionGroup);
1214
- return {
1215
- dataset: finalDataset,
1216
- foldInfo,
1217
- unfoldInfo
1218
- };
1219
- }
1220
- };
1221
2040
  exports.Builder = __webpack_exports__.Builder;
1222
2041
  exports.areaAdvancedPipeline = __webpack_exports__.areaAdvancedPipeline;
1223
2042
  exports.areaPercentAdvancedPipeline = __webpack_exports__.areaPercentAdvancedPipeline;
@@ -1240,11 +2059,14 @@ exports.dataReshapeFor1D1M = __webpack_exports__.dataReshapeFor1D1M;
1240
2059
  exports.dataReshapeFor2D1M = __webpack_exports__.dataReshapeFor2D1M;
1241
2060
  exports.execPipeline = __webpack_exports__.execPipeline;
1242
2061
  exports.foldMeasures = __webpack_exports__.foldMeasures;
2062
+ exports.isPivotChart = __webpack_exports__.isPivotChart;
1243
2063
  exports.isVChart = __webpack_exports__.isVChart;
1244
2064
  exports.isVTable = __webpack_exports__.isVTable;
1245
2065
  exports.lightTheme = __webpack_exports__.lightTheme;
1246
2066
  exports.lineAdvancedPipeline = __webpack_exports__.lineAdvancedPipeline;
1247
2067
  exports.lineSpecPipeline = __webpack_exports__.lineSpecPipeline;
2068
+ exports.pieAdvancedPipeline = __webpack_exports__.pieAdvancedPipeline;
2069
+ exports.pieSpecPipeline = __webpack_exports__.pieSpecPipeline;
1248
2070
  exports.registerAll = __webpack_exports__.registerAll;
1249
2071
  exports.registerArea = __webpack_exports__.registerArea;
1250
2072
  exports.registerAreaPercent = __webpack_exports__.registerAreaPercent;
@@ -1303,11 +2125,14 @@ for(var __webpack_i__ in __webpack_exports__)if (-1 === [
1303
2125
  "dataReshapeFor2D1M",
1304
2126
  "execPipeline",
1305
2127
  "foldMeasures",
2128
+ "isPivotChart",
1306
2129
  "isVChart",
1307
2130
  "isVTable",
1308
2131
  "lightTheme",
1309
2132
  "lineAdvancedPipeline",
1310
2133
  "lineSpecPipeline",
2134
+ "pieAdvancedPipeline",
2135
+ "pieSpecPipeline",
1311
2136
  "registerAll",
1312
2137
  "registerArea",
1313
2138
  "registerAreaPercent",