@visactor/vseed 0.0.6 → 0.0.8
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/builder/builder.d.ts +5752 -0
- package/dist/builder/register/chartType.d.ts +1 -0
- package/dist/dataReshape/index.d.ts +1 -0
- package/dist/index.cjs +1362 -137
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1316 -133
- package/dist/index.js.map +1 -1
- package/dist/pipeline/advanced/pipeline/index.d.ts +1 -0
- package/dist/pipeline/advanced/pipeline/pie.d.ts +2 -0
- package/dist/pipeline/advanced/pipes/config/config.d.ts +11 -0
- package/dist/pipeline/advanced/pipes/config/index.d.ts +1 -0
- package/dist/pipeline/advanced/pipes/encoding/encodingPolar.d.ts +2 -0
- package/dist/pipeline/advanced/pipes/encoding/index.d.ts +1 -0
- package/dist/pipeline/advanced/pipes/index.d.ts +2 -1
- 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/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.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/dist/types/advancedVSeed.d.ts +1438 -0
- package/dist/types/chartType/area/area.d.ts +11 -1
- package/dist/types/chartType/areaPercent/areaPercent.d.ts +11 -1
- package/dist/types/chartType/bar/bar.d.ts +11 -1
- package/dist/types/chartType/barParallel/barParallel.d.ts +11 -1
- package/dist/types/chartType/barPercent/barPercent.d.ts +11 -1
- package/dist/types/chartType/column/column.d.ts +11 -1
- package/dist/types/chartType/columnParallel/columnParallel.d.ts +11 -1
- package/dist/types/chartType/columnPercent/columnPercent.d.ts +11 -1
- package/dist/types/chartType/donut/donut.d.ts +1 -1
- package/dist/types/chartType/dualAxis/dualAxis.d.ts +1 -1
- package/dist/types/chartType/line/line.d.ts +11 -1
- package/dist/types/chartType/pie/pie.d.ts +4 -4
- package/dist/types/chartType/pivotTable/pivotTable.d.ts +1 -1
- package/dist/types/chartType/rose/rose.d.ts +4 -4
- package/dist/types/chartType/table/table.d.ts +1 -1
- package/dist/types/properties/chartType/index.d.ts +2 -2
- package/dist/types/properties/config/axis.d.ts +257 -0
- package/dist/types/properties/config/bandAxis.d.ts +82 -0
- package/dist/types/properties/config/config.d.ts +721 -0
- package/dist/types/properties/config/index.d.ts +4 -0
- package/dist/types/properties/config/linearAxis.d.ts +80 -0
- package/dist/types/properties/index.d.ts +1 -0
- package/dist/types/properties/theme/customTheme.d.ts +1438 -0
- package/package.json +1 -1
- /package/dist/types/properties/chartType/{zChartType.d.ts → chartType.d.ts} +0 -0
package/dist/index.js
CHANGED
@@ -1,11 +1,134 @@
|
|
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
|
-
|
3
|
+
const initAdvancedVSeed = (advancedVSeed, context)=>{
|
4
|
+
const { vseed } = context;
|
5
|
+
const { chartType = 'table' } = vseed;
|
6
|
+
return {
|
7
|
+
...advancedVSeed,
|
8
|
+
chartType
|
9
|
+
};
|
10
|
+
};
|
11
|
+
const execPipeline = (pipeline, context, initialValue = {})=>{
|
12
|
+
const result = pipeline.reduce((prev, cur)=>cur(prev, context), initialValue);
|
13
|
+
return result;
|
14
|
+
};
|
15
|
+
const isVTable = (chartType)=>[
|
16
|
+
'table',
|
17
|
+
'pivotTable'
|
18
|
+
].includes(chartType);
|
19
|
+
const isVChart = (chartType)=>!isVTable(chartType);
|
20
|
+
const isPivotChart = (vseed)=>{
|
21
|
+
const { measures, dimensions } = vseed;
|
22
|
+
const hasRowOrColumnDimension = dimensions && dimensions.some((dimension)=>'rowDimension' === dimension.location || 'columnDimension' === dimension.location);
|
23
|
+
const hasMeasureGroup = measures && measures.find((measure)=>measure && measure.children);
|
24
|
+
return hasRowOrColumnDimension || hasMeasureGroup;
|
25
|
+
};
|
26
|
+
const autoMeasures = (advancedVSeed, context)=>{
|
27
|
+
const result = {
|
28
|
+
...advancedVSeed
|
29
|
+
};
|
30
|
+
const { vseed } = context;
|
31
|
+
const { measures, dataset } = vseed;
|
32
|
+
if (!dataset) throw new Error('dataset is required');
|
33
|
+
if (0 === dataset.length) return result;
|
34
|
+
if (isPivotChart(vseed)) return autoMeasureGroup(advancedVSeed, context);
|
35
|
+
if (measures) {
|
36
|
+
result.measures = measures;
|
37
|
+
return result;
|
38
|
+
}
|
39
|
+
const top100dataset = dataset.slice(0, 100);
|
40
|
+
const sample = top100dataset.reduce((prev, cur)=>({
|
41
|
+
...prev,
|
42
|
+
...cur
|
43
|
+
}), {});
|
44
|
+
result.measures = Object.keys(sample).filter((key)=>top100dataset.some((item)=>'number' == typeof item[key]) && ![
|
45
|
+
'',
|
46
|
+
null,
|
47
|
+
void 0
|
48
|
+
].includes(key)).map((measure)=>({
|
49
|
+
id: measure,
|
50
|
+
alias: measure
|
51
|
+
}));
|
52
|
+
return result;
|
53
|
+
};
|
54
|
+
const autoMeasureGroup = (advancedVSeed, context)=>{
|
55
|
+
const { vseed } = context;
|
56
|
+
const { measures } = vseed;
|
57
|
+
const hasMeasureGroup = measures?.some((measure)=>measure.children);
|
58
|
+
if (!measures) return advancedVSeed;
|
59
|
+
if (!hasMeasureGroup) {
|
60
|
+
const newMeasures = [
|
61
|
+
{
|
62
|
+
id: 'measureGroup',
|
63
|
+
alias: 'measureGroup',
|
64
|
+
children: measures
|
65
|
+
}
|
66
|
+
];
|
67
|
+
return {
|
68
|
+
...advancedVSeed,
|
69
|
+
measures: newMeasures
|
70
|
+
};
|
71
|
+
}
|
72
|
+
let currentGroup = createEmptyMeasureGroup();
|
73
|
+
const measureGroups = [];
|
74
|
+
for (const measure of measures)if ('children' in measure) {
|
75
|
+
if (currentGroup.children?.length) {
|
76
|
+
currentGroup.id = currentGroup.children.map((item)=>item.id).join('-');
|
77
|
+
currentGroup.alias = currentGroup.children.map((item)=>item.alias).join('-');
|
78
|
+
measureGroups.push(currentGroup);
|
79
|
+
currentGroup = createEmptyMeasureGroup();
|
80
|
+
}
|
81
|
+
measureGroups.push(measure);
|
82
|
+
} else currentGroup.children?.push(measure);
|
83
|
+
if (currentGroup.children?.length) {
|
84
|
+
currentGroup.id = currentGroup.children.map((item)=>item.id).join('-');
|
85
|
+
currentGroup.alias = currentGroup.children.map((item)=>item.alias).join('-');
|
86
|
+
measureGroups.push(currentGroup);
|
87
|
+
currentGroup = createEmptyMeasureGroup();
|
88
|
+
}
|
89
|
+
advancedVSeed.measures = measureGroups;
|
90
|
+
return advancedVSeed;
|
91
|
+
};
|
92
|
+
const createEmptyMeasureGroup = ()=>({
|
93
|
+
id: '',
|
94
|
+
alias: '',
|
95
|
+
children: []
|
96
|
+
});
|
97
|
+
const autoDimensions = (advancedVSeed, context)=>{
|
98
|
+
const result = {
|
99
|
+
...advancedVSeed
|
100
|
+
};
|
101
|
+
const { vseed } = context;
|
102
|
+
const { dimensions, dataset } = vseed;
|
103
|
+
const { measures = [] } = advancedVSeed;
|
104
|
+
if (!dataset) throw new Error('dataset is required');
|
105
|
+
if (0 === dataset.length) return result;
|
106
|
+
if (dimensions) {
|
107
|
+
result.dimensions = dimensions;
|
108
|
+
return result;
|
109
|
+
}
|
110
|
+
const top100dataset = dataset.slice(0, 100);
|
111
|
+
const sample = top100dataset.reduce((prev, cur)=>({
|
112
|
+
...prev,
|
113
|
+
...cur
|
114
|
+
}), {});
|
115
|
+
result.dimensions = Object.keys(sample).filter((key)=>top100dataset.some((item)=>'string' == typeof item[key]) && ![
|
116
|
+
'',
|
117
|
+
null,
|
118
|
+
void 0
|
119
|
+
].includes(key) && !measures.some((measure)=>measure.id === key)).map((dim)=>({
|
120
|
+
id: dim,
|
121
|
+
alias: dim,
|
122
|
+
location: 'dimension'
|
123
|
+
}));
|
124
|
+
return result;
|
125
|
+
};
|
126
|
+
const FoldMeasureName = '__MeaName__';
|
127
|
+
const FoldMeasureValue = '__MeaValue__';
|
128
|
+
const FoldMeasureId = '__MeaId__';
|
129
|
+
const UnfoldDimensionGroup = '__DimGroup__';
|
7
130
|
const Separator = '-';
|
8
|
-
const unfoldDimensions = (dataset, dimensions, measures, unfoldStartIndex = 0, foldGroupName =
|
131
|
+
const unfoldDimensions = (dataset, dimensions, measures, unfoldStartIndex = 0, foldGroupName = UnfoldDimensionGroup, dimensionsSeparator = Separator)=>{
|
9
132
|
if (unfoldStartIndex < 0 || unfoldStartIndex >= dimensions.length) throw new Error('unfoldStartIndex is out of range');
|
10
133
|
const dimensionsToBeUnfolded = dimensions.slice(unfoldStartIndex);
|
11
134
|
const unfoldInfo = {
|
@@ -33,7 +156,7 @@ const unfoldDimensions = (dataset, dimensions, measures, unfoldStartIndex = 0, f
|
|
33
156
|
};
|
34
157
|
};
|
35
158
|
const generateDimGroupName = (dimensionsToBeGrouped, datum, dimensionsSeparator)=>dimensionsToBeGrouped.map((dim)=>String(datum[dim.id])).join(dimensionsSeparator);
|
36
|
-
const foldMeasures = (dataset, measures, measureId =
|
159
|
+
const foldMeasures = (dataset, measures, measureId = FoldMeasureId, measureName = FoldMeasureName, measureValue = FoldMeasureValue)=>{
|
37
160
|
const foldInfo = {
|
38
161
|
measureId,
|
39
162
|
measureName,
|
@@ -73,7 +196,7 @@ const emptyReshapeResult = {
|
|
73
196
|
}
|
74
197
|
};
|
75
198
|
const dataReshapeFor2D1M = (dataset, dimensions, measures, options)=>{
|
76
|
-
const { foldMeasureId =
|
199
|
+
const { foldMeasureId = FoldMeasureId, foldMeasureName = FoldMeasureName, foldMeasureValue = FoldMeasureValue, unfoldDimensionGroup = UnfoldDimensionGroup } = options || {};
|
77
200
|
if (0 === dimensions.length && 0 === measures.length) return emptyReshapeResult;
|
78
201
|
const { dataset: foldedDataset, foldInfo } = foldMeasures(dataset, measures, foldMeasureId, foldMeasureName, foldMeasureValue);
|
79
202
|
if (0 === dimensions.length) {
|
@@ -134,8 +257,8 @@ const dataReshapeFor1D1M_emptyReshapeResult = {
|
|
134
257
|
colorItems: []
|
135
258
|
}
|
136
259
|
};
|
137
|
-
const
|
138
|
-
const { foldMeasureId =
|
260
|
+
const dataReshapeFor1D1M = (dataset, dimensions, measures, options)=>{
|
261
|
+
const { foldMeasureId = FoldMeasureId, foldMeasureName = FoldMeasureName, foldMeasureValue = FoldMeasureValue, unfoldDimensionGroup = UnfoldDimensionGroup } = options || {};
|
139
262
|
if (0 === dimensions.length && 0 === measures.length) return dataReshapeFor1D1M_emptyReshapeResult;
|
140
263
|
const { dataset: foldedDataset, foldInfo } = foldMeasures(dataset, measures, foldMeasureId, foldMeasureName, foldMeasureValue);
|
141
264
|
if (0 === dimensions.length) {
|
@@ -202,6 +325,67 @@ const reshapeTo2D1M = (advancedVSeed, context)=>{
|
|
202
325
|
measures
|
203
326
|
};
|
204
327
|
};
|
328
|
+
const reshapeTo1D1M = (advancedVSeed, context)=>{
|
329
|
+
const result = {
|
330
|
+
...advancedVSeed
|
331
|
+
};
|
332
|
+
const { vseed } = context;
|
333
|
+
const { dataset } = vseed;
|
334
|
+
const { dimensions, measures } = advancedVSeed;
|
335
|
+
if (!measures || !dimensions || !dataset) return result;
|
336
|
+
if (0 === measures.length) throw new Error('measures can not be empty');
|
337
|
+
const { dataset: newDatasets, foldInfo, unfoldInfo } = dataReshapeFor1D1M(dataset, dimensions, measures);
|
338
|
+
return {
|
339
|
+
...result,
|
340
|
+
dataset: newDatasets,
|
341
|
+
datasetReshapeInfo: [
|
342
|
+
{
|
343
|
+
id: '1D1M',
|
344
|
+
foldInfo,
|
345
|
+
unfoldInfo
|
346
|
+
}
|
347
|
+
]
|
348
|
+
};
|
349
|
+
};
|
350
|
+
const pivotReshapeTo1D1M = (advancedVSeed, context)=>{
|
351
|
+
const result = {
|
352
|
+
...advancedVSeed
|
353
|
+
};
|
354
|
+
const { vseed } = context;
|
355
|
+
const { dataset } = vseed;
|
356
|
+
const { dimensions, measures } = advancedVSeed;
|
357
|
+
if (!measures || !dimensions) return result;
|
358
|
+
const measureGroups = [];
|
359
|
+
if (measures) measures.forEach((measure)=>{
|
360
|
+
if (measure.children && measure.children.length > 0) measureGroups.push(measure);
|
361
|
+
});
|
362
|
+
const newDatasets = [];
|
363
|
+
const datasetReshapeInfo = [];
|
364
|
+
measureGroups.forEach((measureGroup)=>{
|
365
|
+
const measures = measureGroup.children;
|
366
|
+
if (!measures) return;
|
367
|
+
const commonDimensions = dimensions.filter((dim)=>'dimension' === dim.location);
|
368
|
+
const groupId = measureGroup.id;
|
369
|
+
const { dataset: newSubDataset, foldInfo, unfoldInfo } = dataReshapeFor1D1M(dataset, commonDimensions, measures, {
|
370
|
+
foldMeasureId: FoldMeasureId,
|
371
|
+
foldMeasureName: FoldMeasureName,
|
372
|
+
foldMeasureValue: FoldMeasureValue + groupId,
|
373
|
+
unfoldDimensionGroup: UnfoldDimensionGroup
|
374
|
+
});
|
375
|
+
const reshapeInfo = {
|
376
|
+
id: groupId,
|
377
|
+
foldInfo,
|
378
|
+
unfoldInfo
|
379
|
+
};
|
380
|
+
newDatasets.push(newSubDataset);
|
381
|
+
datasetReshapeInfo.push(reshapeInfo);
|
382
|
+
});
|
383
|
+
return {
|
384
|
+
...result,
|
385
|
+
dataset: newDatasets,
|
386
|
+
datasetReshapeInfo: datasetReshapeInfo
|
387
|
+
};
|
388
|
+
};
|
205
389
|
const pivotReshapeTo2D1M = (advancedVSeed, context)=>{
|
206
390
|
const result = {
|
207
391
|
...advancedVSeed
|
@@ -214,17 +398,18 @@ const pivotReshapeTo2D1M = (advancedVSeed, context)=>{
|
|
214
398
|
if (measures) measures.forEach((measure)=>{
|
215
399
|
if (measure.children && measure.children.length > 0) measureGroups.push(measure);
|
216
400
|
});
|
401
|
+
const commonDimensions = dimensions.filter((dim)=>'dimension' === dim.location);
|
217
402
|
const newDatasets = [];
|
218
403
|
const datasetReshapeInfo = [];
|
219
404
|
measureGroups.forEach((measureGroup)=>{
|
220
405
|
const measures = measureGroup.children;
|
221
406
|
if (!measures) return;
|
222
407
|
const groupId = measureGroup.id;
|
223
|
-
const { dataset: newSubDataset, foldInfo, unfoldInfo } = dataReshapeFor2D1M(dataset,
|
224
|
-
foldMeasureId:
|
225
|
-
foldMeasureName:
|
226
|
-
foldMeasureValue:
|
227
|
-
unfoldDimensionGroup:
|
408
|
+
const { dataset: newSubDataset, foldInfo, unfoldInfo } = dataReshapeFor2D1M(dataset, commonDimensions, measures, {
|
409
|
+
foldMeasureId: FoldMeasureId,
|
410
|
+
foldMeasureName: FoldMeasureName,
|
411
|
+
foldMeasureValue: FoldMeasureValue + groupId,
|
412
|
+
unfoldDimensionGroup: UnfoldDimensionGroup
|
228
413
|
});
|
229
414
|
const reshapeInfo = {
|
230
415
|
id: groupId,
|
@@ -312,69 +497,40 @@ const encodingYX = (advancedVSeed)=>{
|
|
312
497
|
encoding
|
313
498
|
};
|
314
499
|
};
|
315
|
-
const
|
316
|
-
const { vseed } = context;
|
317
|
-
const { chartType = 'table' } = vseed;
|
318
|
-
return {
|
319
|
-
...advancedVSeed,
|
320
|
-
chartType
|
321
|
-
};
|
322
|
-
};
|
323
|
-
const autoMeasures = (advancedVSeed, context)=>{
|
500
|
+
const encodingPolar = (advancedVSeed)=>{
|
324
501
|
const result = {
|
325
502
|
...advancedVSeed
|
326
503
|
};
|
327
|
-
const {
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
504
|
+
const { datasetReshapeInfo, dimensions } = advancedVSeed;
|
505
|
+
if (!datasetReshapeInfo || !dimensions) return result;
|
506
|
+
const encoding = datasetReshapeInfo.reduce((prev, cur)=>{
|
507
|
+
const { foldInfo, unfoldInfo } = cur;
|
508
|
+
const radius = [
|
509
|
+
foldInfo.measureValue
|
510
|
+
];
|
511
|
+
const angle = [
|
512
|
+
unfoldInfo.groupName
|
513
|
+
];
|
514
|
+
const group = [
|
515
|
+
unfoldInfo.groupName
|
516
|
+
];
|
517
|
+
const color = [
|
518
|
+
unfoldInfo.groupName
|
519
|
+
];
|
520
|
+
return [
|
337
521
|
...prev,
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
]
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
};
|
350
|
-
const autoDimensions = (advancedVSeed, context)=>{
|
351
|
-
const result = {
|
352
|
-
...advancedVSeed
|
522
|
+
{
|
523
|
+
angle,
|
524
|
+
radius,
|
525
|
+
group,
|
526
|
+
color
|
527
|
+
}
|
528
|
+
];
|
529
|
+
}, []);
|
530
|
+
return {
|
531
|
+
...result,
|
532
|
+
encoding
|
353
533
|
};
|
354
|
-
const { vseed } = context;
|
355
|
-
const { dimensions, dataset } = vseed;
|
356
|
-
const { measures = [] } = advancedVSeed;
|
357
|
-
if (!dataset) throw new Error('dataset is required');
|
358
|
-
if (0 === dataset.length) return result;
|
359
|
-
if (dimensions) {
|
360
|
-
result.dimensions = dimensions;
|
361
|
-
return result;
|
362
|
-
}
|
363
|
-
const top100dataset = dataset.slice(0, 100);
|
364
|
-
const sample = top100dataset.reduce((prev, cur)=>({
|
365
|
-
...prev,
|
366
|
-
...cur
|
367
|
-
}), {});
|
368
|
-
result.dimensions = Object.keys(sample).filter((key)=>top100dataset.some((item)=>'string' == typeof item[key]) && ![
|
369
|
-
'',
|
370
|
-
null,
|
371
|
-
void 0
|
372
|
-
].includes(key) && !measures.some((measure)=>measure.id === key)).map((dim)=>({
|
373
|
-
id: dim,
|
374
|
-
alias: dim,
|
375
|
-
location: 'dimension'
|
376
|
-
}));
|
377
|
-
return result;
|
378
534
|
};
|
379
535
|
const vchartBaseConfig = (advancedVSeed, context)=>{
|
380
536
|
const { vseed } = context;
|
@@ -395,35 +551,76 @@ const vchartBaseConfig = (advancedVSeed, context)=>{
|
|
395
551
|
};
|
396
552
|
return result;
|
397
553
|
};
|
398
|
-
const
|
399
|
-
const {
|
400
|
-
const {
|
554
|
+
const lineConfig = (advancedVSeed, context)=>{
|
555
|
+
const { vseed } = context;
|
556
|
+
const { chartType } = vseed;
|
401
557
|
const result = {
|
402
558
|
...advancedVSeed
|
403
559
|
};
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
560
|
+
const config = external_remeda_pick(vseed, [
|
561
|
+
'xAxis',
|
562
|
+
'yAxis'
|
563
|
+
]);
|
564
|
+
result.config = {
|
565
|
+
...result.config || {},
|
566
|
+
[chartType]: {
|
567
|
+
...config
|
568
|
+
}
|
411
569
|
};
|
412
570
|
return result;
|
413
571
|
};
|
414
|
-
const
|
415
|
-
const
|
572
|
+
const pieConfig = (advancedVSeed, context)=>{
|
573
|
+
const { vseed } = context;
|
574
|
+
const { chartType } = vseed;
|
575
|
+
const result = {
|
576
|
+
...advancedVSeed
|
577
|
+
};
|
578
|
+
const config = external_remeda_pick(vseed, []);
|
579
|
+
result.config = {
|
580
|
+
...result.config || {},
|
581
|
+
[chartType]: {
|
582
|
+
...config
|
583
|
+
}
|
584
|
+
};
|
585
|
+
return result;
|
586
|
+
};
|
587
|
+
const barConfig = lineConfig;
|
588
|
+
const barParallelConfig = lineConfig;
|
589
|
+
const barPercentConfig = lineConfig;
|
590
|
+
const columnConfig = lineConfig;
|
591
|
+
const columnParallelConfig = lineConfig;
|
592
|
+
const columnPercentConfig = lineConfig;
|
593
|
+
const areaConfig = lineConfig;
|
594
|
+
const areaPercentConfig = lineConfig;
|
595
|
+
const vchartTheme = (advancedVSeed, context)=>{
|
596
|
+
const { customTheme, vseed } = context;
|
597
|
+
const { theme = 'light', chartType } = vseed;
|
598
|
+
const result = {
|
599
|
+
...advancedVSeed
|
600
|
+
};
|
601
|
+
if (!customTheme || !customTheme[theme]) return result;
|
602
|
+
const baseConfigVChartTheme = customTheme?.[theme].baseConfig?.vchart;
|
603
|
+
if (baseConfigVChartTheme) {
|
604
|
+
const baseConfigVChart = result.baseConfig?.vchart || {};
|
605
|
+
const mergedConfig = external_remeda_mergeDeep(baseConfigVChartTheme, external_remeda_clone(baseConfigVChart));
|
606
|
+
result.baseConfig = {
|
607
|
+
vchart: mergedConfig
|
608
|
+
};
|
609
|
+
}
|
610
|
+
const chartConfigTheme = customTheme?.[theme].config?.[chartType];
|
611
|
+
if (chartConfigTheme) {
|
612
|
+
const chartConfig = result.config?.[chartType] || {};
|
613
|
+
const mergedConfig = external_remeda_mergeDeep(chartConfigTheme, external_remeda_clone(chartConfig));
|
614
|
+
result.config = {
|
615
|
+
[chartType]: mergedConfig
|
616
|
+
};
|
617
|
+
}
|
416
618
|
return result;
|
417
619
|
};
|
418
|
-
const isVTable = (chartType)=>[
|
419
|
-
'table',
|
420
|
-
'pivotTable'
|
421
|
-
].includes(chartType);
|
422
|
-
const isVChart = (chartType)=>!isVTable(chartType);
|
423
620
|
const pivotAdapter = (pipeline, pivotPipeline)=>(advancedVSeed, context)=>{
|
424
621
|
const { vseed } = context;
|
425
|
-
const
|
426
|
-
if (
|
622
|
+
const usePivotChart = isPivotChart(vseed);
|
623
|
+
if (usePivotChart) return execPipeline(pivotPipeline, context, advancedVSeed);
|
427
624
|
return execPipeline(pipeline, context, advancedVSeed);
|
428
625
|
};
|
429
626
|
const lineAdvancedPipeline = [
|
@@ -437,6 +634,7 @@ const lineAdvancedPipeline = [
|
|
437
634
|
]),
|
438
635
|
encodingXY,
|
439
636
|
vchartBaseConfig,
|
637
|
+
lineConfig,
|
440
638
|
vchartTheme
|
441
639
|
];
|
442
640
|
const barAdvancedPipeline = [
|
@@ -449,6 +647,7 @@ const barAdvancedPipeline = [
|
|
449
647
|
pivotReshapeTo2D1M
|
450
648
|
]),
|
451
649
|
encodingYX,
|
650
|
+
barConfig,
|
452
651
|
vchartBaseConfig,
|
453
652
|
vchartTheme
|
454
653
|
];
|
@@ -462,6 +661,7 @@ const barParallelAdvancedPipeline = [
|
|
462
661
|
pivotReshapeTo2D1M
|
463
662
|
]),
|
464
663
|
encodingYX,
|
664
|
+
barParallelConfig,
|
465
665
|
vchartBaseConfig,
|
466
666
|
vchartTheme
|
467
667
|
];
|
@@ -475,6 +675,7 @@ const barPercentAdvancedPipeline = [
|
|
475
675
|
pivotReshapeTo2D1M
|
476
676
|
]),
|
477
677
|
encodingYX,
|
678
|
+
barPercentConfig,
|
478
679
|
vchartBaseConfig,
|
479
680
|
vchartTheme
|
480
681
|
];
|
@@ -488,6 +689,7 @@ const columnAdvancedPipeline = [
|
|
488
689
|
pivotReshapeTo2D1M
|
489
690
|
]),
|
490
691
|
encodingXY,
|
692
|
+
columnConfig,
|
491
693
|
vchartBaseConfig,
|
492
694
|
vchartTheme
|
493
695
|
];
|
@@ -501,6 +703,7 @@ const columnParallelAdvancedPipeline = [
|
|
501
703
|
pivotReshapeTo2D1M
|
502
704
|
]),
|
503
705
|
encodingXY,
|
706
|
+
columnParallelConfig,
|
504
707
|
vchartBaseConfig,
|
505
708
|
vchartTheme
|
506
709
|
];
|
@@ -514,6 +717,7 @@ const columnPercentAdvancedPipeline = [
|
|
514
717
|
pivotReshapeTo2D1M
|
515
718
|
]),
|
516
719
|
encodingXY,
|
720
|
+
columnPercentConfig,
|
517
721
|
vchartBaseConfig,
|
518
722
|
vchartTheme
|
519
723
|
];
|
@@ -527,6 +731,7 @@ const areaAdvancedPipeline = [
|
|
527
731
|
pivotReshapeTo2D1M
|
528
732
|
]),
|
529
733
|
encodingXY,
|
734
|
+
areaConfig,
|
530
735
|
vchartBaseConfig,
|
531
736
|
vchartTheme
|
532
737
|
];
|
@@ -540,6 +745,21 @@ const areaPercentAdvancedPipeline = [
|
|
540
745
|
pivotReshapeTo2D1M
|
541
746
|
]),
|
542
747
|
encodingXY,
|
748
|
+
areaPercentConfig,
|
749
|
+
vchartBaseConfig,
|
750
|
+
vchartTheme
|
751
|
+
];
|
752
|
+
const pieAdvancedPipeline = [
|
753
|
+
initAdvancedVSeed,
|
754
|
+
autoMeasures,
|
755
|
+
autoDimensions,
|
756
|
+
pivotAdapter([
|
757
|
+
reshapeTo1D1M
|
758
|
+
], [
|
759
|
+
pivotReshapeTo1D1M
|
760
|
+
]),
|
761
|
+
encodingPolar,
|
762
|
+
pieConfig,
|
543
763
|
vchartBaseConfig,
|
544
764
|
vchartTheme
|
545
765
|
];
|
@@ -587,6 +807,11 @@ const initColumn = (spec, context)=>{
|
|
587
807
|
result.yField = encoding[0].y[0];
|
588
808
|
result.seriesField = encoding[0].group[0];
|
589
809
|
result.padding = 0;
|
810
|
+
result.region = [
|
811
|
+
{
|
812
|
+
clip: true
|
813
|
+
}
|
814
|
+
];
|
590
815
|
return result;
|
591
816
|
};
|
592
817
|
const initBar = (spec, context)=>{
|
@@ -602,6 +827,11 @@ const initBar = (spec, context)=>{
|
|
602
827
|
result.xField = encoding[0].x?.[0];
|
603
828
|
result.seriesField = encoding[0].group?.[0];
|
604
829
|
result.padding = 0;
|
830
|
+
result.region = [
|
831
|
+
{
|
832
|
+
clip: true
|
833
|
+
}
|
834
|
+
];
|
605
835
|
return result;
|
606
836
|
};
|
607
837
|
const initBarParallel = (spec, context)=>{
|
@@ -621,6 +851,11 @@ const initBarParallel = (spec, context)=>{
|
|
621
851
|
result.xField = encoding[0].x[0];
|
622
852
|
result.seriesField = encoding[0].group[0];
|
623
853
|
result.padding = 0;
|
854
|
+
result.region = [
|
855
|
+
{
|
856
|
+
clip: true
|
857
|
+
}
|
858
|
+
];
|
624
859
|
return result;
|
625
860
|
};
|
626
861
|
const initArea = (spec, context)=>{
|
@@ -636,6 +871,11 @@ const initArea = (spec, context)=>{
|
|
636
871
|
result.yField = encoding[0].y[0];
|
637
872
|
result.seriesField = encoding[0].group[0];
|
638
873
|
result.padding = 0;
|
874
|
+
result.region = [
|
875
|
+
{
|
876
|
+
clip: true
|
877
|
+
}
|
878
|
+
];
|
639
879
|
return result;
|
640
880
|
};
|
641
881
|
const initLine = (spec, context)=>{
|
@@ -651,6 +891,11 @@ const initLine = (spec, context)=>{
|
|
651
891
|
result.yField = encoding[0].y[0];
|
652
892
|
result.seriesField = encoding[0].group[0];
|
653
893
|
result.padding = 0;
|
894
|
+
result.region = [
|
895
|
+
{
|
896
|
+
clip: true
|
897
|
+
}
|
898
|
+
];
|
654
899
|
return result;
|
655
900
|
};
|
656
901
|
const initColumnParallel = (spec, context)=>{
|
@@ -670,6 +915,32 @@ const initColumnParallel = (spec, context)=>{
|
|
670
915
|
result.yField = encoding[0].y[0];
|
671
916
|
result.seriesField = encoding[0].group[0];
|
672
917
|
result.padding = 0;
|
918
|
+
result.region = [
|
919
|
+
{
|
920
|
+
clip: true
|
921
|
+
}
|
922
|
+
];
|
923
|
+
return result;
|
924
|
+
};
|
925
|
+
const initPie = (spec, context)=>{
|
926
|
+
const result = {
|
927
|
+
...spec
|
928
|
+
};
|
929
|
+
const { advancedVSeed } = context;
|
930
|
+
const { encoding } = advancedVSeed;
|
931
|
+
if (!encoding[0].angle || !encoding[0].radius || !encoding[0].group) return result;
|
932
|
+
result.type = 'pie';
|
933
|
+
result.outerRadius = 0.8;
|
934
|
+
result.innerRadius = 0;
|
935
|
+
result.valueField = encoding[0].radius[0];
|
936
|
+
result.categoryField = encoding[0].angle[0];
|
937
|
+
result.seriesField = encoding[0].group[0];
|
938
|
+
result.padding = 0;
|
939
|
+
result.region = [
|
940
|
+
{
|
941
|
+
clip: true
|
942
|
+
}
|
943
|
+
];
|
673
944
|
return result;
|
674
945
|
};
|
675
946
|
const initPivot = (spec)=>{
|
@@ -687,67 +958,328 @@ const initPivot = (spec)=>{
|
|
687
958
|
indicatorsAsCol: false
|
688
959
|
};
|
689
960
|
};
|
690
|
-
const xBand = (spec)=>{
|
961
|
+
const xBand = (spec, context)=>{
|
691
962
|
const result = {
|
692
963
|
...spec
|
693
964
|
};
|
965
|
+
const { advancedVSeed, vseed } = context;
|
966
|
+
const { chartType } = vseed;
|
967
|
+
const config = advancedVSeed.config?.[chartType]?.xAxis;
|
694
968
|
if (!result.axes) result.axes = [];
|
969
|
+
if (!config) {
|
970
|
+
result.axes = [
|
971
|
+
...result.axes,
|
972
|
+
{
|
973
|
+
visible: true,
|
974
|
+
type: 'band',
|
975
|
+
orient: 'bottom'
|
976
|
+
}
|
977
|
+
];
|
978
|
+
return result;
|
979
|
+
}
|
980
|
+
const { visible = true, label, tick, title, grid, line, labelAutoHide, labelAutoHideGap, labelAutoLimit, labelAutoLimitLength, labelAutoRotate, labelAutoRotateAngleRange } = config;
|
981
|
+
const sampling = !(labelAutoHide || labelAutoRotate || labelAutoLimit);
|
982
|
+
const bandAxis = {
|
983
|
+
visible,
|
984
|
+
type: 'band',
|
985
|
+
orient: 'bottom',
|
986
|
+
maxHeight: labelAutoLimitLength,
|
987
|
+
sampling,
|
988
|
+
hover: true,
|
989
|
+
label: {
|
990
|
+
visible: label?.visible,
|
991
|
+
flush: true,
|
992
|
+
space: 8,
|
993
|
+
style: {
|
994
|
+
maxLineWidth: labelAutoLimitLength,
|
995
|
+
fill: label?.labelColor,
|
996
|
+
angle: label?.labelAngle,
|
997
|
+
fontSize: label?.labelFontSize,
|
998
|
+
fontWeight: label?.labelFontWeight
|
999
|
+
},
|
1000
|
+
minGap: labelAutoHideGap,
|
1001
|
+
autoHide: labelAutoHide,
|
1002
|
+
autoHideMethod: 'greedy',
|
1003
|
+
autoHideSeparation: labelAutoHideGap,
|
1004
|
+
autoLimit: labelAutoLimit,
|
1005
|
+
autoRotate: labelAutoRotate,
|
1006
|
+
autoRotateAngle: labelAutoRotateAngleRange,
|
1007
|
+
lastVisible: true
|
1008
|
+
},
|
1009
|
+
title: {
|
1010
|
+
visible: title?.visible,
|
1011
|
+
text: title?.titleText,
|
1012
|
+
style: {
|
1013
|
+
fill: title?.titleColor,
|
1014
|
+
fontSize: title?.titleFontSize,
|
1015
|
+
fontWeight: title?.titleFontWeight
|
1016
|
+
}
|
1017
|
+
},
|
1018
|
+
tick: {
|
1019
|
+
visible: tick?.visible,
|
1020
|
+
tickSize: tick?.tickSize,
|
1021
|
+
inside: tick?.tickInside,
|
1022
|
+
style: {
|
1023
|
+
stroke: tick?.tickColor
|
1024
|
+
}
|
1025
|
+
},
|
1026
|
+
grid: {
|
1027
|
+
visible: grid?.visible,
|
1028
|
+
style: {
|
1029
|
+
lineWidth: grid?.gridWidth,
|
1030
|
+
stroke: grid?.gridColor
|
1031
|
+
}
|
1032
|
+
},
|
1033
|
+
domainLine: {
|
1034
|
+
visible: line?.visible,
|
1035
|
+
style: {
|
1036
|
+
lineWidth: line?.lineWidth,
|
1037
|
+
stroke: line?.lineColor
|
1038
|
+
}
|
1039
|
+
}
|
1040
|
+
};
|
695
1041
|
result.axes = [
|
696
1042
|
...result.axes,
|
697
|
-
|
698
|
-
visible: true,
|
699
|
-
type: 'band',
|
700
|
-
orient: 'bottom'
|
701
|
-
}
|
1043
|
+
bandAxis
|
702
1044
|
];
|
703
1045
|
return result;
|
704
1046
|
};
|
705
|
-
const xLinear = (spec)=>{
|
1047
|
+
const xLinear = (spec, context)=>{
|
706
1048
|
const result = {
|
707
1049
|
...spec
|
708
1050
|
};
|
1051
|
+
const { advancedVSeed, vseed } = context;
|
1052
|
+
const { chartType } = vseed;
|
1053
|
+
const config = advancedVSeed.config?.[chartType]?.xAxis;
|
709
1054
|
if (!result.axes) result.axes = [];
|
1055
|
+
if (!config) {
|
1056
|
+
result.axes = [
|
1057
|
+
...result.axes,
|
1058
|
+
{
|
1059
|
+
visible: true,
|
1060
|
+
type: 'linear',
|
1061
|
+
orient: 'bottom'
|
1062
|
+
}
|
1063
|
+
];
|
1064
|
+
return result;
|
1065
|
+
}
|
1066
|
+
const { visible = true, label, tick, title, grid, line, zero, nice, inverse, max, min } = config;
|
1067
|
+
const linearAxis = {
|
1068
|
+
visible,
|
1069
|
+
type: 'linear',
|
1070
|
+
orient: 'bottom',
|
1071
|
+
nice,
|
1072
|
+
zero,
|
1073
|
+
inverse,
|
1074
|
+
max,
|
1075
|
+
min,
|
1076
|
+
label: {
|
1077
|
+
visible: label?.visible,
|
1078
|
+
style: {
|
1079
|
+
fill: label?.labelColor,
|
1080
|
+
angle: label?.labelAngle,
|
1081
|
+
fontSize: label?.labelFontSize,
|
1082
|
+
fontWeight: label?.labelFontWeight
|
1083
|
+
}
|
1084
|
+
},
|
1085
|
+
title: {
|
1086
|
+
visible: title?.visible,
|
1087
|
+
text: title?.titleText,
|
1088
|
+
style: {
|
1089
|
+
fill: title?.titleColor,
|
1090
|
+
fontSize: title?.titleFontSize,
|
1091
|
+
fontWeight: title?.titleFontWeight
|
1092
|
+
}
|
1093
|
+
},
|
1094
|
+
tick: {
|
1095
|
+
visible: tick?.visible,
|
1096
|
+
tickSize: tick?.tickSize,
|
1097
|
+
inside: tick?.tickInside,
|
1098
|
+
style: {
|
1099
|
+
stroke: tick?.tickColor
|
1100
|
+
}
|
1101
|
+
},
|
1102
|
+
grid: {
|
1103
|
+
visible: grid?.visible,
|
1104
|
+
style: {
|
1105
|
+
lineWidth: grid?.gridWidth,
|
1106
|
+
stroke: grid?.gridColor
|
1107
|
+
}
|
1108
|
+
},
|
1109
|
+
domainLine: {
|
1110
|
+
visible: line?.visible,
|
1111
|
+
style: {
|
1112
|
+
lineWidth: line?.lineWidth,
|
1113
|
+
stroke: line?.lineColor
|
1114
|
+
}
|
1115
|
+
}
|
1116
|
+
};
|
710
1117
|
result.axes = [
|
711
1118
|
...result.axes,
|
712
|
-
|
713
|
-
visible: true,
|
714
|
-
type: 'linear',
|
715
|
-
orient: 'bottom',
|
716
|
-
nice: true,
|
717
|
-
zero: true
|
718
|
-
}
|
1119
|
+
linearAxis
|
719
1120
|
];
|
720
1121
|
return result;
|
721
1122
|
};
|
722
|
-
const yBand = (spec)=>{
|
1123
|
+
const yBand = (spec, context)=>{
|
723
1124
|
const result = {
|
724
1125
|
...spec
|
725
1126
|
};
|
1127
|
+
const { advancedVSeed, vseed } = context;
|
1128
|
+
const { chartType } = vseed;
|
1129
|
+
const config = advancedVSeed.config?.[chartType]?.yAxis;
|
726
1130
|
if (!result.axes) result.axes = [];
|
1131
|
+
if (!config) {
|
1132
|
+
result.axes = [
|
1133
|
+
...result.axes,
|
1134
|
+
{
|
1135
|
+
visible: true,
|
1136
|
+
type: 'band',
|
1137
|
+
orient: 'left'
|
1138
|
+
}
|
1139
|
+
];
|
1140
|
+
return result;
|
1141
|
+
}
|
1142
|
+
const { visible = true, label, tick, title, grid, line, labelAutoHide, labelAutoHideGap, labelAutoLimit, labelAutoLimitLength, labelAutoRotate, labelAutoRotateAngleRange } = config;
|
1143
|
+
const sampling = !(labelAutoHide || labelAutoRotate || labelAutoLimit);
|
1144
|
+
const bandAxis = {
|
1145
|
+
visible,
|
1146
|
+
type: 'band',
|
1147
|
+
orient: 'left',
|
1148
|
+
maxWidth: labelAutoLimitLength,
|
1149
|
+
sampling,
|
1150
|
+
hover: true,
|
1151
|
+
label: {
|
1152
|
+
visible: label?.visible,
|
1153
|
+
flush: true,
|
1154
|
+
containerAlign: 'left',
|
1155
|
+
space: 8,
|
1156
|
+
style: {
|
1157
|
+
maxLineWidth: labelAutoLimitLength,
|
1158
|
+
fill: label?.labelColor,
|
1159
|
+
angle: label?.labelAngle,
|
1160
|
+
fontSize: label?.labelFontSize,
|
1161
|
+
fontWeight: label?.labelFontWeight
|
1162
|
+
},
|
1163
|
+
minGap: labelAutoHideGap,
|
1164
|
+
autoHide: labelAutoHide,
|
1165
|
+
autoHideMethod: 'greedy',
|
1166
|
+
autoHideSeparation: labelAutoHideGap,
|
1167
|
+
autoLimit: labelAutoLimit,
|
1168
|
+
autoRotate: labelAutoRotate,
|
1169
|
+
autoRotateAngle: labelAutoRotateAngleRange,
|
1170
|
+
lastVisible: true
|
1171
|
+
},
|
1172
|
+
title: {
|
1173
|
+
visible: title?.visible,
|
1174
|
+
text: title?.titleText,
|
1175
|
+
style: {
|
1176
|
+
fill: title?.titleColor,
|
1177
|
+
fontSize: title?.titleFontSize,
|
1178
|
+
fontWeight: title?.titleFontWeight
|
1179
|
+
}
|
1180
|
+
},
|
1181
|
+
tick: {
|
1182
|
+
visible: tick?.visible,
|
1183
|
+
tickSize: tick?.tickSize,
|
1184
|
+
inside: tick?.tickInside,
|
1185
|
+
style: {
|
1186
|
+
stroke: tick?.tickColor
|
1187
|
+
}
|
1188
|
+
},
|
1189
|
+
grid: {
|
1190
|
+
visible: grid?.visible,
|
1191
|
+
style: {
|
1192
|
+
lineWidth: grid?.gridWidth,
|
1193
|
+
stroke: grid?.gridColor
|
1194
|
+
}
|
1195
|
+
},
|
1196
|
+
domainLine: {
|
1197
|
+
visible: line?.visible,
|
1198
|
+
style: {
|
1199
|
+
lineWidth: line?.lineWidth,
|
1200
|
+
stroke: line?.lineColor
|
1201
|
+
}
|
1202
|
+
}
|
1203
|
+
};
|
727
1204
|
result.axes = [
|
728
1205
|
...result.axes,
|
729
|
-
|
730
|
-
visible: true,
|
731
|
-
type: 'band',
|
732
|
-
orient: 'left'
|
733
|
-
}
|
1206
|
+
bandAxis
|
734
1207
|
];
|
735
1208
|
return result;
|
736
1209
|
};
|
737
|
-
const yLinear = (spec)=>{
|
1210
|
+
const yLinear = (spec, context)=>{
|
738
1211
|
const result = {
|
739
1212
|
...spec
|
740
1213
|
};
|
1214
|
+
const { advancedVSeed, vseed } = context;
|
1215
|
+
const { chartType } = vseed;
|
1216
|
+
const config = advancedVSeed.config?.[chartType]?.yAxis;
|
741
1217
|
if (!result.axes) result.axes = [];
|
1218
|
+
if (!config) {
|
1219
|
+
result.axes = [
|
1220
|
+
...result.axes,
|
1221
|
+
{
|
1222
|
+
visible: true,
|
1223
|
+
type: 'linear',
|
1224
|
+
orient: 'left'
|
1225
|
+
}
|
1226
|
+
];
|
1227
|
+
return result;
|
1228
|
+
}
|
1229
|
+
const { visible = true, label, tick, title, grid, line, zero, nice, inverse, max, min } = config;
|
1230
|
+
const linearAxis = {
|
1231
|
+
visible,
|
1232
|
+
type: 'linear',
|
1233
|
+
orient: 'left',
|
1234
|
+
nice,
|
1235
|
+
zero,
|
1236
|
+
inverse,
|
1237
|
+
max,
|
1238
|
+
min,
|
1239
|
+
label: {
|
1240
|
+
visible: label?.visible,
|
1241
|
+
style: {
|
1242
|
+
fill: label?.labelColor,
|
1243
|
+
angle: label?.labelAngle,
|
1244
|
+
fontSize: label?.labelFontSize,
|
1245
|
+
fontWeight: label?.labelFontWeight
|
1246
|
+
}
|
1247
|
+
},
|
1248
|
+
title: {
|
1249
|
+
visible: title?.visible,
|
1250
|
+
text: title?.titleText,
|
1251
|
+
style: {
|
1252
|
+
fill: title?.titleColor,
|
1253
|
+
fontSize: title?.titleFontSize,
|
1254
|
+
fontWeight: title?.titleFontWeight
|
1255
|
+
}
|
1256
|
+
},
|
1257
|
+
tick: {
|
1258
|
+
visible: tick?.visible,
|
1259
|
+
tickSize: tick?.tickSize,
|
1260
|
+
inside: tick?.tickInside,
|
1261
|
+
style: {
|
1262
|
+
stroke: tick?.tickColor
|
1263
|
+
}
|
1264
|
+
},
|
1265
|
+
grid: {
|
1266
|
+
visible: grid?.visible,
|
1267
|
+
style: {
|
1268
|
+
lineWidth: grid?.gridWidth,
|
1269
|
+
stroke: grid?.gridColor
|
1270
|
+
}
|
1271
|
+
},
|
1272
|
+
domainLine: {
|
1273
|
+
visible: line?.visible,
|
1274
|
+
style: {
|
1275
|
+
lineWidth: line?.lineWidth,
|
1276
|
+
stroke: line?.lineColor
|
1277
|
+
}
|
1278
|
+
}
|
1279
|
+
};
|
742
1280
|
result.axes = [
|
743
1281
|
...result.axes,
|
744
|
-
|
745
|
-
visible: true,
|
746
|
-
type: 'linear',
|
747
|
-
orient: 'left',
|
748
|
-
nice: true,
|
749
|
-
zero: true
|
750
|
-
}
|
1282
|
+
linearAxis
|
751
1283
|
];
|
752
1284
|
return result;
|
753
1285
|
};
|
@@ -837,11 +1369,11 @@ const pivotLegend = (spec, context)=>{
|
|
837
1369
|
const { legend, color } = baseConfig;
|
838
1370
|
const { enable } = legend;
|
839
1371
|
const { colorScheme } = color;
|
840
|
-
|
1372
|
+
const legends = {
|
841
1373
|
visible: enable,
|
842
1374
|
alignSelf: 'end',
|
843
1375
|
type: 'discrete',
|
844
|
-
position: '
|
1376
|
+
position: 'middle',
|
845
1377
|
data: colorItems.map((d, index)=>({
|
846
1378
|
label: d,
|
847
1379
|
shape: {
|
@@ -849,9 +1381,29 @@ const pivotLegend = (spec, context)=>{
|
|
849
1381
|
fill: colorScheme[index]
|
850
1382
|
}
|
851
1383
|
})),
|
1384
|
+
item: {
|
1385
|
+
background: {
|
1386
|
+
visible: true,
|
1387
|
+
state: {
|
1388
|
+
selectedHover: {
|
1389
|
+
fill: '#000000',
|
1390
|
+
fillOpacity: 0.05
|
1391
|
+
}
|
1392
|
+
}
|
1393
|
+
},
|
1394
|
+
label: {
|
1395
|
+
style: {
|
1396
|
+
fontSize: 12,
|
1397
|
+
fill: '#6F6F6F'
|
1398
|
+
}
|
1399
|
+
}
|
1400
|
+
},
|
852
1401
|
orient: 'bottom'
|
853
1402
|
};
|
854
|
-
return
|
1403
|
+
return {
|
1404
|
+
...result,
|
1405
|
+
legends
|
1406
|
+
};
|
855
1407
|
};
|
856
1408
|
const color_color = (spec, context)=>{
|
857
1409
|
const result = {
|
@@ -873,9 +1425,9 @@ const color_color = (spec, context)=>{
|
|
873
1425
|
return result;
|
874
1426
|
};
|
875
1427
|
const pivotAdapter_pivotAdapter = (pipeline, pivotPipeline)=>(spec, context)=>{
|
876
|
-
const {
|
877
|
-
const
|
878
|
-
if (
|
1428
|
+
const { vseed } = context;
|
1429
|
+
const usePivotChart = isPivotChart(vseed);
|
1430
|
+
if (usePivotChart) return execPipeline(pivotPipeline, context, spec);
|
879
1431
|
return execPipeline(pipeline, context, spec);
|
880
1432
|
};
|
881
1433
|
const pivotIndicators = (chartPipeline)=>(spec, context)=>{
|
@@ -947,7 +1499,155 @@ const pivotIndicators_pivotIndicatorsAsCol = (spec)=>{
|
|
947
1499
|
indicatorsAsCol: true
|
948
1500
|
};
|
949
1501
|
};
|
950
|
-
const
|
1502
|
+
const pivotGridStyle = (spec)=>{
|
1503
|
+
const result = {
|
1504
|
+
...spec
|
1505
|
+
};
|
1506
|
+
const transparent = 'rgba(0,0,0,0)';
|
1507
|
+
return {
|
1508
|
+
...result,
|
1509
|
+
theme: {
|
1510
|
+
underlayBackgroundColor: transparent,
|
1511
|
+
bodyStyle: {
|
1512
|
+
borderColor: 'rgba(0,4,20,0.2)',
|
1513
|
+
borderLineWidth: [
|
1514
|
+
0,
|
1515
|
+
0,
|
1516
|
+
2,
|
1517
|
+
0
|
1518
|
+
],
|
1519
|
+
bgColor: transparent,
|
1520
|
+
padding: [
|
1521
|
+
0,
|
1522
|
+
0,
|
1523
|
+
1,
|
1524
|
+
0
|
1525
|
+
]
|
1526
|
+
},
|
1527
|
+
headerStyle: {
|
1528
|
+
borderColor: 'rgba(0,4,20,0.2)',
|
1529
|
+
fontSize: 12,
|
1530
|
+
color: '#333333',
|
1531
|
+
textAlign: 'center',
|
1532
|
+
borderLineWidth: 0,
|
1533
|
+
bgColor: transparent,
|
1534
|
+
hover: {
|
1535
|
+
cellBgColor: 'rgba(178,186,207, 0.2)'
|
1536
|
+
}
|
1537
|
+
},
|
1538
|
+
rowHeaderStyle: {
|
1539
|
+
borderColor: 'rgba(0,4,20,0.2)',
|
1540
|
+
fontSize: 12,
|
1541
|
+
color: '#333333',
|
1542
|
+
borderLineWidth: 0,
|
1543
|
+
bgColor: transparent,
|
1544
|
+
hover: {
|
1545
|
+
cellBgColor: 'rgba(178,186,207, 0.2)'
|
1546
|
+
}
|
1547
|
+
},
|
1548
|
+
cornerHeaderStyle: {
|
1549
|
+
borderColor: 'rgba(0,4,20,0.2)',
|
1550
|
+
textAlign: 'center',
|
1551
|
+
fontSize: 12,
|
1552
|
+
color: '#333333',
|
1553
|
+
fontWeight: 'bold',
|
1554
|
+
borderLineWidth: [
|
1555
|
+
0,
|
1556
|
+
0,
|
1557
|
+
0,
|
1558
|
+
0
|
1559
|
+
],
|
1560
|
+
bgColor: transparent,
|
1561
|
+
hover: {
|
1562
|
+
cellBgColor: ''
|
1563
|
+
}
|
1564
|
+
},
|
1565
|
+
cornerRightTopCellStyle: {
|
1566
|
+
borderColor: 'rgba(0,4,20,0.2)',
|
1567
|
+
borderLineWidth: 0,
|
1568
|
+
bgColor: transparent,
|
1569
|
+
hover: {
|
1570
|
+
cellBgColor: ''
|
1571
|
+
}
|
1572
|
+
},
|
1573
|
+
cornerLeftBottomCellStyle: {
|
1574
|
+
borderColor: 'rgba(0,4,20,0.2)',
|
1575
|
+
borderLineWidth: 0,
|
1576
|
+
bgColor: transparent,
|
1577
|
+
hover: {
|
1578
|
+
cellBgColor: ''
|
1579
|
+
}
|
1580
|
+
},
|
1581
|
+
cornerRightBottomCellStyle: {
|
1582
|
+
borderColor: 'rgba(0,4,20,0.2)',
|
1583
|
+
borderLineWidth: 0,
|
1584
|
+
bgColor: transparent,
|
1585
|
+
hover: {
|
1586
|
+
cellBgColor: ''
|
1587
|
+
}
|
1588
|
+
},
|
1589
|
+
rightFrozenStyle: {
|
1590
|
+
borderColor: 'rgba(0,4,20,0.2)',
|
1591
|
+
borderLineWidth: 0,
|
1592
|
+
bgColor: transparent,
|
1593
|
+
hover: {
|
1594
|
+
cellBgColor: 'rgba(178,186,207, 0.2)'
|
1595
|
+
}
|
1596
|
+
},
|
1597
|
+
bottomFrozenStyle: {
|
1598
|
+
borderColor: 'rgba(0,4,20,0.2)',
|
1599
|
+
borderLineWidth: 0,
|
1600
|
+
bgColor: transparent,
|
1601
|
+
hover: {
|
1602
|
+
cellBgColor: 'rgba(178,186,207, 0.2)'
|
1603
|
+
}
|
1604
|
+
},
|
1605
|
+
selectionStyle: {
|
1606
|
+
cellBgColor: '',
|
1607
|
+
cellBorderColor: ''
|
1608
|
+
},
|
1609
|
+
frameStyle: {
|
1610
|
+
borderLineWidth: 0,
|
1611
|
+
bgColor: transparent
|
1612
|
+
}
|
1613
|
+
}
|
1614
|
+
};
|
1615
|
+
};
|
1616
|
+
const pivotColumnDimensions = (spec, context)=>{
|
1617
|
+
const result = {
|
1618
|
+
...spec
|
1619
|
+
};
|
1620
|
+
const { advancedVSeed } = context;
|
1621
|
+
const { dimensions } = advancedVSeed;
|
1622
|
+
if (!dimensions) return result;
|
1623
|
+
const columnDimensions = dimensions.filter((dim)=>'columnDimension' === dim.location);
|
1624
|
+
const columns = columnDimensions.map((dim)=>({
|
1625
|
+
dimensionKey: dim.id,
|
1626
|
+
title: dim.alias || dim.id
|
1627
|
+
}));
|
1628
|
+
return {
|
1629
|
+
...result,
|
1630
|
+
columns: columns
|
1631
|
+
};
|
1632
|
+
};
|
1633
|
+
const pivotRowDimensions = (spec, context)=>{
|
1634
|
+
const result = {
|
1635
|
+
...spec
|
1636
|
+
};
|
1637
|
+
const { advancedVSeed } = context;
|
1638
|
+
const { dimensions } = advancedVSeed;
|
1639
|
+
if (!dimensions) return result;
|
1640
|
+
const rowDimensions = dimensions.filter((dim)=>'rowDimension' === dim.location);
|
1641
|
+
const rows = rowDimensions.map((dim)=>({
|
1642
|
+
dimensionKey: dim.id,
|
1643
|
+
title: dim.alias || dim.id
|
1644
|
+
}));
|
1645
|
+
return {
|
1646
|
+
...result,
|
1647
|
+
rows: rows
|
1648
|
+
};
|
1649
|
+
};
|
1650
|
+
const line_line = [
|
951
1651
|
initLine,
|
952
1652
|
color_color,
|
953
1653
|
background_backgroundColor,
|
@@ -960,6 +1660,7 @@ const line = [
|
|
960
1660
|
];
|
961
1661
|
const pivotLine = [
|
962
1662
|
initPivot,
|
1663
|
+
pivotGridStyle,
|
963
1664
|
pivotIndicators_pivotIndicatorsAsRow,
|
964
1665
|
datasetPivot,
|
965
1666
|
pivotIndicators([
|
@@ -972,10 +1673,12 @@ const pivotLine = [
|
|
972
1673
|
label_label,
|
973
1674
|
tooltip_tooltip
|
974
1675
|
]),
|
1676
|
+
pivotRowDimensions,
|
1677
|
+
pivotColumnDimensions,
|
975
1678
|
pivotLegend
|
976
1679
|
];
|
977
1680
|
const lineSpecPipeline = [
|
978
|
-
pivotAdapter_pivotAdapter(
|
1681
|
+
pivotAdapter_pivotAdapter(line_line, pivotLine)
|
979
1682
|
];
|
980
1683
|
const column = [
|
981
1684
|
initColumn,
|
@@ -990,6 +1693,7 @@ const column = [
|
|
990
1693
|
];
|
991
1694
|
const pivotColumn = [
|
992
1695
|
initPivot,
|
1696
|
+
pivotGridStyle,
|
993
1697
|
pivotIndicators_pivotIndicatorsAsRow,
|
994
1698
|
datasetPivot,
|
995
1699
|
pivotIndicators([
|
@@ -1002,6 +1706,8 @@ const pivotColumn = [
|
|
1002
1706
|
label_label,
|
1003
1707
|
tooltip_tooltip
|
1004
1708
|
]),
|
1709
|
+
pivotRowDimensions,
|
1710
|
+
pivotColumnDimensions,
|
1005
1711
|
pivotLegend
|
1006
1712
|
];
|
1007
1713
|
const columnSpecPipeline = [
|
@@ -1020,6 +1726,7 @@ const columnParallel = [
|
|
1020
1726
|
];
|
1021
1727
|
const pivotColumnParallel = [
|
1022
1728
|
initPivot,
|
1729
|
+
pivotGridStyle,
|
1023
1730
|
pivotIndicators_pivotIndicatorsAsRow,
|
1024
1731
|
datasetPivot,
|
1025
1732
|
pivotIndicators([
|
@@ -1032,6 +1739,8 @@ const pivotColumnParallel = [
|
|
1032
1739
|
label_label,
|
1033
1740
|
tooltip_tooltip
|
1034
1741
|
]),
|
1742
|
+
pivotRowDimensions,
|
1743
|
+
pivotColumnDimensions,
|
1035
1744
|
pivotLegend
|
1036
1745
|
];
|
1037
1746
|
const columnParallelSpecPipeline = [
|
@@ -1051,6 +1760,7 @@ const columnPercent = [
|
|
1051
1760
|
];
|
1052
1761
|
const pivotColumnPercent = [
|
1053
1762
|
initPivot,
|
1763
|
+
pivotGridStyle,
|
1054
1764
|
pivotIndicators_pivotIndicatorsAsRow,
|
1055
1765
|
datasetPivot,
|
1056
1766
|
pivotIndicators([
|
@@ -1064,6 +1774,8 @@ const pivotColumnPercent = [
|
|
1064
1774
|
label_label,
|
1065
1775
|
tooltip_tooltip
|
1066
1776
|
]),
|
1777
|
+
pivotRowDimensions,
|
1778
|
+
pivotColumnDimensions,
|
1067
1779
|
pivotLegend
|
1068
1780
|
];
|
1069
1781
|
const columnPercentSpecPipeline = [
|
@@ -1082,6 +1794,7 @@ const bar = [
|
|
1082
1794
|
];
|
1083
1795
|
const pivotBar = [
|
1084
1796
|
initPivot,
|
1797
|
+
pivotGridStyle,
|
1085
1798
|
pivotIndicators_pivotIndicatorsAsCol,
|
1086
1799
|
datasetPivot,
|
1087
1800
|
pivotIndicators([
|
@@ -1094,6 +1807,8 @@ const pivotBar = [
|
|
1094
1807
|
label_label,
|
1095
1808
|
tooltip_tooltip
|
1096
1809
|
]),
|
1810
|
+
pivotRowDimensions,
|
1811
|
+
pivotColumnDimensions,
|
1097
1812
|
pivotLegend
|
1098
1813
|
];
|
1099
1814
|
const barSpecPipeline = [
|
@@ -1112,6 +1827,7 @@ const barParallel = [
|
|
1112
1827
|
];
|
1113
1828
|
const pivotBarParallel = [
|
1114
1829
|
initPivot,
|
1830
|
+
pivotGridStyle,
|
1115
1831
|
pivotIndicators_pivotIndicatorsAsCol,
|
1116
1832
|
datasetPivot,
|
1117
1833
|
pivotIndicators([
|
@@ -1124,6 +1840,8 @@ const pivotBarParallel = [
|
|
1124
1840
|
label_label,
|
1125
1841
|
tooltip_tooltip
|
1126
1842
|
]),
|
1843
|
+
pivotRowDimensions,
|
1844
|
+
pivotColumnDimensions,
|
1127
1845
|
pivotLegend
|
1128
1846
|
];
|
1129
1847
|
const barParallelSpecPipeline = [
|
@@ -1143,6 +1861,7 @@ const barPercent = [
|
|
1143
1861
|
];
|
1144
1862
|
const pivotBarPercent = [
|
1145
1863
|
initPivot,
|
1864
|
+
pivotGridStyle,
|
1146
1865
|
pivotIndicators_pivotIndicatorsAsCol,
|
1147
1866
|
datasetPivot,
|
1148
1867
|
pivotIndicators([
|
@@ -1156,6 +1875,8 @@ const pivotBarPercent = [
|
|
1156
1875
|
label_label,
|
1157
1876
|
tooltip_tooltip
|
1158
1877
|
]),
|
1878
|
+
pivotRowDimensions,
|
1879
|
+
pivotColumnDimensions,
|
1159
1880
|
pivotLegend
|
1160
1881
|
];
|
1161
1882
|
const barPercentSpecPipeline = [
|
@@ -1175,6 +1896,7 @@ const area_area = [
|
|
1175
1896
|
];
|
1176
1897
|
const pivotArea = [
|
1177
1898
|
initPivot,
|
1899
|
+
pivotGridStyle,
|
1178
1900
|
pivotIndicators_pivotIndicatorsAsRow,
|
1179
1901
|
datasetPivot,
|
1180
1902
|
pivotIndicators([
|
@@ -1188,6 +1910,8 @@ const pivotArea = [
|
|
1188
1910
|
label_label,
|
1189
1911
|
tooltip_tooltip
|
1190
1912
|
]),
|
1913
|
+
pivotRowDimensions,
|
1914
|
+
pivotColumnDimensions,
|
1191
1915
|
pivotLegend
|
1192
1916
|
];
|
1193
1917
|
const areaSpecPipeline = [
|
@@ -1207,6 +1931,7 @@ const areaPercent = [
|
|
1207
1931
|
];
|
1208
1932
|
const pivotAreaPercent = [
|
1209
1933
|
initPivot,
|
1934
|
+
pivotGridStyle,
|
1210
1935
|
pivotIndicators_pivotIndicatorsAsRow,
|
1211
1936
|
datasetPivot,
|
1212
1937
|
pivotIndicators([
|
@@ -1220,11 +1945,42 @@ const pivotAreaPercent = [
|
|
1220
1945
|
label_label,
|
1221
1946
|
tooltip_tooltip
|
1222
1947
|
]),
|
1948
|
+
pivotRowDimensions,
|
1949
|
+
pivotColumnDimensions,
|
1223
1950
|
pivotLegend
|
1224
1951
|
];
|
1225
1952
|
const areaPercentSpecPipeline = [
|
1226
1953
|
pivotAdapter_pivotAdapter(areaPercent, pivotAreaPercent)
|
1227
1954
|
];
|
1955
|
+
const pie = [
|
1956
|
+
initPie,
|
1957
|
+
color_color,
|
1958
|
+
background_backgroundColor,
|
1959
|
+
dataset_dataset,
|
1960
|
+
label_label,
|
1961
|
+
tooltip_tooltip,
|
1962
|
+
legend_legend
|
1963
|
+
];
|
1964
|
+
const pivotPie = [
|
1965
|
+
initPivot,
|
1966
|
+
pivotGridStyle,
|
1967
|
+
pivotIndicators_pivotIndicatorsAsRow,
|
1968
|
+
datasetPivot,
|
1969
|
+
pivotIndicators([
|
1970
|
+
initPie,
|
1971
|
+
color_color,
|
1972
|
+
background_backgroundColor,
|
1973
|
+
datasetPivotPlaceholder,
|
1974
|
+
label_label,
|
1975
|
+
tooltip_tooltip
|
1976
|
+
]),
|
1977
|
+
pivotRowDimensions,
|
1978
|
+
pivotColumnDimensions,
|
1979
|
+
pivotLegend
|
1980
|
+
];
|
1981
|
+
const pieSpecPipeline = [
|
1982
|
+
pivotAdapter_pivotAdapter(pie, pivotPie)
|
1983
|
+
];
|
1228
1984
|
const buildAdvanced = (builder)=>{
|
1229
1985
|
const { chartType } = builder.vseed;
|
1230
1986
|
if (!chartType) throw new Error('chartType is nil in buildAdvanced');
|
@@ -1332,7 +2088,88 @@ const registerBarParallel = ()=>{
|
|
1332
2088
|
Builder._advancedPipelineMap.barParallel = barParallelAdvancedPipeline;
|
1333
2089
|
Builder._specPipelineMap.barParallel = barParallelSpecPipeline;
|
1334
2090
|
};
|
1335
|
-
const
|
2091
|
+
const registerPie = ()=>{
|
2092
|
+
Builder._advancedPipelineMap.pie = pieAdvancedPipeline;
|
2093
|
+
Builder._specPipelineMap.pie = pieSpecPipeline;
|
2094
|
+
};
|
2095
|
+
const darkTheme = ()=>{
|
2096
|
+
const linearAxis = {
|
2097
|
+
nice: true,
|
2098
|
+
zero: true,
|
2099
|
+
label: {
|
2100
|
+
visible: true,
|
2101
|
+
labelAngle: 0,
|
2102
|
+
labelColor: '#E2E3E6',
|
2103
|
+
labelFontSize: 12,
|
2104
|
+
labelFontWeight: 400
|
2105
|
+
},
|
2106
|
+
title: {
|
2107
|
+
visible: false,
|
2108
|
+
titleText: '',
|
2109
|
+
titleColor: '#FDFDFD',
|
2110
|
+
titleFontSize: 12,
|
2111
|
+
titleFontWeight: 400
|
2112
|
+
},
|
2113
|
+
grid: {
|
2114
|
+
visible: true,
|
2115
|
+
gridColor: '#404349',
|
2116
|
+
gridWidth: 0.5
|
2117
|
+
},
|
2118
|
+
tick: {
|
2119
|
+
visible: false,
|
2120
|
+
tickInside: false,
|
2121
|
+
tickSize: 4,
|
2122
|
+
tickColor: '#4B4F54'
|
2123
|
+
},
|
2124
|
+
line: {
|
2125
|
+
visible: false,
|
2126
|
+
lineColor: '#4B4F54',
|
2127
|
+
lineWidth: 1
|
2128
|
+
}
|
2129
|
+
};
|
2130
|
+
const bandAxis = {
|
2131
|
+
labelAutoHide: true,
|
2132
|
+
labelAutoHideGap: 4,
|
2133
|
+
labelAutoLimit: true,
|
2134
|
+
labelAutoLimitLength: 100,
|
2135
|
+
labelAutoRotate: true,
|
2136
|
+
labelAutoRotateAngleRange: [
|
2137
|
+
0,
|
2138
|
+
-45,
|
2139
|
+
-90
|
2140
|
+
],
|
2141
|
+
label: {
|
2142
|
+
visible: true,
|
2143
|
+
labelAngle: 0,
|
2144
|
+
labelColor: '#E2E3E6',
|
2145
|
+
labelFontSize: 12,
|
2146
|
+
labelFontWeight: 400
|
2147
|
+
},
|
2148
|
+
title: {
|
2149
|
+
visible: false,
|
2150
|
+
titleText: '',
|
2151
|
+
titleColor: '#FDFDFD',
|
2152
|
+
titleFontSize: 12,
|
2153
|
+
titleFontWeight: 400
|
2154
|
+
},
|
2155
|
+
grid: {
|
2156
|
+
visible: false,
|
2157
|
+
gridColor: '#404349',
|
2158
|
+
gridWidth: 0.5
|
2159
|
+
},
|
2160
|
+
tick: {
|
2161
|
+
visible: false,
|
2162
|
+
tickInside: false,
|
2163
|
+
tickSize: 4,
|
2164
|
+
tickColor: '#4B4F54'
|
2165
|
+
},
|
2166
|
+
line: {
|
2167
|
+
visible: true,
|
2168
|
+
lineColor: '#4B4F54',
|
2169
|
+
lineWidth: 1
|
2170
|
+
}
|
2171
|
+
};
|
2172
|
+
return {
|
1336
2173
|
baseConfig: {
|
1337
2174
|
vtable: {
|
1338
2175
|
backgroundColor: '#141414'
|
@@ -1363,9 +2200,139 @@ const darkTheme = ()=>({
|
|
1363
2200
|
enable: true
|
1364
2201
|
}
|
1365
2202
|
}
|
2203
|
+
},
|
2204
|
+
config: {
|
2205
|
+
line: {
|
2206
|
+
xAxis: bandAxis,
|
2207
|
+
yAxis: linearAxis
|
2208
|
+
},
|
2209
|
+
column: {
|
2210
|
+
xAxis: bandAxis,
|
2211
|
+
yAxis: linearAxis
|
2212
|
+
},
|
2213
|
+
columnParallel: {
|
2214
|
+
xAxis: bandAxis,
|
2215
|
+
yAxis: linearAxis
|
2216
|
+
},
|
2217
|
+
columnPercent: {
|
2218
|
+
xAxis: bandAxis,
|
2219
|
+
yAxis: linearAxis
|
2220
|
+
},
|
2221
|
+
bar: {
|
2222
|
+
xAxis: linearAxis,
|
2223
|
+
yAxis: bandAxis
|
2224
|
+
},
|
2225
|
+
barParallel: {
|
2226
|
+
xAxis: linearAxis,
|
2227
|
+
yAxis: bandAxis
|
2228
|
+
},
|
2229
|
+
barPercent: {
|
2230
|
+
xAxis: linearAxis,
|
2231
|
+
yAxis: bandAxis
|
2232
|
+
},
|
2233
|
+
area: {
|
2234
|
+
xAxis: bandAxis,
|
2235
|
+
yAxis: linearAxis
|
2236
|
+
},
|
2237
|
+
areaPercent: {
|
2238
|
+
xAxis: bandAxis,
|
2239
|
+
yAxis: linearAxis
|
2240
|
+
}
|
1366
2241
|
}
|
1367
|
-
}
|
1368
|
-
|
2242
|
+
};
|
2243
|
+
};
|
2244
|
+
const lightTheme = ()=>{
|
2245
|
+
const linearAxis = {
|
2246
|
+
nice: true,
|
2247
|
+
zero: true,
|
2248
|
+
inverse: false,
|
2249
|
+
label: {
|
2250
|
+
visible: true,
|
2251
|
+
labelAngle: 0,
|
2252
|
+
labelColor: '#797B85',
|
2253
|
+
labelFontSize: 12,
|
2254
|
+
labelFontWeight: 400
|
2255
|
+
},
|
2256
|
+
title: {
|
2257
|
+
visible: false,
|
2258
|
+
titleText: '',
|
2259
|
+
titleColor: '#646A73',
|
2260
|
+
titleFontSize: 12,
|
2261
|
+
titleFontWeight: 400
|
2262
|
+
},
|
2263
|
+
grid: {
|
2264
|
+
visible: true,
|
2265
|
+
gridColor: 'rgba(54, 65, 89, 0.15)',
|
2266
|
+
gridWidth: 0.5
|
2267
|
+
},
|
2268
|
+
tick: {
|
2269
|
+
visible: false,
|
2270
|
+
tickInside: false,
|
2271
|
+
tickSize: 4,
|
2272
|
+
tickColor: 'rgba(54, 65, 89, 0.30)'
|
2273
|
+
},
|
2274
|
+
line: {
|
2275
|
+
visible: false,
|
2276
|
+
lineColor: 'rgba(54, 65, 89, 0.30)',
|
2277
|
+
lineWidth: 1
|
2278
|
+
}
|
2279
|
+
};
|
2280
|
+
const bandAxis = {
|
2281
|
+
labelAutoHide: true,
|
2282
|
+
labelAutoHideGap: 4,
|
2283
|
+
labelAutoLimit: true,
|
2284
|
+
labelAutoLimitLength: 100,
|
2285
|
+
labelAutoRotate: true,
|
2286
|
+
labelAutoRotateAngleRange: [
|
2287
|
+
0,
|
2288
|
+
-45,
|
2289
|
+
-90
|
2290
|
+
],
|
2291
|
+
label: {
|
2292
|
+
visible: true,
|
2293
|
+
labelAngle: 0,
|
2294
|
+
labelColor: '#797B85',
|
2295
|
+
labelFontSize: 12,
|
2296
|
+
labelFontWeight: 400
|
2297
|
+
},
|
2298
|
+
title: {
|
2299
|
+
visible: false,
|
2300
|
+
titleText: '',
|
2301
|
+
titleColor: '#646A73',
|
2302
|
+
titleFontSize: 12,
|
2303
|
+
titleFontWeight: 400
|
2304
|
+
},
|
2305
|
+
grid: {
|
2306
|
+
visible: false,
|
2307
|
+
gridColor: 'rgba(54, 65, 89, 0.15)',
|
2308
|
+
gridWidth: 0.5
|
2309
|
+
},
|
2310
|
+
tick: {
|
2311
|
+
visible: false,
|
2312
|
+
tickInside: false,
|
2313
|
+
tickSize: 4,
|
2314
|
+
tickColor: 'rgba(54, 65, 89, 0.30)'
|
2315
|
+
},
|
2316
|
+
line: {
|
2317
|
+
visible: true,
|
2318
|
+
lineColor: 'rgba(54, 65, 89, 0.30)',
|
2319
|
+
lineWidth: 1
|
2320
|
+
}
|
2321
|
+
};
|
2322
|
+
const barBandAxis = {
|
2323
|
+
...bandAxis,
|
2324
|
+
labelAutoHide: false,
|
2325
|
+
labelAutoHideGap: 1,
|
2326
|
+
labelAutoLimit: false,
|
2327
|
+
labelAutoLimitLength: void 0,
|
2328
|
+
labelAutoRotate: false,
|
2329
|
+
labelAutoRotateAngleRange: [
|
2330
|
+
0,
|
2331
|
+
-45,
|
2332
|
+
-90
|
2333
|
+
]
|
2334
|
+
};
|
2335
|
+
return {
|
1369
2336
|
baseConfig: {
|
1370
2337
|
vtable: {
|
1371
2338
|
backgroundColor: '#ffffff'
|
@@ -1396,8 +2363,47 @@ const lightTheme = ()=>({
|
|
1396
2363
|
enable: true
|
1397
2364
|
}
|
1398
2365
|
}
|
2366
|
+
},
|
2367
|
+
config: {
|
2368
|
+
line: {
|
2369
|
+
xAxis: bandAxis,
|
2370
|
+
yAxis: linearAxis
|
2371
|
+
},
|
2372
|
+
column: {
|
2373
|
+
xAxis: bandAxis,
|
2374
|
+
yAxis: linearAxis
|
2375
|
+
},
|
2376
|
+
columnParallel: {
|
2377
|
+
xAxis: bandAxis,
|
2378
|
+
yAxis: linearAxis
|
2379
|
+
},
|
2380
|
+
columnPercent: {
|
2381
|
+
xAxis: bandAxis,
|
2382
|
+
yAxis: linearAxis
|
2383
|
+
},
|
2384
|
+
bar: {
|
2385
|
+
xAxis: linearAxis,
|
2386
|
+
yAxis: barBandAxis
|
2387
|
+
},
|
2388
|
+
barParallel: {
|
2389
|
+
xAxis: linearAxis,
|
2390
|
+
yAxis: barBandAxis
|
2391
|
+
},
|
2392
|
+
barPercent: {
|
2393
|
+
xAxis: linearAxis,
|
2394
|
+
yAxis: barBandAxis
|
2395
|
+
},
|
2396
|
+
area: {
|
2397
|
+
xAxis: bandAxis,
|
2398
|
+
yAxis: linearAxis
|
2399
|
+
},
|
2400
|
+
areaPercent: {
|
2401
|
+
xAxis: bandAxis,
|
2402
|
+
yAxis: linearAxis
|
2403
|
+
}
|
1399
2404
|
}
|
1400
|
-
}
|
2405
|
+
};
|
2406
|
+
};
|
1401
2407
|
const registerCustomTheme = (key, themeConfig)=>{
|
1402
2408
|
Builder._themeMap[key] = themeConfig;
|
1403
2409
|
};
|
@@ -1417,6 +2423,7 @@ const all_registerAll = ()=>{
|
|
1417
2423
|
registerBarPercent();
|
1418
2424
|
registerArea();
|
1419
2425
|
registerAreaPercent();
|
2426
|
+
registerPie();
|
1420
2427
|
registerLightTheme();
|
1421
2428
|
registerDarkTheme();
|
1422
2429
|
};
|
@@ -1535,11 +2542,187 @@ const zBaseConfig = z.object({
|
|
1535
2542
|
vchart: zVChartBaseConfig.optional(),
|
1536
2543
|
vtable: zVTableBaseConfig.optional()
|
1537
2544
|
});
|
2545
|
+
const zAxis = z.object({
|
2546
|
+
visible: z.boolean().default(true).optional(),
|
2547
|
+
min: z.number().optional(),
|
2548
|
+
max: z.number().optional(),
|
2549
|
+
nice: z.boolean().default(true).optional(),
|
2550
|
+
zero: z.boolean().default(true).optional(),
|
2551
|
+
inverse: z.boolean().default(false).optional(),
|
2552
|
+
labelAutoHide: z.boolean().default(true).optional(),
|
2553
|
+
labelAutoHideGap: z.number().default(4).optional(),
|
2554
|
+
labelAutoRotate: z.boolean().default(true).optional(),
|
2555
|
+
labelAutoRotateAngleRange: z.array(z.number()).default([
|
2556
|
+
0,
|
2557
|
+
-45,
|
2558
|
+
-90
|
2559
|
+
]).optional(),
|
2560
|
+
labelAutoLimit: z.boolean().default(true).optional(),
|
2561
|
+
labelAutoLimitLength: z.number().default(100).optional(),
|
2562
|
+
label: z.object({
|
2563
|
+
visible: z.boolean().default(true).optional(),
|
2564
|
+
labelColor: z.string().default('#797B85').optional(),
|
2565
|
+
labelFontSize: z.number().default(12).optional(),
|
2566
|
+
labelFontWeight: z.number().default(400).optional(),
|
2567
|
+
labelAngle: z.number().default(0).optional()
|
2568
|
+
}).optional(),
|
2569
|
+
line: z.object({
|
2570
|
+
visible: z.boolean().default(true).optional(),
|
2571
|
+
lineColor: z.string().default('rgba(54, 65, 89, 0.30)').optional(),
|
2572
|
+
lineWidth: z.number().default(1).optional()
|
2573
|
+
}).optional(),
|
2574
|
+
tick: z.object({
|
2575
|
+
visible: z.boolean().default(true).optional(),
|
2576
|
+
tickInside: z.boolean().default(false).optional(),
|
2577
|
+
tickColor: z.string().default('rgba(54, 65, 89, 0.30)').optional(),
|
2578
|
+
tickSize: z.number().default(4).optional()
|
2579
|
+
}).optional(),
|
2580
|
+
title: z.object({
|
2581
|
+
visible: z.boolean().default(false).optional(),
|
2582
|
+
titleText: z.string().default('').optional(),
|
2583
|
+
titleColor: z.string().default('#646A73').optional(),
|
2584
|
+
titleFontSize: z.number().default(12).optional(),
|
2585
|
+
titleFontWeight: z.number().default(400).optional()
|
2586
|
+
}).optional(),
|
2587
|
+
grid: z.object({
|
2588
|
+
visible: z.boolean().default(false).optional(),
|
2589
|
+
gridColor: z.string().default('rgba(54, 65, 89, 0.15)').optional(),
|
2590
|
+
gridWidth: z.number().default(0.5).optional()
|
2591
|
+
}).optional()
|
2592
|
+
});
|
2593
|
+
const zXBandAxis = z.object({
|
2594
|
+
visible: z.boolean().default(true).optional(),
|
2595
|
+
labelAutoHide: z.boolean().default(true).optional(),
|
2596
|
+
labelAutoHideGap: z.number().default(0).optional(),
|
2597
|
+
labelAutoRotate: z.boolean().default(true).optional(),
|
2598
|
+
labelAutoRotateAngleRange: z.array(z.number()).default([
|
2599
|
+
0,
|
2600
|
+
-45,
|
2601
|
+
-90
|
2602
|
+
]).optional(),
|
2603
|
+
labelAutoLimit: z.boolean().default(true).optional(),
|
2604
|
+
labelAutoLimitLength: z.number().default(100).optional(),
|
2605
|
+
label: z.object({
|
2606
|
+
visible: z.boolean().default(true).optional(),
|
2607
|
+
labelColor: z.string().default('#797B85').optional(),
|
2608
|
+
labelFontSize: z.number().default(12).optional(),
|
2609
|
+
labelFontWeight: z.number().default(400).optional(),
|
2610
|
+
labelAngle: z.number().default(0).optional()
|
2611
|
+
}).optional(),
|
2612
|
+
line: z.object({
|
2613
|
+
visible: z.boolean().default(true).optional(),
|
2614
|
+
lineColor: z.string().default('rgba(54, 65, 89, 0.30)').optional(),
|
2615
|
+
lineWidth: z.number().default(1).optional()
|
2616
|
+
}).optional(),
|
2617
|
+
tick: z.object({
|
2618
|
+
visible: z.boolean().default(true).optional(),
|
2619
|
+
tickInside: z.boolean().default(false).optional(),
|
2620
|
+
tickColor: z.string().default('rgba(54, 65, 89, 0.30)').optional(),
|
2621
|
+
tickSize: z.number().default(4).optional()
|
2622
|
+
}).optional(),
|
2623
|
+
title: z.object({
|
2624
|
+
visible: z.boolean().default(false).optional(),
|
2625
|
+
titleText: z.string().default('').optional(),
|
2626
|
+
titleColor: z.string().default('#646A73').optional(),
|
2627
|
+
titleFontSize: z.number().default(12).optional(),
|
2628
|
+
titleFontWeight: z.number().default(400).optional()
|
2629
|
+
}).optional(),
|
2630
|
+
grid: z.object({
|
2631
|
+
visible: z.boolean().default(false).optional(),
|
2632
|
+
gridColor: z.string().default('rgba(54, 65, 89, 0.15)').optional(),
|
2633
|
+
gridWidth: z.number().default(0.5).optional()
|
2634
|
+
}).optional()
|
2635
|
+
});
|
2636
|
+
const zYBandAxis = zXBandAxis;
|
2637
|
+
const zXLinearAxis = z.object({
|
2638
|
+
visible: z.boolean().default(true).optional(),
|
2639
|
+
min: z.number().optional(),
|
2640
|
+
max: z.number().optional(),
|
2641
|
+
nice: z.boolean().default(true).optional(),
|
2642
|
+
zero: z.boolean().default(true).optional(),
|
2643
|
+
inverse: z.boolean().default(false).optional(),
|
2644
|
+
label: z.object({
|
2645
|
+
visible: z.boolean().default(true).optional(),
|
2646
|
+
labelColor: z.string().default('#797B85').optional(),
|
2647
|
+
labelFontSize: z.number().default(12).optional(),
|
2648
|
+
labelFontWeight: z.number().default(400).optional(),
|
2649
|
+
labelAngle: z.number().default(0).optional()
|
2650
|
+
}).optional(),
|
2651
|
+
line: z.object({
|
2652
|
+
visible: z.boolean().default(true).optional(),
|
2653
|
+
lineColor: z.string().default('rgba(54, 65, 89, 0.30)').optional(),
|
2654
|
+
lineWidth: z.number().default(1).optional()
|
2655
|
+
}).optional(),
|
2656
|
+
tick: z.object({
|
2657
|
+
visible: z.boolean().default(true).optional(),
|
2658
|
+
tickInside: z.boolean().default(false).optional(),
|
2659
|
+
tickColor: z.string().default('rgba(54, 65, 89, 0.30)').optional(),
|
2660
|
+
tickSize: z.number().default(4).optional()
|
2661
|
+
}).optional(),
|
2662
|
+
title: z.object({
|
2663
|
+
visible: z.boolean().default(false).optional(),
|
2664
|
+
titleText: z.string().default('').optional(),
|
2665
|
+
titleColor: z.string().default('#646A73').optional(),
|
2666
|
+
titleFontSize: z.number().default(12).optional(),
|
2667
|
+
titleFontWeight: z.number().default(400).optional()
|
2668
|
+
}).optional(),
|
2669
|
+
grid: z.object({
|
2670
|
+
visible: z.boolean().default(false).optional(),
|
2671
|
+
gridColor: z.string().default('rgba(54, 65, 89, 0.15)').optional(),
|
2672
|
+
gridWidth: z.number().default(0.5).optional()
|
2673
|
+
}).optional()
|
2674
|
+
});
|
2675
|
+
const zYLinearAxis = zXLinearAxis;
|
2676
|
+
const zConfig = z.object({
|
2677
|
+
line: z.object({
|
2678
|
+
xAxis: zXBandAxis,
|
2679
|
+
yAxis: zYLinearAxis
|
2680
|
+
}).optional(),
|
2681
|
+
column: z.object({
|
2682
|
+
xAxis: zXBandAxis,
|
2683
|
+
yAxis: zYLinearAxis
|
2684
|
+
}).optional(),
|
2685
|
+
columnParallel: z.object({
|
2686
|
+
xAxis: zXBandAxis,
|
2687
|
+
yAxis: zYLinearAxis
|
2688
|
+
}).optional(),
|
2689
|
+
columnPercent: z.object({
|
2690
|
+
xAxis: zXBandAxis,
|
2691
|
+
yAxis: zYLinearAxis
|
2692
|
+
}).optional(),
|
2693
|
+
bar: z.object({
|
2694
|
+
xAxis: zXLinearAxis,
|
2695
|
+
yAxis: zYBandAxis
|
2696
|
+
}).optional(),
|
2697
|
+
barParallel: z.object({
|
2698
|
+
xAxis: zXLinearAxis,
|
2699
|
+
yAxis: zYBandAxis
|
2700
|
+
}).optional(),
|
2701
|
+
barPercent: z.object({
|
2702
|
+
xAxis: zXLinearAxis,
|
2703
|
+
yAxis: zYBandAxis
|
2704
|
+
}).optional(),
|
2705
|
+
area: z.object({
|
2706
|
+
xAxis: zXBandAxis,
|
2707
|
+
yAxis: zYLinearAxis
|
2708
|
+
}).optional(),
|
2709
|
+
areaPercent: z.object({
|
2710
|
+
xAxis: zXBandAxis,
|
2711
|
+
yAxis: zYLinearAxis
|
2712
|
+
}).optional(),
|
2713
|
+
pie: z.object({}).optional(),
|
2714
|
+
donut: z.object({}).optional(),
|
2715
|
+
rose: z.object({}).optional(),
|
2716
|
+
dualAxis: z.object({}).optional(),
|
2717
|
+
table: z.object({}).optional(),
|
2718
|
+
pivotTable: z.object({}).optional()
|
2719
|
+
});
|
1538
2720
|
const zCustomThemeConfig = z.object({
|
1539
|
-
baseConfig: zBaseConfig.optional()
|
2721
|
+
baseConfig: zBaseConfig.optional(),
|
2722
|
+
config: zConfig.optional()
|
1540
2723
|
});
|
1541
2724
|
const zCustomTheme = z.record(z.string(), zCustomThemeConfig).optional();
|
1542
2725
|
const zTheme = z.string();
|
1543
|
-
export { Builder, areaAdvancedPipeline, areaPercentAdvancedPipeline, areaPercentSpecPipeline, areaSpecPipeline, barAdvancedPipeline, barParallelAdvancedPipeline, barParallelSpecPipeline, barPercentAdvancedPipeline, barPercentSpecPipeline, barSpecPipeline, columnAdvancedPipeline, columnParallelAdvancedPipeline, columnParallelSpecPipeline, columnPercentAdvancedPipeline, columnPercentSpecPipeline, columnSpecPipeline, darkTheme,
|
2726
|
+
export { Builder, FoldMeasureId, FoldMeasureName, FoldMeasureValue, Separator, UnfoldDimensionGroup, 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, zAxis, zBackgroundColor, zBaseConfig, zChartType, zColor, zConfig, zCustomTheme, zCustomThemeConfig, zDataset, zDatasetReshapeInfo, zDatum, zDimension, zDimensions, zEncoding, zFoldInfo, zLabel, zLegend, zMeasure, zMeasureGroup, zMeasures, zTheme, zTooltip, zUnfoldInfo, zXBandAxis, zXLinearAxis, zYBandAxis, zYLinearAxis };
|
1544
2727
|
|
1545
2728
|
//# sourceMappingURL=index.js.map
|