@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/builder/register/chartType.d.ts +1 -0
- package/dist/index.cjs +445 -31
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +437 -32
- package/dist/index.js.map +1 -1
- package/dist/pipeline/advanced/pipeline/index.d.ts +1 -0
- package/dist/pipeline/advanced/pipeline/line copy.d.ts +2 -0
- package/dist/pipeline/advanced/pipeline/pie.d.ts +2 -0
- package/dist/pipeline/advanced/pipes/encoding/encodingPolar.d.ts +2 -0
- package/dist/pipeline/advanced/pipes/encoding/encodingXY copy.d.ts +2 -0
- package/dist/pipeline/advanced/pipes/encoding/index.d.ts +1 -0
- package/dist/pipeline/spec/pipeline/index.d.ts +1 -0
- package/dist/pipeline/spec/pipeline/pie.d.ts +2 -0
- package/dist/pipeline/spec/pipes/init/index.d.ts +1 -0
- package/dist/pipeline/spec/pipes/init/line copy.d.ts +2 -0
- package/dist/pipeline/spec/pipes/init/pie.d.ts +2 -0
- package/dist/pipeline/spec/pipes/pivotChart/index.d.ts +3 -0
- package/dist/pipeline/spec/pipes/pivotChart/pivotColumnDimensions.d.ts +2 -0
- package/dist/pipeline/spec/pipes/pivotChart/pivotGridStyle copy.d.ts +2 -0
- package/dist/pipeline/spec/pipes/pivotChart/pivotGridStyle.d.ts +2 -0
- package/dist/pipeline/spec/pipes/pivotChart/pivotRowDimensions copy.d.ts +2 -0
- package/dist/pipeline/spec/pipes/pivotChart/pivotRowDimensions.d.ts +2 -0
- package/dist/pipeline/utils/chatType.d.ts +37 -1
- package/dist/pipeline/utils/index.d.ts +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
import { clone as external_remeda_clone, mergeDeep as external_remeda_mergeDeep, pick as external_remeda_pick, unique } from "remeda";
|
2
2
|
import { z } from "zod";
|
3
|
-
const
|
4
|
-
const
|
5
|
-
const
|
6
|
-
const
|
3
|
+
const FoldMeasureName = '__MeaName__';
|
4
|
+
const FoldMeasureValue = '__MeaValue__';
|
5
|
+
const FoldMeasureId = '__MeaId__';
|
6
|
+
const UnfoldDimensionGroup = '__DimGroup__';
|
7
7
|
const Separator = '-';
|
8
|
-
const unfoldDimensions = (dataset, dimensions, measures, unfoldStartIndex = 0, foldGroupName =
|
8
|
+
const unfoldDimensions = (dataset, dimensions, measures, unfoldStartIndex = 0, foldGroupName = UnfoldDimensionGroup, dimensionsSeparator = Separator)=>{
|
9
9
|
if (unfoldStartIndex < 0 || unfoldStartIndex >= dimensions.length) throw new Error('unfoldStartIndex is out of range');
|
10
10
|
const dimensionsToBeUnfolded = dimensions.slice(unfoldStartIndex);
|
11
11
|
const unfoldInfo = {
|
@@ -33,7 +33,7 @@ const unfoldDimensions = (dataset, dimensions, measures, unfoldStartIndex = 0, f
|
|
33
33
|
};
|
34
34
|
};
|
35
35
|
const generateDimGroupName = (dimensionsToBeGrouped, datum, dimensionsSeparator)=>dimensionsToBeGrouped.map((dim)=>String(datum[dim.id])).join(dimensionsSeparator);
|
36
|
-
const foldMeasures = (dataset, measures, measureId =
|
36
|
+
const foldMeasures = (dataset, measures, measureId = FoldMeasureId, measureName = FoldMeasureName, measureValue = FoldMeasureValue)=>{
|
37
37
|
const foldInfo = {
|
38
38
|
measureId,
|
39
39
|
measureName,
|
@@ -73,7 +73,7 @@ const emptyReshapeResult = {
|
|
73
73
|
}
|
74
74
|
};
|
75
75
|
const dataReshapeFor2D1M = (dataset, dimensions, measures, options)=>{
|
76
|
-
const { foldMeasureId =
|
76
|
+
const { foldMeasureId = FoldMeasureId, foldMeasureName = FoldMeasureName, foldMeasureValue = FoldMeasureValue, unfoldDimensionGroup = UnfoldDimensionGroup } = options || {};
|
77
77
|
if (0 === dimensions.length && 0 === measures.length) return emptyReshapeResult;
|
78
78
|
const { dataset: foldedDataset, foldInfo } = foldMeasures(dataset, measures, foldMeasureId, foldMeasureName, foldMeasureValue);
|
79
79
|
if (0 === dimensions.length) {
|
@@ -134,8 +134,8 @@ const dataReshapeFor1D1M_emptyReshapeResult = {
|
|
134
134
|
colorItems: []
|
135
135
|
}
|
136
136
|
};
|
137
|
-
const
|
138
|
-
const { foldMeasureId =
|
137
|
+
const dataReshapeFor1D1M = (dataset, dimensions, measures, options)=>{
|
138
|
+
const { foldMeasureId = FoldMeasureId, foldMeasureName = FoldMeasureName, foldMeasureValue = FoldMeasureValue, unfoldDimensionGroup = UnfoldDimensionGroup } = options || {};
|
139
139
|
if (0 === dimensions.length && 0 === measures.length) return dataReshapeFor1D1M_emptyReshapeResult;
|
140
140
|
const { dataset: foldedDataset, foldInfo } = foldMeasures(dataset, measures, foldMeasureId, foldMeasureName, foldMeasureValue);
|
141
141
|
if (0 === dimensions.length) {
|
@@ -202,6 +202,67 @@ const reshapeTo2D1M = (advancedVSeed, context)=>{
|
|
202
202
|
measures
|
203
203
|
};
|
204
204
|
};
|
205
|
+
const reshapeTo1D1M = (advancedVSeed, context)=>{
|
206
|
+
const result = {
|
207
|
+
...advancedVSeed
|
208
|
+
};
|
209
|
+
const { vseed } = context;
|
210
|
+
const { dataset } = vseed;
|
211
|
+
const { dimensions, measures } = advancedVSeed;
|
212
|
+
if (!measures || !dimensions || !dataset) return result;
|
213
|
+
if (0 === measures.length) throw new Error('measures can not be empty');
|
214
|
+
const { dataset: newDatasets, foldInfo, unfoldInfo } = dataReshapeFor1D1M(dataset, dimensions, measures);
|
215
|
+
return {
|
216
|
+
...result,
|
217
|
+
dataset: newDatasets,
|
218
|
+
datasetReshapeInfo: [
|
219
|
+
{
|
220
|
+
id: '1D1M',
|
221
|
+
foldInfo,
|
222
|
+
unfoldInfo
|
223
|
+
}
|
224
|
+
]
|
225
|
+
};
|
226
|
+
};
|
227
|
+
const pivotReshapeTo1D1M = (advancedVSeed, context)=>{
|
228
|
+
const result = {
|
229
|
+
...advancedVSeed
|
230
|
+
};
|
231
|
+
const { vseed } = context;
|
232
|
+
const { dataset } = vseed;
|
233
|
+
const { dimensions, measures } = advancedVSeed;
|
234
|
+
if (!measures || !dimensions) return result;
|
235
|
+
const measureGroups = [];
|
236
|
+
if (measures) measures.forEach((measure)=>{
|
237
|
+
if (measure.children && measure.children.length > 0) measureGroups.push(measure);
|
238
|
+
});
|
239
|
+
const newDatasets = [];
|
240
|
+
const datasetReshapeInfo = [];
|
241
|
+
measureGroups.forEach((measureGroup)=>{
|
242
|
+
const measures = measureGroup.children;
|
243
|
+
if (!measures) return;
|
244
|
+
const commonDimensions = dimensions.filter((dim)=>'dimension' === dim.location);
|
245
|
+
const groupId = measureGroup.id;
|
246
|
+
const { dataset: newSubDataset, foldInfo, unfoldInfo } = dataReshapeFor1D1M(dataset, commonDimensions, measures, {
|
247
|
+
foldMeasureId: FoldMeasureId,
|
248
|
+
foldMeasureName: FoldMeasureName,
|
249
|
+
foldMeasureValue: FoldMeasureValue + groupId,
|
250
|
+
unfoldDimensionGroup: UnfoldDimensionGroup
|
251
|
+
});
|
252
|
+
const reshapeInfo = {
|
253
|
+
id: groupId,
|
254
|
+
foldInfo,
|
255
|
+
unfoldInfo
|
256
|
+
};
|
257
|
+
newDatasets.push(newSubDataset);
|
258
|
+
datasetReshapeInfo.push(reshapeInfo);
|
259
|
+
});
|
260
|
+
return {
|
261
|
+
...result,
|
262
|
+
dataset: newDatasets,
|
263
|
+
datasetReshapeInfo: datasetReshapeInfo
|
264
|
+
};
|
265
|
+
};
|
205
266
|
const pivotReshapeTo2D1M = (advancedVSeed, context)=>{
|
206
267
|
const result = {
|
207
268
|
...advancedVSeed
|
@@ -214,17 +275,18 @@ const pivotReshapeTo2D1M = (advancedVSeed, context)=>{
|
|
214
275
|
if (measures) measures.forEach((measure)=>{
|
215
276
|
if (measure.children && measure.children.length > 0) measureGroups.push(measure);
|
216
277
|
});
|
278
|
+
const commonDimensions = dimensions.filter((dim)=>'dimension' === dim.location);
|
217
279
|
const newDatasets = [];
|
218
280
|
const datasetReshapeInfo = [];
|
219
281
|
measureGroups.forEach((measureGroup)=>{
|
220
282
|
const measures = measureGroup.children;
|
221
283
|
if (!measures) return;
|
222
284
|
const groupId = measureGroup.id;
|
223
|
-
const { dataset: newSubDataset, foldInfo, unfoldInfo } = dataReshapeFor2D1M(dataset,
|
224
|
-
foldMeasureId:
|
225
|
-
foldMeasureName:
|
226
|
-
foldMeasureValue:
|
227
|
-
unfoldDimensionGroup:
|
285
|
+
const { dataset: newSubDataset, foldInfo, unfoldInfo } = dataReshapeFor2D1M(dataset, commonDimensions, measures, {
|
286
|
+
foldMeasureId: FoldMeasureId + groupId,
|
287
|
+
foldMeasureName: FoldMeasureName + groupId,
|
288
|
+
foldMeasureValue: FoldMeasureValue + groupId,
|
289
|
+
unfoldDimensionGroup: UnfoldDimensionGroup + groupId
|
228
290
|
});
|
229
291
|
const reshapeInfo = {
|
230
292
|
id: groupId,
|
@@ -312,6 +374,41 @@ const encodingYX = (advancedVSeed)=>{
|
|
312
374
|
encoding
|
313
375
|
};
|
314
376
|
};
|
377
|
+
const encodingPolar = (advancedVSeed)=>{
|
378
|
+
const result = {
|
379
|
+
...advancedVSeed
|
380
|
+
};
|
381
|
+
const { datasetReshapeInfo, dimensions } = advancedVSeed;
|
382
|
+
if (!datasetReshapeInfo || !dimensions) return result;
|
383
|
+
const encoding = datasetReshapeInfo.reduce((prev, cur)=>{
|
384
|
+
const { foldInfo, unfoldInfo } = cur;
|
385
|
+
const radius = [
|
386
|
+
foldInfo.measureValue
|
387
|
+
];
|
388
|
+
const angle = [
|
389
|
+
unfoldInfo.groupName
|
390
|
+
];
|
391
|
+
const group = [
|
392
|
+
unfoldInfo.groupName
|
393
|
+
];
|
394
|
+
const color = [
|
395
|
+
unfoldInfo.groupName
|
396
|
+
];
|
397
|
+
return [
|
398
|
+
...prev,
|
399
|
+
{
|
400
|
+
angle,
|
401
|
+
radius,
|
402
|
+
group,
|
403
|
+
color
|
404
|
+
}
|
405
|
+
];
|
406
|
+
}, []);
|
407
|
+
return {
|
408
|
+
...result,
|
409
|
+
encoding
|
410
|
+
};
|
411
|
+
};
|
315
412
|
const initAdvancedVSeed = (advancedVSeed, context)=>{
|
316
413
|
const { vseed } = context;
|
317
414
|
const { chartType = 'table' } = vseed;
|
@@ -320,6 +417,21 @@ const initAdvancedVSeed = (advancedVSeed, context)=>{
|
|
320
417
|
chartType
|
321
418
|
};
|
322
419
|
};
|
420
|
+
const execPipeline = (pipeline, context, initialValue = {})=>{
|
421
|
+
const result = pipeline.reduce((prev, cur)=>cur(prev, context), initialValue);
|
422
|
+
return result;
|
423
|
+
};
|
424
|
+
const isVTable = (chartType)=>[
|
425
|
+
'table',
|
426
|
+
'pivotTable'
|
427
|
+
].includes(chartType);
|
428
|
+
const isVChart = (chartType)=>!isVTable(chartType);
|
429
|
+
const isPivotChart = (vseed)=>{
|
430
|
+
const { measures, dimensions } = vseed;
|
431
|
+
const hasRowOrColumnDimension = dimensions && dimensions.some((dimension)=>'rowDimension' === dimension.location || 'columnDimension' === dimension.location);
|
432
|
+
const hasMeasureGroup = measures && measures.find((measure)=>measure && measure.children);
|
433
|
+
return hasRowOrColumnDimension || hasMeasureGroup;
|
434
|
+
};
|
323
435
|
const autoMeasures = (advancedVSeed, context)=>{
|
324
436
|
const result = {
|
325
437
|
...advancedVSeed
|
@@ -328,6 +440,7 @@ const autoMeasures = (advancedVSeed, context)=>{
|
|
328
440
|
const { measures, dataset } = vseed;
|
329
441
|
if (!dataset) throw new Error('dataset is required');
|
330
442
|
if (0 === dataset.length) return result;
|
443
|
+
if (isPivotChart(vseed)) return autoMeasureGroup(advancedVSeed, context);
|
331
444
|
if (measures) {
|
332
445
|
result.measures = measures;
|
333
446
|
return result;
|
@@ -347,6 +460,49 @@ const autoMeasures = (advancedVSeed, context)=>{
|
|
347
460
|
}));
|
348
461
|
return result;
|
349
462
|
};
|
463
|
+
const autoMeasureGroup = (advancedVSeed, context)=>{
|
464
|
+
const { vseed } = context;
|
465
|
+
const { measures } = vseed;
|
466
|
+
const hasMeasureGroup = measures?.some((measure)=>measure.children);
|
467
|
+
if (!measures) return advancedVSeed;
|
468
|
+
if (!hasMeasureGroup) {
|
469
|
+
const newMeasures = [
|
470
|
+
{
|
471
|
+
id: 'measureGroup',
|
472
|
+
alias: 'measureGroup',
|
473
|
+
children: measures
|
474
|
+
}
|
475
|
+
];
|
476
|
+
return {
|
477
|
+
...advancedVSeed,
|
478
|
+
measures: newMeasures
|
479
|
+
};
|
480
|
+
}
|
481
|
+
let currentGroup = createEmptyMeasureGroup();
|
482
|
+
const measureGroups = [];
|
483
|
+
for (const measure of measures)if ('children' in measure) {
|
484
|
+
if (currentGroup.children?.length) {
|
485
|
+
currentGroup.id = currentGroup.children.map((item)=>item.id).join('-');
|
486
|
+
currentGroup.alias = currentGroup.children.map((item)=>item.alias).join('-');
|
487
|
+
measureGroups.push(currentGroup);
|
488
|
+
currentGroup = createEmptyMeasureGroup();
|
489
|
+
}
|
490
|
+
measureGroups.push(measure);
|
491
|
+
} else currentGroup.children?.push(measure);
|
492
|
+
if (currentGroup.children?.length) {
|
493
|
+
currentGroup.id = currentGroup.children.map((item)=>item.id).join('-');
|
494
|
+
currentGroup.alias = currentGroup.children.map((item)=>item.alias).join('-');
|
495
|
+
measureGroups.push(currentGroup);
|
496
|
+
currentGroup = createEmptyMeasureGroup();
|
497
|
+
}
|
498
|
+
advancedVSeed.measures = measureGroups;
|
499
|
+
return advancedVSeed;
|
500
|
+
};
|
501
|
+
const createEmptyMeasureGroup = ()=>({
|
502
|
+
id: '',
|
503
|
+
alias: '',
|
504
|
+
children: []
|
505
|
+
});
|
350
506
|
const autoDimensions = (advancedVSeed, context)=>{
|
351
507
|
const result = {
|
352
508
|
...advancedVSeed
|
@@ -411,19 +567,10 @@ const vchartTheme = (advancedVSeed, context)=>{
|
|
411
567
|
};
|
412
568
|
return result;
|
413
569
|
};
|
414
|
-
const execPipeline = (pipeline, context, initialValue = {})=>{
|
415
|
-
const result = pipeline.reduce((prev, cur)=>cur(prev, context), initialValue);
|
416
|
-
return result;
|
417
|
-
};
|
418
|
-
const isVTable = (chartType)=>[
|
419
|
-
'table',
|
420
|
-
'pivotTable'
|
421
|
-
].includes(chartType);
|
422
|
-
const isVChart = (chartType)=>!isVTable(chartType);
|
423
570
|
const pivotAdapter = (pipeline, pivotPipeline)=>(advancedVSeed, context)=>{
|
424
571
|
const { vseed } = context;
|
425
|
-
const
|
426
|
-
if (
|
572
|
+
const usePivotChart = isPivotChart(vseed);
|
573
|
+
if (usePivotChart) return execPipeline(pivotPipeline, context, advancedVSeed);
|
427
574
|
return execPipeline(pipeline, context, advancedVSeed);
|
428
575
|
};
|
429
576
|
const lineAdvancedPipeline = [
|
@@ -543,6 +690,19 @@ const areaPercentAdvancedPipeline = [
|
|
543
690
|
vchartBaseConfig,
|
544
691
|
vchartTheme
|
545
692
|
];
|
693
|
+
const pieAdvancedPipeline = [
|
694
|
+
initAdvancedVSeed,
|
695
|
+
autoMeasures,
|
696
|
+
autoDimensions,
|
697
|
+
pivotAdapter([
|
698
|
+
reshapeTo1D1M
|
699
|
+
], [
|
700
|
+
pivotReshapeTo1D1M
|
701
|
+
]),
|
702
|
+
encodingPolar,
|
703
|
+
vchartBaseConfig,
|
704
|
+
vchartTheme
|
705
|
+
];
|
546
706
|
const dataset_dataset = (spec, context)=>{
|
547
707
|
const { advancedVSeed } = context;
|
548
708
|
return {
|
@@ -672,6 +832,22 @@ const initColumnParallel = (spec, context)=>{
|
|
672
832
|
result.padding = 0;
|
673
833
|
return result;
|
674
834
|
};
|
835
|
+
const initPie = (spec, context)=>{
|
836
|
+
const result = {
|
837
|
+
...spec
|
838
|
+
};
|
839
|
+
const { advancedVSeed } = context;
|
840
|
+
const { encoding } = advancedVSeed;
|
841
|
+
if (!encoding[0].angle || !encoding[0].radius || !encoding[0].group) return result;
|
842
|
+
result.type = 'pie';
|
843
|
+
result.outerRadius = 0.8;
|
844
|
+
result.innerRadius = 0;
|
845
|
+
result.valueField = encoding[0].radius[0];
|
846
|
+
result.categoryField = encoding[0].angle[0];
|
847
|
+
result.seriesField = encoding[0].group[0];
|
848
|
+
result.padding = 0;
|
849
|
+
return result;
|
850
|
+
};
|
675
851
|
const initPivot = (spec)=>{
|
676
852
|
const result = {
|
677
853
|
...spec
|
@@ -837,11 +1013,11 @@ const pivotLegend = (spec, context)=>{
|
|
837
1013
|
const { legend, color } = baseConfig;
|
838
1014
|
const { enable } = legend;
|
839
1015
|
const { colorScheme } = color;
|
840
|
-
|
1016
|
+
const legends = {
|
841
1017
|
visible: enable,
|
842
1018
|
alignSelf: 'end',
|
843
1019
|
type: 'discrete',
|
844
|
-
position: '
|
1020
|
+
position: 'middle',
|
845
1021
|
data: colorItems.map((d, index)=>({
|
846
1022
|
label: d,
|
847
1023
|
shape: {
|
@@ -849,9 +1025,29 @@ const pivotLegend = (spec, context)=>{
|
|
849
1025
|
fill: colorScheme[index]
|
850
1026
|
}
|
851
1027
|
})),
|
1028
|
+
item: {
|
1029
|
+
background: {
|
1030
|
+
visible: true,
|
1031
|
+
state: {
|
1032
|
+
selectedHover: {
|
1033
|
+
fill: '#000000',
|
1034
|
+
fillOpacity: 0.05
|
1035
|
+
}
|
1036
|
+
}
|
1037
|
+
},
|
1038
|
+
label: {
|
1039
|
+
style: {
|
1040
|
+
fontSize: 12,
|
1041
|
+
fill: '#6F6F6F'
|
1042
|
+
}
|
1043
|
+
}
|
1044
|
+
},
|
852
1045
|
orient: 'bottom'
|
853
1046
|
};
|
854
|
-
return
|
1047
|
+
return {
|
1048
|
+
...result,
|
1049
|
+
legends
|
1050
|
+
};
|
855
1051
|
};
|
856
1052
|
const color_color = (spec, context)=>{
|
857
1053
|
const result = {
|
@@ -873,9 +1069,9 @@ const color_color = (spec, context)=>{
|
|
873
1069
|
return result;
|
874
1070
|
};
|
875
1071
|
const pivotAdapter_pivotAdapter = (pipeline, pivotPipeline)=>(spec, context)=>{
|
876
|
-
const {
|
877
|
-
const
|
878
|
-
if (
|
1072
|
+
const { vseed } = context;
|
1073
|
+
const usePivotChart = isPivotChart(vseed);
|
1074
|
+
if (usePivotChart) return execPipeline(pivotPipeline, context, spec);
|
879
1075
|
return execPipeline(pipeline, context, spec);
|
880
1076
|
};
|
881
1077
|
const pivotIndicators = (chartPipeline)=>(spec, context)=>{
|
@@ -947,6 +1143,154 @@ const pivotIndicators_pivotIndicatorsAsCol = (spec)=>{
|
|
947
1143
|
indicatorsAsCol: true
|
948
1144
|
};
|
949
1145
|
};
|
1146
|
+
const pivotGridStyle = (spec)=>{
|
1147
|
+
const result = {
|
1148
|
+
...spec
|
1149
|
+
};
|
1150
|
+
const transparent = 'rgba(0,0,0,0)';
|
1151
|
+
return {
|
1152
|
+
...result,
|
1153
|
+
theme: {
|
1154
|
+
underlayBackgroundColor: transparent,
|
1155
|
+
bodyStyle: {
|
1156
|
+
borderColor: 'rgba(0,4,20,0.2)',
|
1157
|
+
borderLineWidth: [
|
1158
|
+
0,
|
1159
|
+
0,
|
1160
|
+
2,
|
1161
|
+
0
|
1162
|
+
],
|
1163
|
+
bgColor: transparent,
|
1164
|
+
padding: [
|
1165
|
+
0,
|
1166
|
+
0,
|
1167
|
+
1,
|
1168
|
+
0
|
1169
|
+
]
|
1170
|
+
},
|
1171
|
+
headerStyle: {
|
1172
|
+
borderColor: 'rgba(0,4,20,0.2)',
|
1173
|
+
fontSize: 12,
|
1174
|
+
color: '#333333',
|
1175
|
+
textAlign: 'center',
|
1176
|
+
borderLineWidth: 0,
|
1177
|
+
bgColor: transparent,
|
1178
|
+
hover: {
|
1179
|
+
cellBgColor: 'rgba(178,186,207, 0.2)'
|
1180
|
+
}
|
1181
|
+
},
|
1182
|
+
rowHeaderStyle: {
|
1183
|
+
borderColor: 'rgba(0,4,20,0.2)',
|
1184
|
+
fontSize: 12,
|
1185
|
+
color: '#333333',
|
1186
|
+
borderLineWidth: 0,
|
1187
|
+
bgColor: transparent,
|
1188
|
+
hover: {
|
1189
|
+
cellBgColor: 'rgba(178,186,207, 0.2)'
|
1190
|
+
}
|
1191
|
+
},
|
1192
|
+
cornerHeaderStyle: {
|
1193
|
+
borderColor: 'rgba(0,4,20,0.2)',
|
1194
|
+
textAlign: 'center',
|
1195
|
+
fontSize: 12,
|
1196
|
+
color: '#333333',
|
1197
|
+
fontWeight: 'bold',
|
1198
|
+
borderLineWidth: [
|
1199
|
+
0,
|
1200
|
+
0,
|
1201
|
+
0,
|
1202
|
+
0
|
1203
|
+
],
|
1204
|
+
bgColor: transparent,
|
1205
|
+
hover: {
|
1206
|
+
cellBgColor: ''
|
1207
|
+
}
|
1208
|
+
},
|
1209
|
+
cornerRightTopCellStyle: {
|
1210
|
+
borderColor: 'rgba(0,4,20,0.2)',
|
1211
|
+
borderLineWidth: 0,
|
1212
|
+
bgColor: transparent,
|
1213
|
+
hover: {
|
1214
|
+
cellBgColor: ''
|
1215
|
+
}
|
1216
|
+
},
|
1217
|
+
cornerLeftBottomCellStyle: {
|
1218
|
+
borderColor: 'rgba(0,4,20,0.2)',
|
1219
|
+
borderLineWidth: 0,
|
1220
|
+
bgColor: transparent,
|
1221
|
+
hover: {
|
1222
|
+
cellBgColor: ''
|
1223
|
+
}
|
1224
|
+
},
|
1225
|
+
cornerRightBottomCellStyle: {
|
1226
|
+
borderColor: 'rgba(0,4,20,0.2)',
|
1227
|
+
borderLineWidth: 0,
|
1228
|
+
bgColor: transparent,
|
1229
|
+
hover: {
|
1230
|
+
cellBgColor: ''
|
1231
|
+
}
|
1232
|
+
},
|
1233
|
+
rightFrozenStyle: {
|
1234
|
+
borderColor: 'rgba(0,4,20,0.2)',
|
1235
|
+
borderLineWidth: 0,
|
1236
|
+
bgColor: transparent,
|
1237
|
+
hover: {
|
1238
|
+
cellBgColor: 'rgba(178,186,207, 0.2)'
|
1239
|
+
}
|
1240
|
+
},
|
1241
|
+
bottomFrozenStyle: {
|
1242
|
+
borderColor: 'rgba(0,4,20,0.2)',
|
1243
|
+
borderLineWidth: 0,
|
1244
|
+
bgColor: transparent,
|
1245
|
+
hover: {
|
1246
|
+
cellBgColor: 'rgba(178,186,207, 0.2)'
|
1247
|
+
}
|
1248
|
+
},
|
1249
|
+
selectionStyle: {
|
1250
|
+
cellBgColor: '',
|
1251
|
+
cellBorderColor: ''
|
1252
|
+
},
|
1253
|
+
frameStyle: {
|
1254
|
+
borderLineWidth: 0,
|
1255
|
+
bgColor: transparent
|
1256
|
+
}
|
1257
|
+
}
|
1258
|
+
};
|
1259
|
+
};
|
1260
|
+
const pivotColumnDimensions = (spec, context)=>{
|
1261
|
+
const result = {
|
1262
|
+
...spec
|
1263
|
+
};
|
1264
|
+
const { advancedVSeed } = context;
|
1265
|
+
const { dimensions } = advancedVSeed;
|
1266
|
+
if (!dimensions) return result;
|
1267
|
+
const columnDimensions = dimensions.filter((dim)=>'columnDimension' === dim.location);
|
1268
|
+
const columns = columnDimensions.map((dim)=>({
|
1269
|
+
dimensionKey: dim.id,
|
1270
|
+
title: dim.alias || dim.id
|
1271
|
+
}));
|
1272
|
+
return {
|
1273
|
+
...result,
|
1274
|
+
columns: columns
|
1275
|
+
};
|
1276
|
+
};
|
1277
|
+
const pivotRowDimensions = (spec, context)=>{
|
1278
|
+
const result = {
|
1279
|
+
...spec
|
1280
|
+
};
|
1281
|
+
const { advancedVSeed } = context;
|
1282
|
+
const { dimensions } = advancedVSeed;
|
1283
|
+
if (!dimensions) return result;
|
1284
|
+
const rowDimensions = dimensions.filter((dim)=>'rowDimension' === dim.location);
|
1285
|
+
const rows = rowDimensions.map((dim)=>({
|
1286
|
+
dimensionKey: dim.id,
|
1287
|
+
title: dim.alias || dim.id
|
1288
|
+
}));
|
1289
|
+
return {
|
1290
|
+
...result,
|
1291
|
+
rows: rows
|
1292
|
+
};
|
1293
|
+
};
|
950
1294
|
const line = [
|
951
1295
|
initLine,
|
952
1296
|
color_color,
|
@@ -960,6 +1304,7 @@ const line = [
|
|
960
1304
|
];
|
961
1305
|
const pivotLine = [
|
962
1306
|
initPivot,
|
1307
|
+
pivotGridStyle,
|
963
1308
|
pivotIndicators_pivotIndicatorsAsRow,
|
964
1309
|
datasetPivot,
|
965
1310
|
pivotIndicators([
|
@@ -972,6 +1317,8 @@ const pivotLine = [
|
|
972
1317
|
label_label,
|
973
1318
|
tooltip_tooltip
|
974
1319
|
]),
|
1320
|
+
pivotRowDimensions,
|
1321
|
+
pivotColumnDimensions,
|
975
1322
|
pivotLegend
|
976
1323
|
];
|
977
1324
|
const lineSpecPipeline = [
|
@@ -990,6 +1337,7 @@ const column = [
|
|
990
1337
|
];
|
991
1338
|
const pivotColumn = [
|
992
1339
|
initPivot,
|
1340
|
+
pivotGridStyle,
|
993
1341
|
pivotIndicators_pivotIndicatorsAsRow,
|
994
1342
|
datasetPivot,
|
995
1343
|
pivotIndicators([
|
@@ -1002,6 +1350,8 @@ const pivotColumn = [
|
|
1002
1350
|
label_label,
|
1003
1351
|
tooltip_tooltip
|
1004
1352
|
]),
|
1353
|
+
pivotRowDimensions,
|
1354
|
+
pivotColumnDimensions,
|
1005
1355
|
pivotLegend
|
1006
1356
|
];
|
1007
1357
|
const columnSpecPipeline = [
|
@@ -1020,6 +1370,7 @@ const columnParallel = [
|
|
1020
1370
|
];
|
1021
1371
|
const pivotColumnParallel = [
|
1022
1372
|
initPivot,
|
1373
|
+
pivotGridStyle,
|
1023
1374
|
pivotIndicators_pivotIndicatorsAsRow,
|
1024
1375
|
datasetPivot,
|
1025
1376
|
pivotIndicators([
|
@@ -1032,6 +1383,8 @@ const pivotColumnParallel = [
|
|
1032
1383
|
label_label,
|
1033
1384
|
tooltip_tooltip
|
1034
1385
|
]),
|
1386
|
+
pivotRowDimensions,
|
1387
|
+
pivotColumnDimensions,
|
1035
1388
|
pivotLegend
|
1036
1389
|
];
|
1037
1390
|
const columnParallelSpecPipeline = [
|
@@ -1051,6 +1404,7 @@ const columnPercent = [
|
|
1051
1404
|
];
|
1052
1405
|
const pivotColumnPercent = [
|
1053
1406
|
initPivot,
|
1407
|
+
pivotGridStyle,
|
1054
1408
|
pivotIndicators_pivotIndicatorsAsRow,
|
1055
1409
|
datasetPivot,
|
1056
1410
|
pivotIndicators([
|
@@ -1064,6 +1418,8 @@ const pivotColumnPercent = [
|
|
1064
1418
|
label_label,
|
1065
1419
|
tooltip_tooltip
|
1066
1420
|
]),
|
1421
|
+
pivotRowDimensions,
|
1422
|
+
pivotColumnDimensions,
|
1067
1423
|
pivotLegend
|
1068
1424
|
];
|
1069
1425
|
const columnPercentSpecPipeline = [
|
@@ -1082,6 +1438,7 @@ const bar = [
|
|
1082
1438
|
];
|
1083
1439
|
const pivotBar = [
|
1084
1440
|
initPivot,
|
1441
|
+
pivotGridStyle,
|
1085
1442
|
pivotIndicators_pivotIndicatorsAsCol,
|
1086
1443
|
datasetPivot,
|
1087
1444
|
pivotIndicators([
|
@@ -1094,6 +1451,8 @@ const pivotBar = [
|
|
1094
1451
|
label_label,
|
1095
1452
|
tooltip_tooltip
|
1096
1453
|
]),
|
1454
|
+
pivotRowDimensions,
|
1455
|
+
pivotColumnDimensions,
|
1097
1456
|
pivotLegend
|
1098
1457
|
];
|
1099
1458
|
const barSpecPipeline = [
|
@@ -1112,6 +1471,7 @@ const barParallel = [
|
|
1112
1471
|
];
|
1113
1472
|
const pivotBarParallel = [
|
1114
1473
|
initPivot,
|
1474
|
+
pivotGridStyle,
|
1115
1475
|
pivotIndicators_pivotIndicatorsAsCol,
|
1116
1476
|
datasetPivot,
|
1117
1477
|
pivotIndicators([
|
@@ -1124,6 +1484,8 @@ const pivotBarParallel = [
|
|
1124
1484
|
label_label,
|
1125
1485
|
tooltip_tooltip
|
1126
1486
|
]),
|
1487
|
+
pivotRowDimensions,
|
1488
|
+
pivotColumnDimensions,
|
1127
1489
|
pivotLegend
|
1128
1490
|
];
|
1129
1491
|
const barParallelSpecPipeline = [
|
@@ -1143,6 +1505,7 @@ const barPercent = [
|
|
1143
1505
|
];
|
1144
1506
|
const pivotBarPercent = [
|
1145
1507
|
initPivot,
|
1508
|
+
pivotGridStyle,
|
1146
1509
|
pivotIndicators_pivotIndicatorsAsCol,
|
1147
1510
|
datasetPivot,
|
1148
1511
|
pivotIndicators([
|
@@ -1156,6 +1519,8 @@ const pivotBarPercent = [
|
|
1156
1519
|
label_label,
|
1157
1520
|
tooltip_tooltip
|
1158
1521
|
]),
|
1522
|
+
pivotRowDimensions,
|
1523
|
+
pivotColumnDimensions,
|
1159
1524
|
pivotLegend
|
1160
1525
|
];
|
1161
1526
|
const barPercentSpecPipeline = [
|
@@ -1175,6 +1540,7 @@ const area_area = [
|
|
1175
1540
|
];
|
1176
1541
|
const pivotArea = [
|
1177
1542
|
initPivot,
|
1543
|
+
pivotGridStyle,
|
1178
1544
|
pivotIndicators_pivotIndicatorsAsRow,
|
1179
1545
|
datasetPivot,
|
1180
1546
|
pivotIndicators([
|
@@ -1188,6 +1554,8 @@ const pivotArea = [
|
|
1188
1554
|
label_label,
|
1189
1555
|
tooltip_tooltip
|
1190
1556
|
]),
|
1557
|
+
pivotRowDimensions,
|
1558
|
+
pivotColumnDimensions,
|
1191
1559
|
pivotLegend
|
1192
1560
|
];
|
1193
1561
|
const areaSpecPipeline = [
|
@@ -1207,6 +1575,7 @@ const areaPercent = [
|
|
1207
1575
|
];
|
1208
1576
|
const pivotAreaPercent = [
|
1209
1577
|
initPivot,
|
1578
|
+
pivotGridStyle,
|
1210
1579
|
pivotIndicators_pivotIndicatorsAsRow,
|
1211
1580
|
datasetPivot,
|
1212
1581
|
pivotIndicators([
|
@@ -1220,11 +1589,42 @@ const pivotAreaPercent = [
|
|
1220
1589
|
label_label,
|
1221
1590
|
tooltip_tooltip
|
1222
1591
|
]),
|
1592
|
+
pivotRowDimensions,
|
1593
|
+
pivotColumnDimensions,
|
1223
1594
|
pivotLegend
|
1224
1595
|
];
|
1225
1596
|
const areaPercentSpecPipeline = [
|
1226
1597
|
pivotAdapter_pivotAdapter(areaPercent, pivotAreaPercent)
|
1227
1598
|
];
|
1599
|
+
const pie = [
|
1600
|
+
initPie,
|
1601
|
+
color_color,
|
1602
|
+
background_backgroundColor,
|
1603
|
+
dataset_dataset,
|
1604
|
+
label_label,
|
1605
|
+
tooltip_tooltip,
|
1606
|
+
legend_legend
|
1607
|
+
];
|
1608
|
+
const pivotPie = [
|
1609
|
+
initPivot,
|
1610
|
+
pivotGridStyle,
|
1611
|
+
pivotIndicators_pivotIndicatorsAsRow,
|
1612
|
+
datasetPivot,
|
1613
|
+
pivotIndicators([
|
1614
|
+
initPie,
|
1615
|
+
color_color,
|
1616
|
+
background_backgroundColor,
|
1617
|
+
datasetPivotPlaceholder,
|
1618
|
+
label_label,
|
1619
|
+
tooltip_tooltip
|
1620
|
+
]),
|
1621
|
+
pivotRowDimensions,
|
1622
|
+
pivotColumnDimensions,
|
1623
|
+
pivotLegend
|
1624
|
+
];
|
1625
|
+
const pieSpecPipeline = [
|
1626
|
+
pivotAdapter_pivotAdapter(pie, pivotPie)
|
1627
|
+
];
|
1228
1628
|
const buildAdvanced = (builder)=>{
|
1229
1629
|
const { chartType } = builder.vseed;
|
1230
1630
|
if (!chartType) throw new Error('chartType is nil in buildAdvanced');
|
@@ -1332,6 +1732,10 @@ const registerBarParallel = ()=>{
|
|
1332
1732
|
Builder._advancedPipelineMap.barParallel = barParallelAdvancedPipeline;
|
1333
1733
|
Builder._specPipelineMap.barParallel = barParallelSpecPipeline;
|
1334
1734
|
};
|
1735
|
+
const registerPie = ()=>{
|
1736
|
+
Builder._advancedPipelineMap.pie = pieAdvancedPipeline;
|
1737
|
+
Builder._specPipelineMap.pie = pieSpecPipeline;
|
1738
|
+
};
|
1335
1739
|
const darkTheme = ()=>({
|
1336
1740
|
baseConfig: {
|
1337
1741
|
vtable: {
|
@@ -1417,6 +1821,7 @@ const all_registerAll = ()=>{
|
|
1417
1821
|
registerBarPercent();
|
1418
1822
|
registerArea();
|
1419
1823
|
registerAreaPercent();
|
1824
|
+
registerPie();
|
1420
1825
|
registerLightTheme();
|
1421
1826
|
registerDarkTheme();
|
1422
1827
|
};
|
@@ -1540,6 +1945,6 @@ const zCustomThemeConfig = z.object({
|
|
1540
1945
|
});
|
1541
1946
|
const zCustomTheme = z.record(z.string(), zCustomThemeConfig).optional();
|
1542
1947
|
const zTheme = z.string();
|
1543
|
-
export { Builder, areaAdvancedPipeline, areaPercentAdvancedPipeline, areaPercentSpecPipeline, areaSpecPipeline, barAdvancedPipeline, barParallelAdvancedPipeline, barParallelSpecPipeline, barPercentAdvancedPipeline, barPercentSpecPipeline, barSpecPipeline, columnAdvancedPipeline, columnParallelAdvancedPipeline, columnParallelSpecPipeline, columnPercentAdvancedPipeline, columnPercentSpecPipeline, columnSpecPipeline, darkTheme,
|
1948
|
+
export { Builder, areaAdvancedPipeline, areaPercentAdvancedPipeline, areaPercentSpecPipeline, areaSpecPipeline, barAdvancedPipeline, barParallelAdvancedPipeline, barParallelSpecPipeline, barPercentAdvancedPipeline, barPercentSpecPipeline, barSpecPipeline, columnAdvancedPipeline, columnParallelAdvancedPipeline, columnParallelSpecPipeline, columnPercentAdvancedPipeline, columnPercentSpecPipeline, columnSpecPipeline, darkTheme, dataReshapeFor1D1M, dataReshapeFor2D1M, execPipeline, foldMeasures, isPivotChart, isVChart, isVTable, lightTheme, lineAdvancedPipeline, lineSpecPipeline, pieAdvancedPipeline, pieSpecPipeline, all_registerAll as registerAll, registerArea, registerAreaPercent, registerBar, registerBarParallel, registerBarPercent, registerColumn, registerColumnParallel, registerColumnPercent, registerCustomTheme, registerDarkTheme, registerLightTheme, registerLine, unfoldDimensions, zBackgroundColor, zBaseConfig, zChartType, zColor, zCustomTheme, zCustomThemeConfig, zDataset, zDatasetReshapeInfo, zDatum, zDimension, zDimensions, zEncoding, zFoldInfo, zLabel, zLegend, zMeasure, zMeasureGroup, zMeasures, zTheme, zTooltip, zUnfoldInfo };
|
1544
1949
|
|
1545
1950
|
//# sourceMappingURL=index.js.map
|