@visactor/vseed 0.0.32 → 0.0.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/builder/builder/buildAdvanced.d.ts +1 -1
- package/dist/builder/builder/buildSpec.d.ts +1 -1
- package/dist/builder/builder/builder.d.ts +2795 -4888
- package/dist/builder/register/chartType/dualAxis.d.ts +1 -0
- package/dist/builder/register/chartType/index.d.ts +12 -11
- package/dist/dataReshape/constant.d.ts +3 -1
- package/dist/index.cjs +1392 -236
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1325 -196
- package/dist/index.js.map +1 -1
- package/dist/pipeline/advanced/chart/pipeline/dualAxis.d.ts +2 -0
- package/dist/pipeline/advanced/chart/pipeline/index.d.ts +1 -0
- package/dist/pipeline/advanced/chart/pipes/config/dualAxis.d.ts +2 -0
- package/dist/pipeline/advanced/chart/pipes/config/index.d.ts +1 -0
- package/dist/pipeline/advanced/chart/pipes/encoding/encodingAreaRange.d.ts +2 -0
- package/dist/pipeline/advanced/chart/pipes/encoding/index.d.ts +1 -0
- package/dist/pipeline/advanced/chart/pipes/init/autoDualMeasures.d.ts +2 -0
- package/dist/pipeline/advanced/chart/pipes/reshape/index.d.ts +2 -0
- package/dist/pipeline/advanced/chart/pipes/reshape/pivotReshapeTo2D2M.d.ts +8 -0
- package/dist/pipeline/advanced/chart/pipes/reshape/reshapeTo2D2M.d.ts +8 -0
- package/dist/pipeline/spec/chart/pipeline/dualAxis.d.ts +2 -0
- package/dist/pipeline/spec/chart/pipeline/index.d.ts +1 -0
- package/dist/pipeline/spec/chart/pipes/axes/index.d.ts +2 -0
- package/dist/pipeline/spec/chart/pipes/axes/yLinearPrimary.d.ts +2 -0
- package/dist/pipeline/spec/chart/pipes/axes/yLinearSecondary.d.ts +2 -0
- package/dist/pipeline/spec/chart/pipes/dataset/datasetDualAxis.d.ts +3 -0
- package/dist/pipeline/spec/chart/pipes/dataset/index.d.ts +1 -0
- package/dist/pipeline/spec/chart/pipes/dual/dualChartType.d.ts +3 -0
- package/dist/pipeline/spec/chart/pipes/dual/index.d.ts +1 -0
- package/dist/pipeline/spec/chart/pipes/index.d.ts +1 -0
- package/dist/pipeline/spec/chart/pipes/init/index.d.ts +1 -0
- package/dist/pipeline/spec/chart/pipes/init/initDualAxis.d.ts +3 -0
- package/dist/pipeline/spec/chart/pipes/label/index.d.ts +1 -0
- package/dist/pipeline/spec/chart/pipes/label/labelDualAxis.d.ts +3 -0
- package/dist/pipeline/spec/chart/pipes/tooltip/index.d.ts +1 -0
- package/dist/pipeline/spec/chart/pipes/tooltip/tooltipDualAxis.d.ts +3 -0
- package/dist/pipeline/utils/chatType.d.ts +2 -2
- package/dist/pipeline/utils/measures/depth.d.ts +8 -0
- package/dist/pipeline/utils/measures/index.d.ts +1 -0
- package/dist/types/advancedVSeed.d.ts +547 -54
- package/dist/types/builder/builder.d.ts +16 -15
- package/dist/types/chartType/area/area.d.ts +0 -1494
- package/dist/types/chartType/area/index.d.ts +2 -1
- package/dist/types/chartType/area/zArea.d.ts +1494 -0
- package/dist/types/chartType/areaPercent/areaPercent.d.ts +0 -1494
- package/dist/types/chartType/areaPercent/index.d.ts +2 -1
- package/dist/types/chartType/areaPercent/zAreaPercent.d.ts +1494 -0
- package/dist/types/chartType/areaRange/areaRange.d.ts +0 -1433
- package/dist/types/chartType/areaRange/index.d.ts +2 -1
- package/dist/types/chartType/areaRange/zAreaRange.d.ts +1433 -0
- package/dist/types/chartType/bar/bar.d.ts +40 -40
- package/dist/types/chartType/barParallel/barParallel.d.ts +40 -40
- package/dist/types/chartType/barPercent/barPercent.d.ts +40 -40
- package/dist/types/chartType/column/column.d.ts +40 -40
- package/dist/types/chartType/columnParallel/columnParallel.d.ts +40 -40
- package/dist/types/chartType/columnPercent/columnPercent.d.ts +40 -40
- package/dist/types/chartType/dualAxis/dualAxis.d.ts +123 -23
- package/dist/types/chartType/dualAxis/index.d.ts +1 -0
- package/dist/types/chartType/dualAxis/zDualAxis.d.ts +1963 -0
- package/dist/types/chartType/index.d.ts +1 -1
- package/dist/types/chartType/line/line.d.ts +40 -40
- package/dist/types/chartType/scatter/scatter.d.ts +40 -40
- package/dist/types/properties/annotation/annotation.d.ts +40 -40
- package/dist/types/properties/annotation/annotationArea.d.ts +27 -34
- package/dist/types/properties/annotation/annotationHorizontalLine.d.ts +7 -7
- package/dist/types/properties/annotation/annotationPoint.d.ts +24 -22
- package/dist/types/properties/annotation/annotationVerticalLine.d.ts +7 -7
- package/dist/types/properties/chartType/dualChartType.d.ts +22 -0
- package/dist/types/properties/chartType/index.d.ts +2 -0
- package/dist/types/properties/config/config.d.ts +493 -7
- package/dist/types/properties/datasetReshapeInfo/datasetReshapeInfo.d.ts +7 -0
- package/dist/types/properties/measures/dualMeasures.d.ts +8 -0
- package/dist/types/properties/measures/index.d.ts +4 -1
- package/dist/types/properties/measures/measures.d.ts +0 -107
- package/dist/types/properties/measures/zDualMeasures.d.ts +287 -0
- package/dist/types/properties/measures/zMeasures.d.ts +108 -0
- package/dist/types/properties/theme/customTheme.d.ts +500 -14
- package/dist/types/vseed.d.ts +2401 -440
- package/dist/umd/index.js +1316 -178
- package/dist/umd/index.js.map +1 -1
- package/package.json +1 -1
package/dist/umd/index.js
CHANGED
@@ -38,10 +38,11 @@
|
|
38
38
|
areaSpecPipeline: ()=>areaSpecPipeline,
|
39
39
|
isTable: ()=>isTable,
|
40
40
|
zDonut: ()=>zDonut,
|
41
|
+
zDualMeasures: ()=>zDualMeasures,
|
41
42
|
zPie: ()=>zPie,
|
42
|
-
zRoseConfig: ()=>zRoseConfig,
|
43
43
|
findFirstMeasure: ()=>findFirstMeasure,
|
44
44
|
scatterAdvancedPipeline: ()=>scatterAdvancedPipeline,
|
45
|
+
zRoseConfig: ()=>zRoseConfig,
|
45
46
|
updateSpec: ()=>updateSpec,
|
46
47
|
zCrosshairRect: ()=>zCrosshairRect,
|
47
48
|
scatterSpecPipeline: ()=>scatterSpecPipeline,
|
@@ -50,6 +51,7 @@
|
|
50
51
|
zColumnConfig: ()=>zColumnConfig,
|
51
52
|
zAnnotation: ()=>zAnnotation,
|
52
53
|
selector: ()=>selector_selector,
|
54
|
+
zDualMeasure: ()=>zDualMeasure,
|
53
55
|
zSortLegend: ()=>zSortLegend,
|
54
56
|
pivotTableAdvancedPipeline: ()=>pivotTableAdvancedPipeline,
|
55
57
|
zYBandAxis: ()=>zYBandAxis,
|
@@ -109,27 +111,27 @@
|
|
109
111
|
registerPivotTable: ()=>registerPivotTable,
|
110
112
|
tableAdvancedPipeline: ()=>tableAdvancedPipeline,
|
111
113
|
pieSpecPipeline: ()=>pieSpecPipeline,
|
114
|
+
dualAxisSpecPipeline: ()=>dualAxisSpecPipeline,
|
112
115
|
registerDarkTheme: ()=>registerDarkTheme,
|
113
116
|
zAnnotationVerticalLine: ()=>zAnnotationVerticalLine,
|
114
|
-
zChartType: ()=>zChartType,
|
115
117
|
barSpecPipeline: ()=>barSpecPipeline,
|
116
|
-
|
118
|
+
zChartType: ()=>zChartType,
|
117
119
|
registerRose: ()=>registerRose,
|
118
|
-
|
120
|
+
zCrosshairLine: ()=>zCrosshairLine,
|
119
121
|
unfoldDimensions: ()=>unfoldDimensions,
|
120
122
|
roseParallelAdvancedPipeline: ()=>roseParallelAdvancedPipeline,
|
121
123
|
registerTable: ()=>registerTable,
|
122
|
-
Builder: ()=>Builder,
|
123
124
|
autoFormatter: ()=>autoFormatter,
|
124
125
|
findFirstDimension: ()=>findFirstDimension,
|
126
|
+
Builder: ()=>Builder,
|
125
127
|
registerAll: ()=>registerAll,
|
126
128
|
registerBar: ()=>registerBar,
|
127
129
|
isVChart: ()=>isVChart,
|
128
130
|
radarSpecPipeline: ()=>radarSpecPipeline,
|
131
|
+
zMeasureTree: ()=>zMeasureTree,
|
129
132
|
zPieConfig: ()=>zPieConfig,
|
130
133
|
zPivotTable: ()=>zPivotTable,
|
131
134
|
zRadar: ()=>zRadar,
|
132
|
-
zRose: ()=>zRose,
|
133
135
|
registerLine: ()=>registerLine,
|
134
136
|
registerCustomTheme: ()=>registerCustomTheme,
|
135
137
|
zColor: ()=>zColor,
|
@@ -140,16 +142,16 @@
|
|
140
142
|
zDonutConfig: ()=>zDonutConfig,
|
141
143
|
zFunnelConfig: ()=>zFunnelConfig,
|
142
144
|
zMeasureGroup: ()=>zMeasureGroup,
|
143
|
-
|
145
|
+
zDualAxis: ()=>zDualAxis,
|
144
146
|
FoldMeasureName: ()=>FoldMeasureName,
|
145
|
-
|
147
|
+
zDualChartType: ()=>zDualChartType,
|
146
148
|
darkTheme: ()=>darkTheme,
|
147
149
|
createNumFormatter: ()=>createNumFormatter,
|
148
150
|
zAreaConfig: ()=>zAreaConfig,
|
149
151
|
zAxis: ()=>zAxis,
|
150
152
|
isVTable: ()=>isVTable,
|
151
|
-
|
152
|
-
|
153
|
+
zMeasures: ()=>zMeasures,
|
154
|
+
zRadarConfig: ()=>zRadarConfig,
|
153
155
|
zLine: ()=>zLine,
|
154
156
|
columnSpecPipeline: ()=>columnSpecPipeline,
|
155
157
|
UnfoldDimensionGroup: ()=>UnfoldDimensionGroup,
|
@@ -160,6 +162,8 @@
|
|
160
162
|
ORIGINAL_DATA: ()=>ORIGINAL_DATA,
|
161
163
|
zStackCornerRadius: ()=>zStackCornerRadius,
|
162
164
|
zAnnotationArea: ()=>zAnnotationArea,
|
165
|
+
zUnfoldInfo: ()=>zUnfoldInfo,
|
166
|
+
zRose: ()=>zRose,
|
163
167
|
columnParallelSpecPipeline: ()=>columnParallelSpecPipeline,
|
164
168
|
i18n: ()=>i18n,
|
165
169
|
zPointStyle: ()=>zPointStyle,
|
@@ -168,12 +172,15 @@
|
|
168
172
|
registerColumnParallel: ()=>registerColumnParallel,
|
169
173
|
updateAdvanced: ()=>updateAdvanced,
|
170
174
|
zDimension: ()=>zDimension,
|
175
|
+
zTable: ()=>zTable,
|
176
|
+
FoldSecondaryMeasureValue: ()=>FoldSecondaryMeasureValue,
|
171
177
|
zSort: ()=>zSort,
|
172
178
|
isPivotChart: ()=>isPivotChart,
|
173
179
|
zDualAxisConfig: ()=>zDualAxisConfig,
|
174
180
|
zColumn: ()=>zColumn,
|
175
181
|
zCustomTheme: ()=>zCustomTheme,
|
176
182
|
zLineConfig: ()=>zLineConfig,
|
183
|
+
FoldPrimaryMeasureValue: ()=>FoldPrimaryMeasureValue,
|
177
184
|
zTableConfig: ()=>zTableConfig,
|
178
185
|
zXBandAxis: ()=>zXBandAxis,
|
179
186
|
dataReshapeFor1D: ()=>dataReshapeFor1D,
|
@@ -191,15 +198,17 @@
|
|
191
198
|
zMeasure: ()=>zMeasure,
|
192
199
|
areaRangeSpecPipeline: ()=>areaRangeSpecPipeline,
|
193
200
|
areaRangeAdvancedPipeline: ()=>areaRangeAdvancedPipeline,
|
194
|
-
|
201
|
+
dualAxisAdvancedPipeline: ()=>dualAxisAdvancedPipeline,
|
195
202
|
registerScatter: ()=>registerScatter,
|
196
|
-
|
203
|
+
zAreaRange: ()=>zAreaRange,
|
204
|
+
measureDepth: ()=>measureDepth,
|
197
205
|
autoNumFormatter: ()=>autoNumFormatter,
|
198
206
|
zAdvancedVSeed: ()=>zAdvancedVSeed,
|
199
207
|
tableSpecPipeline: ()=>tableSpecPipeline,
|
200
208
|
zConfig: ()=>zConfig,
|
201
|
-
|
209
|
+
zEncoding: ()=>zEncoding,
|
202
210
|
zBarStyle: ()=>zBarStyle,
|
211
|
+
zRoseParallelConfig: ()=>zRoseParallelConfig,
|
203
212
|
zXLinearAxis: ()=>zXLinearAxis,
|
204
213
|
zAreaPercent: ()=>zAreaPercent,
|
205
214
|
columnParallelAdvancedPipeline: ()=>columnParallelAdvancedPipeline,
|
@@ -238,11 +247,11 @@
|
|
238
247
|
const start = 'undefined' != typeof performance ? performance.now() : Date.now();
|
239
248
|
const { chartType } = builder.vseed;
|
240
249
|
if (!chartType) throw new Error('chartType is nil in buildAdvanced');
|
241
|
-
const pipeline =
|
250
|
+
const pipeline = Builder.getAdvancedPipeline(chartType);
|
242
251
|
if (!pipeline) throw new Error(`no advanced pipeline for chartType ${chartType}`);
|
243
252
|
const context = {
|
244
253
|
vseed: builder.vseed,
|
245
|
-
customTheme:
|
254
|
+
customTheme: Builder.getThemeMap()
|
246
255
|
};
|
247
256
|
try {
|
248
257
|
return execPipeline(pipeline, context);
|
@@ -258,7 +267,7 @@
|
|
258
267
|
const start = 'undefined' != typeof performance ? performance.now() : Date.now();
|
259
268
|
const { chartType } = builder.vseed;
|
260
269
|
if (!chartType) throw new Error('chartType is nil in buildSpec');
|
261
|
-
const pipeline =
|
270
|
+
const pipeline = Builder.getSpecPipeline(chartType);
|
262
271
|
if (!pipeline) throw new Error(`no spec pipeline for chartType ${chartType}`);
|
263
272
|
const context = {
|
264
273
|
vseed: builder.vseed,
|
@@ -425,20 +434,6 @@
|
|
425
434
|
build = ()=>build(this);
|
426
435
|
buildSpec = (advanced)=>buildSpec(this, advanced);
|
427
436
|
buildAdvanced = ()=>buildAdvanced(this);
|
428
|
-
getAdvancedPipeline = (chartType)=>{
|
429
|
-
const customPipe = Builder._customAdvancedPipe[chartType];
|
430
|
-
const pipeline = Builder._advancedPipelineMap[chartType];
|
431
|
-
if (customPipe) pipeline.push(customPipe);
|
432
|
-
return pipeline;
|
433
|
-
};
|
434
|
-
getSpecPipeline = (chartType)=>{
|
435
|
-
const customPipe = Builder._customSpecPipe[chartType];
|
436
|
-
const pipeline = Builder._specPipelineMap[chartType];
|
437
|
-
if (customPipe) pipeline.push(customPipe);
|
438
|
-
return pipeline;
|
439
|
-
};
|
440
|
-
getTheme = (themeKey)=>Builder._themeMap[themeKey];
|
441
|
-
getThemeMap = ()=>Builder._themeMap;
|
442
437
|
getColorItems = ()=>getColorItems(this);
|
443
438
|
getColorIdMap = ()=>getColorIdMap(this);
|
444
439
|
get vseed() {
|
@@ -465,12 +460,26 @@
|
|
465
460
|
set performance(value) {
|
466
461
|
this._performance = value;
|
467
462
|
}
|
463
|
+
static getAdvancedPipeline = (chartType)=>{
|
464
|
+
const customPipe = Builder._customAdvancedPipe[chartType];
|
465
|
+
const pipeline = Builder._advancedPipelineMap[chartType];
|
466
|
+
if (customPipe) pipeline.push(customPipe);
|
467
|
+
return pipeline;
|
468
|
+
};
|
469
|
+
static getSpecPipeline = (chartType)=>{
|
470
|
+
const customPipe = Builder._customSpecPipe[chartType];
|
471
|
+
const pipeline = Builder._specPipelineMap[chartType];
|
472
|
+
if (customPipe) pipeline.push(customPipe);
|
473
|
+
return pipeline;
|
474
|
+
};
|
475
|
+
static getTheme = (themeKey)=>Builder._themeMap[themeKey];
|
476
|
+
static getThemeMap = ()=>Builder._themeMap;
|
477
|
+
static from = (vseed)=>new Builder(vseed);
|
468
478
|
static _advancedPipelineMap = {};
|
469
479
|
static _specPipelineMap = {};
|
470
480
|
static _customAdvancedPipe = {};
|
471
481
|
static _customSpecPipe = {};
|
472
482
|
static _themeMap = {};
|
473
|
-
static from = (vseed)=>new Builder(vseed);
|
474
483
|
}
|
475
484
|
const initAdvancedVSeed = (advancedVSeed, context)=>{
|
476
485
|
const { vseed } = context;
|
@@ -489,7 +498,7 @@
|
|
489
498
|
const { measures, dataset } = vseed;
|
490
499
|
if (!dataset) throw new Error('dataset is required');
|
491
500
|
if (0 === dataset.length) return result;
|
492
|
-
if (measures
|
501
|
+
if (measures) {
|
493
502
|
result.measures = measures;
|
494
503
|
return result;
|
495
504
|
}
|
@@ -569,8 +578,11 @@
|
|
569
578
|
const measures = findAllMeasures(advancedVSeed.measures);
|
570
579
|
if (!dataset) throw new Error('dataset is required');
|
571
580
|
if (0 === dataset.length) return result;
|
572
|
-
if (dimensions
|
573
|
-
result.dimensions = dimensions
|
581
|
+
if (dimensions) {
|
582
|
+
result.dimensions = dimensions.map((dim)=>({
|
583
|
+
location: 'dimension',
|
584
|
+
...dim
|
585
|
+
}));
|
574
586
|
return result;
|
575
587
|
}
|
576
588
|
const top100dataset = dataset.slice(0, 100);
|
@@ -924,7 +936,7 @@
|
|
924
936
|
const measures = findAllMeasures(vseed.measures);
|
925
937
|
if (!dataset) throw new Error('dataset is required');
|
926
938
|
if (0 === dataset.length) return result;
|
927
|
-
if (measures
|
939
|
+
if (vseed.measures) {
|
928
940
|
result.measures = findAllMeasures(measures);
|
929
941
|
return result;
|
930
942
|
}
|
@@ -987,7 +999,7 @@
|
|
987
999
|
const measures = findAllMeasures(advancedVSeed.measures);
|
988
1000
|
if (!dataset) throw new Error('dataset is required');
|
989
1001
|
if (0 === dataset.length) return result;
|
990
|
-
if (dimensions
|
1002
|
+
if (dimensions) {
|
991
1003
|
const newDimensions = findAllDimensions(dimensions);
|
992
1004
|
result.dimensions = newDimensions.map((item, index)=>{
|
993
1005
|
if ('rowDimension' === item.location || 'columnDimension' === item.location) return item;
|
@@ -1222,6 +1234,15 @@
|
|
1222
1234
|
locale: locale || 'zh-CN'
|
1223
1235
|
};
|
1224
1236
|
};
|
1237
|
+
const measureDepth = (measures = [])=>{
|
1238
|
+
if (!measures) return 0;
|
1239
|
+
let depth = 1;
|
1240
|
+
preorderTraverse(measures, (node)=>{
|
1241
|
+
if ('children' in node) depth = Math.max(depth, 1 + measureDepth(node.children));
|
1242
|
+
return false;
|
1243
|
+
});
|
1244
|
+
return depth;
|
1245
|
+
};
|
1225
1246
|
const isTable = (vseed)=>'table' === vseed.chartType;
|
1226
1247
|
const isPivotTable = (vseed)=>'pivotTable' === vseed.chartType;
|
1227
1248
|
const isVTable = (vseed)=>[
|
@@ -1231,9 +1252,18 @@
|
|
1231
1252
|
const isVChart = (vseed)=>!isVTable(vseed);
|
1232
1253
|
const isPivotChart = (vseed)=>{
|
1233
1254
|
if (isVTable(vseed)) return false;
|
1255
|
+
if ('dualAxis' === vseed.chartType) {
|
1256
|
+
if (vseed.measures) {
|
1257
|
+
const depth = measureDepth(vseed.measures);
|
1258
|
+
if (3 === depth) return true;
|
1259
|
+
return false;
|
1260
|
+
}
|
1261
|
+
if (vseed.dualMeasures && vseed.dualMeasures.length > 1) return true;
|
1262
|
+
return false;
|
1263
|
+
}
|
1234
1264
|
const { measures = [], dimensions = [] } = vseed;
|
1235
1265
|
const hasRowOrColumnDimension = dimensions && dimensions.some((dimension)=>'rowDimension' === dimension.location || 'columnDimension' === dimension.location);
|
1236
|
-
const hasMeasureGroup = measures && measures.
|
1266
|
+
const hasMeasureGroup = measures && measures.some((measure)=>measure && measure.children);
|
1237
1267
|
return hasRowOrColumnDimension || hasMeasureGroup;
|
1238
1268
|
};
|
1239
1269
|
const autoMeasures_autoMeasures = (advancedVSeed, context)=>{
|
@@ -1317,7 +1347,10 @@
|
|
1317
1347
|
if (!dataset) throw new Error('dataset is required');
|
1318
1348
|
if (0 === dataset.length) return result;
|
1319
1349
|
if (dimensions) {
|
1320
|
-
result.dimensions = dimensions
|
1350
|
+
result.dimensions = dimensions.map((dim)=>({
|
1351
|
+
location: 'dimension',
|
1352
|
+
...dim
|
1353
|
+
}));
|
1321
1354
|
return result;
|
1322
1355
|
}
|
1323
1356
|
const top100dataset = dataset.slice(0, 100);
|
@@ -1343,8 +1376,10 @@
|
|
1343
1376
|
return execPipeline(pipeline, context, advancedVSeed);
|
1344
1377
|
};
|
1345
1378
|
const FoldMeasureName = '__MeaName__';
|
1346
|
-
const FoldMeasureValue = '__MeaValue__';
|
1347
1379
|
const FoldMeasureId = '__MeaId__';
|
1380
|
+
const FoldMeasureValue = '__MeaValue__';
|
1381
|
+
const FoldPrimaryMeasureValue = '__MeaPrimaryValue__';
|
1382
|
+
const FoldSecondaryMeasureValue = '__MeaSecondaryValue__';
|
1348
1383
|
const UnfoldDimensionGroup = '__DimGroup__';
|
1349
1384
|
const UnfoldDimensionGroupId = '__DimGroupID__';
|
1350
1385
|
const Separator = '-';
|
@@ -1545,6 +1580,7 @@
|
|
1545
1580
|
datasetReshapeInfo: [
|
1546
1581
|
{
|
1547
1582
|
id: '2D1M',
|
1583
|
+
index: 0,
|
1548
1584
|
foldInfo,
|
1549
1585
|
unfoldInfo
|
1550
1586
|
}
|
@@ -1569,7 +1605,7 @@
|
|
1569
1605
|
const commonDimensions = dimensions.filter((dim)=>'dimension' === dim.location);
|
1570
1606
|
const newDatasets = [];
|
1571
1607
|
const datasetReshapeInfo = [];
|
1572
|
-
measureGroups.forEach((measureGroup)=>{
|
1608
|
+
measureGroups.forEach((measureGroup, index)=>{
|
1573
1609
|
const measures = measureGroup.children;
|
1574
1610
|
if (!measures) return;
|
1575
1611
|
const groupId = measureGroup.id;
|
@@ -1581,6 +1617,7 @@
|
|
1581
1617
|
});
|
1582
1618
|
const reshapeInfo = {
|
1583
1619
|
id: groupId,
|
1620
|
+
index,
|
1584
1621
|
foldInfo,
|
1585
1622
|
unfoldInfo
|
1586
1623
|
};
|
@@ -1879,11 +1916,13 @@
|
|
1879
1916
|
const { unfoldInfo } = datasetReshapeInfo[0];
|
1880
1917
|
const baseConfig = advancedVSeed.config[chartType];
|
1881
1918
|
if (!baseConfig || !baseConfig.color) return result;
|
1919
|
+
const colorItems = unfoldInfo.colorItems;
|
1920
|
+
const colorIdMap = unfoldInfo.colorIdMap;
|
1882
1921
|
const { color } = baseConfig;
|
1883
1922
|
const { colorScheme, colorMapping } = color;
|
1884
1923
|
const mappingList = [];
|
1885
1924
|
if (colorMapping) Object.entries(colorMapping).sort((a, b)=>a[0].split(Separator).length - b[0].split(Separator).length).forEach(([key, value])=>{
|
1886
|
-
const idMap = Object.entries(
|
1925
|
+
const idMap = Object.entries(colorIdMap).filter(([_, v])=>v.includes(key));
|
1887
1926
|
for (const [colorId] of idMap)mappingList.push([
|
1888
1927
|
colorId,
|
1889
1928
|
value
|
@@ -1891,7 +1930,7 @@
|
|
1891
1930
|
});
|
1892
1931
|
result.color = {
|
1893
1932
|
type: 'ordinal',
|
1894
|
-
domain:
|
1933
|
+
domain: colorItems,
|
1895
1934
|
range: colorScheme,
|
1896
1935
|
specified: Object.fromEntries(mappingList)
|
1897
1936
|
};
|
@@ -2735,7 +2774,7 @@
|
|
2735
2774
|
annotationPoint
|
2736
2775
|
];
|
2737
2776
|
const markPoint = annotationPointList.flatMap((annotationPoint)=>{
|
2738
|
-
const { selector: selectorPoint, text = '', textColor = '#ffffff', textFontSize = 12, textFontWeight = 400, textAlign = 'center', textBaseline = '
|
2777
|
+
const { selector: selectorPoint, text = '', textColor = '#ffffff', textFontSize = 12, textFontWeight = 400, textAlign = 'center', textBaseline = 'top', backgroundBorderColor, backgroundBorderRadius = 4, backgroundBorderWidth = 1, backgroundColor = '#212121', backgroundPadding = 2, backgroundVisible = true, offsetX = 0, offsetY = 0 } = annotationPoint;
|
2739
2778
|
const dataset = advancedVSeed.dataset.flat();
|
2740
2779
|
const selectedData = selectorPoint ? dataset.filter((datum)=>selector_selector(datum, selectorPoint)) : [];
|
2741
2780
|
return selectedData.map((datum)=>({
|
@@ -2767,7 +2806,8 @@
|
|
2767
2806
|
stroke: backgroundColor,
|
2768
2807
|
lineWidth: 1,
|
2769
2808
|
fontSize: textFontSize,
|
2770
|
-
fontWeight: textFontWeight
|
2809
|
+
fontWeight: textFontWeight,
|
2810
|
+
dy: textFontSize
|
2771
2811
|
},
|
2772
2812
|
labelBackground: {
|
2773
2813
|
visible: backgroundVisible,
|
@@ -2776,7 +2816,8 @@
|
|
2776
2816
|
cornerRadius: backgroundBorderRadius ?? 4,
|
2777
2817
|
fill: backgroundColor,
|
2778
2818
|
stroke: backgroundBorderColor,
|
2779
|
-
lineWidth: backgroundBorderWidth
|
2819
|
+
lineWidth: backgroundBorderWidth,
|
2820
|
+
dy: textFontSize
|
2780
2821
|
}
|
2781
2822
|
}
|
2782
2823
|
}
|
@@ -2811,7 +2852,7 @@
|
|
2811
2852
|
insideEnd: 'insideEndTop'
|
2812
2853
|
};
|
2813
2854
|
const markLine = annotationVerticalLineList.flatMap((annotationVerticalLine)=>{
|
2814
|
-
const { selector: selectorPoint, xValue, text = '', textPosition = 'insideEnd', textColor = '#ffffff', textFontSize = 12, textFontWeight = 400, textAlign = 'right', textBaseline = 'top',
|
2855
|
+
const { selector: selectorPoint, xValue, text = '', textPosition = 'insideEnd', textColor = '#ffffff', textFontSize = 12, textFontWeight = 400, textAlign = 'right', textBaseline = 'top', backgroundVisible = true, backgroundBorderColor = '#212121', backgroundColor = '#212121', backgroundBorderRadius = 4, backgroundBorderWidth = 1, backgroundPadding = 2, lineVisible = true, lineColor = '#212121', lineWidth = 1, lineStyle = 'dashed', offsetX = 0, offsetY = 0 } = annotationVerticalLine;
|
2815
2856
|
const dataset = advancedVSeed.dataset.flat();
|
2816
2857
|
const generateOneMarkLine = (x)=>({
|
2817
2858
|
x: x,
|
@@ -2910,7 +2951,7 @@
|
|
2910
2951
|
insideEnd: 'insideEndTop'
|
2911
2952
|
};
|
2912
2953
|
const markLine = annotationVerticalLineList.flatMap((annotationVerticalLine)=>{
|
2913
|
-
const { selector: selectorPoint, yValue, text = '', textPosition = 'insideEnd', textColor = '#ffffff', textFontSize = 12, textFontWeight = 400, textAlign = 'right', textBaseline = 'top',
|
2954
|
+
const { selector: selectorPoint, yValue, text = '', textPosition = 'insideEnd', textColor = '#ffffff', textFontSize = 12, textFontWeight = 400, textAlign = 'right', textBaseline = 'top', lineColor = '#212121', lineStyle = 'dashed', lineVisible = true, lineWidth = 1, backgroundVisible = true, backgroundColor = '#212121', backgroundBorderColor = '#212121', backgroundBorderRadius = 4, backgroundBorderWidth = 1, backgroundPadding = 2, offsetX = 0, offsetY = 0 } = annotationVerticalLine;
|
2914
2955
|
const dataset = advancedVSeed.dataset.flat();
|
2915
2956
|
const generateOneMarkLine = (y)=>({
|
2916
2957
|
y,
|
@@ -3011,7 +3052,7 @@
|
|
3011
3052
|
right: 'insideRight'
|
3012
3053
|
};
|
3013
3054
|
const markArea = annotationAreaList.flatMap((annotationArea)=>{
|
3014
|
-
const { selector: selectorPoint, text = '', textPosition = 'top', textColor = '#ffffff', textFontSize = 12, textFontWeight = 400, textAlign = 'center', textBaseline = 'top',
|
3055
|
+
const { selector: selectorPoint, text = '', textPosition = 'top', textColor = '#ffffff', textFontSize = 12, textFontWeight = 400, textAlign = 'center', textBaseline = 'top', backgroundVisible = true, backgroundColor = '#191d24', backgroundBorderColor = '#191d24', backgroundBorderWidth = 1, backgroundBorderRadius = 4, backgroundPadding = 4, areaColor = '#888888', areaColorOpacity = 0.15, areaBorderColor = '#888888', areaBorderRadius = 4, areaBorderWidth = 1, outerPadding = 4, offsetX = 0, offsetY = 0 } = annotationArea;
|
3015
3056
|
const dataset = advancedVSeed.dataset.flat();
|
3016
3057
|
const selectedData = selectorPoint ? dataset.filter((datum)=>selector_selector(datum, selectorPoint)) : [];
|
3017
3058
|
return {
|
@@ -3081,6 +3122,7 @@
|
|
3081
3122
|
visible: true,
|
3082
3123
|
text: text,
|
3083
3124
|
style: {
|
3125
|
+
dy: textFontSize,
|
3084
3126
|
textAlign: textAlign,
|
3085
3127
|
textBaseline: textBaseline,
|
3086
3128
|
fill: textColor,
|
@@ -3093,6 +3135,7 @@
|
|
3093
3135
|
visible: backgroundVisible,
|
3094
3136
|
padding: backgroundPadding,
|
3095
3137
|
style: {
|
3138
|
+
dy: textFontSize,
|
3096
3139
|
cornerRadius: backgroundBorderRadius ?? 4,
|
3097
3140
|
fill: backgroundColor,
|
3098
3141
|
stroke: backgroundBorderColor,
|
@@ -3625,6 +3668,7 @@
|
|
3625
3668
|
datasetReshapeInfo: [
|
3626
3669
|
{
|
3627
3670
|
id: '2D1M',
|
3671
|
+
index: 0,
|
3628
3672
|
foldInfo,
|
3629
3673
|
unfoldInfo
|
3630
3674
|
}
|
@@ -3649,7 +3693,7 @@
|
|
3649
3693
|
const commonDimensions = dimensions.filter((dim)=>'dimension' === dim.location);
|
3650
3694
|
const newDatasets = [];
|
3651
3695
|
const datasetReshapeInfo = [];
|
3652
|
-
measureGroups.forEach((measureGroup)=>{
|
3696
|
+
measureGroups.forEach((measureGroup, index)=>{
|
3653
3697
|
const measures = measureGroup.children;
|
3654
3698
|
if (!measures) return;
|
3655
3699
|
const groupId = measureGroup.id;
|
@@ -3661,6 +3705,7 @@
|
|
3661
3705
|
});
|
3662
3706
|
const reshapeInfo = {
|
3663
3707
|
id: groupId,
|
3708
|
+
index,
|
3664
3709
|
foldInfo,
|
3665
3710
|
unfoldInfo
|
3666
3711
|
};
|
@@ -3848,7 +3893,7 @@
|
|
3848
3893
|
right: 'insideRight'
|
3849
3894
|
};
|
3850
3895
|
const markArea = annotationAreaList.flatMap((annotationArea)=>{
|
3851
|
-
const { selector: selectorPoint, text = '', textPosition = 'top', textColor = '#ffffff', textFontSize = 12, textFontWeight = 400, textAlign = 'center', textBaseline = 'top',
|
3896
|
+
const { selector: selectorPoint, text = '', textPosition = 'top', textColor = '#ffffff', textFontSize = 12, textFontWeight = 400, textAlign = 'center', textBaseline = 'top', backgroundVisible = true, backgroundColor = '#191d24', backgroundBorderColor = '#191d24', backgroundBorderWidth = 1, backgroundBorderRadius = 4, backgroundPadding = 4, areaColor = '#888888', areaColorOpacity = 0.15, areaBorderColor = '#888888', areaBorderRadius = 4, areaBorderWidth = 1, outerPadding = 4, offsetX = 0, offsetY = 0 } = annotationArea;
|
3852
3897
|
const dataset = advancedVSeed.dataset.flat();
|
3853
3898
|
const selectedData = selectorPoint ? dataset.filter((datum)=>selector_selector(datum, selectorPoint)) : [];
|
3854
3899
|
return {
|
@@ -3922,6 +3967,7 @@
|
|
3922
3967
|
visible: true,
|
3923
3968
|
text: text,
|
3924
3969
|
style: {
|
3970
|
+
dy: textFontSize,
|
3925
3971
|
textAlign: textAlign,
|
3926
3972
|
textBaseline: textBaseline,
|
3927
3973
|
stroke: backgroundColor,
|
@@ -3934,6 +3980,7 @@
|
|
3934
3980
|
visible: backgroundVisible,
|
3935
3981
|
padding: backgroundPadding,
|
3936
3982
|
style: {
|
3983
|
+
dy: textFontSize,
|
3937
3984
|
cornerRadius: backgroundBorderRadius ?? 4,
|
3938
3985
|
fill: backgroundColor,
|
3939
3986
|
stroke: backgroundBorderColor,
|
@@ -5065,6 +5112,7 @@
|
|
5065
5112
|
datasetReshapeInfo: [
|
5066
5113
|
{
|
5067
5114
|
id: '1D2M',
|
5115
|
+
index: 0,
|
5068
5116
|
foldInfo,
|
5069
5117
|
unfoldInfo
|
5070
5118
|
}
|
@@ -5086,7 +5134,7 @@
|
|
5086
5134
|
});
|
5087
5135
|
const newDatasets = [];
|
5088
5136
|
const datasetReshapeInfo = [];
|
5089
|
-
measureGroups.forEach((measureGroup)=>{
|
5137
|
+
measureGroups.forEach((measureGroup, index)=>{
|
5090
5138
|
const measures = measureGroup.children;
|
5091
5139
|
if (!measures) return;
|
5092
5140
|
const commonDimensions = dimensions.filter((dim)=>'dimension' === dim.location);
|
@@ -5099,6 +5147,7 @@
|
|
5099
5147
|
});
|
5100
5148
|
const reshapeInfo = {
|
5101
5149
|
id: groupId,
|
5150
|
+
index,
|
5102
5151
|
foldInfo,
|
5103
5152
|
unfoldInfo
|
5104
5153
|
};
|
@@ -5111,7 +5160,7 @@
|
|
5111
5160
|
datasetReshapeInfo: datasetReshapeInfo
|
5112
5161
|
};
|
5113
5162
|
};
|
5114
|
-
const
|
5163
|
+
const encodingAreaRange = (advancedVSeed)=>{
|
5115
5164
|
const result = {
|
5116
5165
|
...advancedVSeed
|
5117
5166
|
};
|
@@ -5188,7 +5237,7 @@
|
|
5188
5237
|
], [
|
5189
5238
|
pivotReshapeTo1D
|
5190
5239
|
]),
|
5191
|
-
|
5240
|
+
encodingAreaRange,
|
5192
5241
|
sortXBandAxis,
|
5193
5242
|
areaConfig,
|
5194
5243
|
theme_theme,
|
@@ -5510,6 +5559,7 @@
|
|
5510
5559
|
datasetReshapeInfo: [
|
5511
5560
|
{
|
5512
5561
|
id: '1D2M',
|
5562
|
+
index: 0,
|
5513
5563
|
foldInfo,
|
5514
5564
|
unfoldInfo
|
5515
5565
|
}
|
@@ -5531,7 +5581,7 @@
|
|
5531
5581
|
});
|
5532
5582
|
const newDatasets = [];
|
5533
5583
|
const datasetReshapeInfo = [];
|
5534
|
-
measureGroups.forEach((measureGroup)=>{
|
5584
|
+
measureGroups.forEach((measureGroup, index)=>{
|
5535
5585
|
const measures = measureGroup.children;
|
5536
5586
|
if (!measures) return;
|
5537
5587
|
const commonDimensions = dimensions.filter((dim)=>'dimension' === dim.location);
|
@@ -5544,6 +5594,7 @@
|
|
5544
5594
|
});
|
5545
5595
|
const reshapeInfo = {
|
5546
5596
|
id: groupId,
|
5597
|
+
index,
|
5547
5598
|
foldInfo,
|
5548
5599
|
unfoldInfo
|
5549
5600
|
};
|
@@ -5585,128 +5636,1125 @@
|
|
5585
5636
|
group,
|
5586
5637
|
color
|
5587
5638
|
}
|
5588
|
-
];
|
5589
|
-
}, []);
|
5590
|
-
return {
|
5591
|
-
...result,
|
5592
|
-
encoding
|
5593
|
-
};
|
5594
|
-
};
|
5595
|
-
const scatterAdvancedPipeline = [
|
5596
|
-
initAdvancedVSeed_initAdvancedVSeed,
|
5597
|
-
autoMeasures_autoMeasures,
|
5598
|
-
autoDimensions_autoDimensions,
|
5599
|
-
pivotAdapter([
|
5600
|
-
reshapeTo1D2M
|
5601
|
-
], [
|
5602
|
-
pivotReshapeTo1D2M
|
5603
|
-
]),
|
5604
|
-
encodingYY,
|
5605
|
-
scatterConfig,
|
5606
|
-
theme_theme,
|
5607
|
-
markStyle_markStyle,
|
5608
|
-
annotation_annotation
|
5609
|
-
];
|
5610
|
-
const initScatter = (spec, context)=>{
|
5611
|
-
const result = {
|
5612
|
-
...spec
|
5613
|
-
};
|
5614
|
-
const { advancedVSeed } = context;
|
5615
|
-
const { encoding } = advancedVSeed;
|
5616
|
-
if (!encoding[0].y || !encoding[0].x || !encoding[0].group) return result;
|
5617
|
-
result.type = 'scatter';
|
5618
|
-
result.direction = 'vertical';
|
5619
|
-
result.xField = encoding[0].x[0];
|
5620
|
-
result.yField = encoding[0].y[0];
|
5621
|
-
result.seriesField = encoding[0].group[0];
|
5622
|
-
result.padding = 0;
|
5623
|
-
result.region = [
|
5624
|
-
{
|
5625
|
-
clip: true
|
5639
|
+
];
|
5640
|
+
}, []);
|
5641
|
+
return {
|
5642
|
+
...result,
|
5643
|
+
encoding
|
5644
|
+
};
|
5645
|
+
};
|
5646
|
+
const scatterAdvancedPipeline = [
|
5647
|
+
initAdvancedVSeed_initAdvancedVSeed,
|
5648
|
+
autoMeasures_autoMeasures,
|
5649
|
+
autoDimensions_autoDimensions,
|
5650
|
+
pivotAdapter([
|
5651
|
+
reshapeTo1D2M
|
5652
|
+
], [
|
5653
|
+
pivotReshapeTo1D2M
|
5654
|
+
]),
|
5655
|
+
encodingYY,
|
5656
|
+
scatterConfig,
|
5657
|
+
theme_theme,
|
5658
|
+
markStyle_markStyle,
|
5659
|
+
annotation_annotation
|
5660
|
+
];
|
5661
|
+
const initScatter = (spec, context)=>{
|
5662
|
+
const result = {
|
5663
|
+
...spec
|
5664
|
+
};
|
5665
|
+
const { advancedVSeed } = context;
|
5666
|
+
const { encoding } = advancedVSeed;
|
5667
|
+
if (!encoding[0].y || !encoding[0].x || !encoding[0].group) return result;
|
5668
|
+
result.type = 'scatter';
|
5669
|
+
result.direction = 'vertical';
|
5670
|
+
result.xField = encoding[0].x[0];
|
5671
|
+
result.yField = encoding[0].y[0];
|
5672
|
+
result.seriesField = encoding[0].group[0];
|
5673
|
+
result.padding = 0;
|
5674
|
+
result.region = [
|
5675
|
+
{
|
5676
|
+
clip: true
|
5677
|
+
}
|
5678
|
+
];
|
5679
|
+
result.animation = true;
|
5680
|
+
return result;
|
5681
|
+
};
|
5682
|
+
const horizontalCrosshairLine = (spec, context)=>{
|
5683
|
+
const result = {
|
5684
|
+
...spec
|
5685
|
+
};
|
5686
|
+
const { advancedVSeed, vseed } = context;
|
5687
|
+
const { chartType } = vseed;
|
5688
|
+
const config = advancedVSeed.config?.[chartType]?.crosshairLine;
|
5689
|
+
if (!config) return result;
|
5690
|
+
if (!result.crosshair) result.crosshair = {};
|
5691
|
+
const { visible = true, lineColor, labelColor, labelVisible, labelBackgroundColor } = config;
|
5692
|
+
const crosshair = result.crosshair;
|
5693
|
+
crosshair.yField = {
|
5694
|
+
visible,
|
5695
|
+
line: {
|
5696
|
+
type: 'line',
|
5697
|
+
style: {
|
5698
|
+
lineWidth: 1,
|
5699
|
+
opacity: 1,
|
5700
|
+
stroke: lineColor,
|
5701
|
+
lineDash: [
|
5702
|
+
4,
|
5703
|
+
2
|
5704
|
+
]
|
5705
|
+
}
|
5706
|
+
},
|
5707
|
+
label: {
|
5708
|
+
visible: labelVisible,
|
5709
|
+
labelBackground: {
|
5710
|
+
visible: labelVisible,
|
5711
|
+
style: {
|
5712
|
+
fill: labelBackgroundColor
|
5713
|
+
}
|
5714
|
+
},
|
5715
|
+
style: {
|
5716
|
+
fill: labelColor
|
5717
|
+
}
|
5718
|
+
}
|
5719
|
+
};
|
5720
|
+
return result;
|
5721
|
+
};
|
5722
|
+
const scatter = [
|
5723
|
+
initScatter,
|
5724
|
+
color_color,
|
5725
|
+
background_backgroundColor,
|
5726
|
+
datasetXY,
|
5727
|
+
progressive,
|
5728
|
+
xLinear,
|
5729
|
+
yLinear,
|
5730
|
+
label_label,
|
5731
|
+
tooltip_tooltip,
|
5732
|
+
verticalCrosshairLine,
|
5733
|
+
horizontalCrosshairLine,
|
5734
|
+
discreteLegend,
|
5735
|
+
pointStyle_pointStyle,
|
5736
|
+
pointStateHover,
|
5737
|
+
annotationPoint_annotationPoint,
|
5738
|
+
annotationVerticalLine_annotationVerticalLine,
|
5739
|
+
annotationHorizontalLine_annotationHorizontalLine,
|
5740
|
+
annotationArea_annotationArea
|
5741
|
+
];
|
5742
|
+
const pivotScatter = [
|
5743
|
+
initPivot,
|
5744
|
+
pivotGridStyle,
|
5745
|
+
pivotIndicators_pivotIndicatorsAsRow,
|
5746
|
+
datasetPivot,
|
5747
|
+
pivotIndicators_pivotIndicators([
|
5748
|
+
initScatter,
|
5749
|
+
color_color,
|
5750
|
+
background_backgroundColor,
|
5751
|
+
datasetXY,
|
5752
|
+
progressive,
|
5753
|
+
xLinear,
|
5754
|
+
yLinear,
|
5755
|
+
label_label,
|
5756
|
+
tooltip_tooltip,
|
5757
|
+
verticalCrosshairLine,
|
5758
|
+
horizontalCrosshairLine,
|
5759
|
+
pointStyle_pointStyle,
|
5760
|
+
pointStateHover,
|
5761
|
+
annotationPoint_annotationPoint,
|
5762
|
+
annotationVerticalLine_annotationVerticalLine,
|
5763
|
+
annotationHorizontalLine_annotationHorizontalLine,
|
5764
|
+
annotationArea_annotationArea
|
5765
|
+
]),
|
5766
|
+
pivotRowDimensions,
|
5767
|
+
pivotColumnDimensions,
|
5768
|
+
pivotDiscreteLegend
|
5769
|
+
];
|
5770
|
+
const scatterSpecPipeline = [
|
5771
|
+
pivotAdapter_pivotAdapter(scatter, pivotScatter)
|
5772
|
+
];
|
5773
|
+
const registerScatter = ()=>{
|
5774
|
+
Builder._advancedPipelineMap.scatter = scatterAdvancedPipeline;
|
5775
|
+
Builder._specPipelineMap.scatter = scatterSpecPipeline;
|
5776
|
+
};
|
5777
|
+
const reshapeTo2D2M = (advancedVSeed, context)=>{
|
5778
|
+
const result = {
|
5779
|
+
...advancedVSeed
|
5780
|
+
};
|
5781
|
+
const { vseed } = context;
|
5782
|
+
const { dataset } = vseed;
|
5783
|
+
const { dimensions, measures } = advancedVSeed;
|
5784
|
+
if (!measures || !dimensions || !dataset) return result;
|
5785
|
+
if (0 === measures.length) throw new Error('measures can not be empty');
|
5786
|
+
if (measures.length > 2) throw new Error('measures can not be more than 2');
|
5787
|
+
const commonDimensions = dimensions.filter((dim)=>'dimension' === dim.location);
|
5788
|
+
const datasets = [];
|
5789
|
+
const foldInfoList = [];
|
5790
|
+
const unfoldInfoList = [];
|
5791
|
+
const primaryMeasures = measures[0];
|
5792
|
+
const secondaryMeasures = measures[1] || [];
|
5793
|
+
if (primaryMeasures && primaryMeasures.children) {
|
5794
|
+
const { dataset: newDatasets, foldInfo, unfoldInfo } = dataReshapeFor2D1M(dataset, commonDimensions, primaryMeasures.children, {
|
5795
|
+
foldMeasureValue: FoldPrimaryMeasureValue
|
5796
|
+
});
|
5797
|
+
datasets.push(newDatasets);
|
5798
|
+
foldInfoList.push(foldInfo);
|
5799
|
+
unfoldInfoList.push(unfoldInfo);
|
5800
|
+
}
|
5801
|
+
if (secondaryMeasures && secondaryMeasures.children) {
|
5802
|
+
const { dataset: newDatasets, foldInfo, unfoldInfo } = dataReshapeFor2D1M(dataset, commonDimensions, secondaryMeasures.children, {
|
5803
|
+
foldMeasureValue: FoldSecondaryMeasureValue
|
5804
|
+
});
|
5805
|
+
datasets.push(newDatasets);
|
5806
|
+
foldInfoList.push(foldInfo);
|
5807
|
+
unfoldInfoList.push(unfoldInfo);
|
5808
|
+
}
|
5809
|
+
const unfoldInfo = {
|
5810
|
+
groupName: unfoldInfoList[0].groupName,
|
5811
|
+
groupId: unfoldInfoList[0].groupId,
|
5812
|
+
colorItems: unfoldInfoList.flatMap((d)=>d.colorItems),
|
5813
|
+
colorIdMap: unfoldInfoList.reduce((prev, cur)=>({
|
5814
|
+
...prev,
|
5815
|
+
...cur.colorIdMap
|
5816
|
+
}), {})
|
5817
|
+
};
|
5818
|
+
return {
|
5819
|
+
...result,
|
5820
|
+
dataset: datasets,
|
5821
|
+
datasetReshapeInfo: [
|
5822
|
+
{
|
5823
|
+
id: '2D2M',
|
5824
|
+
index: 0,
|
5825
|
+
foldInfo: foldInfoList[0],
|
5826
|
+
foldInfoList: foldInfoList,
|
5827
|
+
unfoldInfo: unfoldInfo
|
5828
|
+
}
|
5829
|
+
]
|
5830
|
+
};
|
5831
|
+
};
|
5832
|
+
const pivotReshapeTo2D2M = (advancedVSeed, context)=>{
|
5833
|
+
const result = {
|
5834
|
+
...advancedVSeed
|
5835
|
+
};
|
5836
|
+
const { vseed } = context;
|
5837
|
+
const { dataset } = vseed;
|
5838
|
+
const { dimensions, measures } = advancedVSeed;
|
5839
|
+
if (!measures || !dimensions || !dataset) return result;
|
5840
|
+
const commonDimensions = dimensions.filter((dim)=>'dimension' === dim.location);
|
5841
|
+
const datasetList = [];
|
5842
|
+
const datasetReshapeInfo = [];
|
5843
|
+
measures.forEach((measureGroup, index)=>{
|
5844
|
+
const measures = measureGroup.children || [];
|
5845
|
+
if (0 === measures.length) throw new Error('measures can not be empty');
|
5846
|
+
if (measures.length > 2) throw new Error('measures can not be more than 2');
|
5847
|
+
const datasets = [];
|
5848
|
+
const foldInfoList = [];
|
5849
|
+
const unfoldInfoList = [];
|
5850
|
+
const primaryMeasures = measures[0];
|
5851
|
+
const secondaryMeasures = measures[1] || measures[0];
|
5852
|
+
if (primaryMeasures && primaryMeasures.children) {
|
5853
|
+
const { dataset: newDatasets, foldInfo, unfoldInfo } = dataReshapeFor2D1M(dataset, commonDimensions, primaryMeasures.children, {
|
5854
|
+
foldMeasureValue: `${FoldPrimaryMeasureValue}${index}`
|
5855
|
+
});
|
5856
|
+
datasets.push(newDatasets);
|
5857
|
+
foldInfoList.push(foldInfo);
|
5858
|
+
unfoldInfoList.push(unfoldInfo);
|
5859
|
+
}
|
5860
|
+
if (secondaryMeasures && secondaryMeasures.children) {
|
5861
|
+
const { dataset: newDatasets, foldInfo, unfoldInfo } = dataReshapeFor2D1M(dataset, commonDimensions, secondaryMeasures.children, {
|
5862
|
+
foldMeasureValue: `${FoldSecondaryMeasureValue}${index}`
|
5863
|
+
});
|
5864
|
+
datasets.push(newDatasets);
|
5865
|
+
foldInfoList.push(foldInfo);
|
5866
|
+
unfoldInfoList.push(unfoldInfo);
|
5867
|
+
}
|
5868
|
+
datasetList.push(datasets.flat(2));
|
5869
|
+
const unfoldInfo = {
|
5870
|
+
groupName: unfoldInfoList[0].groupName,
|
5871
|
+
groupId: unfoldInfoList[0].groupId,
|
5872
|
+
colorItems: unfoldInfoList.flatMap((d)=>d.colorItems),
|
5873
|
+
colorIdMap: unfoldInfoList.reduce((prev, cur)=>({
|
5874
|
+
...prev,
|
5875
|
+
...cur.colorIdMap
|
5876
|
+
}), {})
|
5877
|
+
};
|
5878
|
+
const reshapeInfo = {
|
5879
|
+
id: `2D2M-${index}`,
|
5880
|
+
index,
|
5881
|
+
foldInfo: foldInfoList[0],
|
5882
|
+
unfoldInfo: unfoldInfo,
|
5883
|
+
foldInfoList: foldInfoList
|
5884
|
+
};
|
5885
|
+
datasetReshapeInfo.push(reshapeInfo);
|
5886
|
+
});
|
5887
|
+
return {
|
5888
|
+
...result,
|
5889
|
+
dataset: datasetList,
|
5890
|
+
datasetReshapeInfo
|
5891
|
+
};
|
5892
|
+
};
|
5893
|
+
const encodingXYY = (advancedVSeed)=>{
|
5894
|
+
const result = {
|
5895
|
+
...advancedVSeed
|
5896
|
+
};
|
5897
|
+
const { datasetReshapeInfo, dimensions } = advancedVSeed;
|
5898
|
+
if (!datasetReshapeInfo || !dimensions) return result;
|
5899
|
+
const xDimension = dimensions.find((item)=>'rowDimension' !== item.location && 'columnDimension' !== item.location) || dimensions[0];
|
5900
|
+
const isZeroDimension = 0 === dimensions.length;
|
5901
|
+
const encoding = datasetReshapeInfo.reduce((prev, cur)=>{
|
5902
|
+
const { foldInfoList, unfoldInfo } = cur;
|
5903
|
+
const x = [
|
5904
|
+
isZeroDimension ? foldInfoList[0].measureName : xDimension?.id
|
5905
|
+
];
|
5906
|
+
const y = foldInfoList.map((d)=>d.measureValue);
|
5907
|
+
const group = [
|
5908
|
+
unfoldInfo.groupId
|
5909
|
+
];
|
5910
|
+
const color = [
|
5911
|
+
foldInfoList[0].measureName
|
5912
|
+
];
|
5913
|
+
return [
|
5914
|
+
...prev,
|
5915
|
+
{
|
5916
|
+
x,
|
5917
|
+
y,
|
5918
|
+
group,
|
5919
|
+
color
|
5920
|
+
}
|
5921
|
+
];
|
5922
|
+
}, []);
|
5923
|
+
return {
|
5924
|
+
...result,
|
5925
|
+
encoding
|
5926
|
+
};
|
5927
|
+
};
|
5928
|
+
const dualAxisConfig = (advancedVSeed, context)=>{
|
5929
|
+
const { vseed } = context;
|
5930
|
+
const { chartType } = vseed;
|
5931
|
+
const result = {
|
5932
|
+
...advancedVSeed
|
5933
|
+
};
|
5934
|
+
const config = chunk_2T7K3PFL_i(vseed, [
|
5935
|
+
'backgroundColor',
|
5936
|
+
'color',
|
5937
|
+
'label',
|
5938
|
+
'legend',
|
5939
|
+
'tooltip',
|
5940
|
+
'dualChartType',
|
5941
|
+
'primaryYAxis',
|
5942
|
+
'secondaryYAxis',
|
5943
|
+
'crosshairLine'
|
5944
|
+
]);
|
5945
|
+
result.config = {
|
5946
|
+
...result.config || {},
|
5947
|
+
[chartType]: {
|
5948
|
+
...config
|
5949
|
+
}
|
5950
|
+
};
|
5951
|
+
return result;
|
5952
|
+
};
|
5953
|
+
const autoDualMeasures = (advancedVSeed, context)=>{
|
5954
|
+
const result = {
|
5955
|
+
...advancedVSeed
|
5956
|
+
};
|
5957
|
+
const { vseed } = context;
|
5958
|
+
const { dataset, dualMeasures, measures } = vseed;
|
5959
|
+
if (!dataset) throw new Error('dataset is required');
|
5960
|
+
if (0 === dataset.length) return result;
|
5961
|
+
if (dualMeasures) {
|
5962
|
+
result.measures = dualMeasuresToMeasureTree(dualMeasures);
|
5963
|
+
return result;
|
5964
|
+
}
|
5965
|
+
if (measures && measureDepth(measures) > 1) {
|
5966
|
+
result.measures = measures;
|
5967
|
+
return result;
|
5968
|
+
}
|
5969
|
+
const top100dataset = dataset.slice(0, 100);
|
5970
|
+
const sample = top100dataset.reduce((prev, cur)=>({
|
5971
|
+
...prev,
|
5972
|
+
...cur
|
5973
|
+
}), {});
|
5974
|
+
const newMeasures = measures || Object.keys(sample).filter((key)=>top100dataset.some((item)=>'number' == typeof item[key]) && ![
|
5975
|
+
'',
|
5976
|
+
null,
|
5977
|
+
void 0
|
5978
|
+
].includes(key)).map((measure)=>({
|
5979
|
+
id: measure,
|
5980
|
+
alias: measure
|
5981
|
+
}));
|
5982
|
+
if (0 === newMeasures.length) result.measures = [];
|
5983
|
+
else if (1 === newMeasures.length) result.measures = [
|
5984
|
+
{
|
5985
|
+
id: 'primary',
|
5986
|
+
alias: 'primary',
|
5987
|
+
children: newMeasures
|
5988
|
+
}
|
5989
|
+
];
|
5990
|
+
else if (newMeasures.length > 1) result.measures = [
|
5991
|
+
{
|
5992
|
+
id: 'primary',
|
5993
|
+
alias: 'primary',
|
5994
|
+
children: newMeasures.slice(0, 1)
|
5995
|
+
},
|
5996
|
+
{
|
5997
|
+
id: 'secondary',
|
5998
|
+
alias: 'secondary',
|
5999
|
+
children: newMeasures.slice(1)
|
6000
|
+
}
|
6001
|
+
];
|
6002
|
+
return result;
|
6003
|
+
};
|
6004
|
+
const dualMeasuresToMeasureTree = (dualMeasures)=>{
|
6005
|
+
const measureTree = dualMeasures.map((item, index)=>{
|
6006
|
+
const { primaryMeasures, secondaryMeasures, primaryAlias, secondaryAlias } = item;
|
6007
|
+
const groupChildren = [];
|
6008
|
+
if (primaryMeasures) {
|
6009
|
+
const arrPrimaryMeasures = Array.isArray(primaryMeasures) ? primaryMeasures : [
|
6010
|
+
primaryMeasures
|
6011
|
+
];
|
6012
|
+
groupChildren.push({
|
6013
|
+
id: `${index}-primary`,
|
6014
|
+
alias: primaryAlias || arrPrimaryMeasures.map((item)=>item.alias || item.id).toString(),
|
6015
|
+
children: arrPrimaryMeasures
|
6016
|
+
});
|
6017
|
+
}
|
6018
|
+
if (secondaryMeasures) {
|
6019
|
+
const arrSecondaryMeasures = Array.isArray(secondaryMeasures) ? secondaryMeasures : [
|
6020
|
+
secondaryMeasures
|
6021
|
+
];
|
6022
|
+
groupChildren.push({
|
6023
|
+
id: `${index}-secondary`,
|
6024
|
+
alias: secondaryAlias || arrSecondaryMeasures.map((item)=>item.alias || item.id).toString(),
|
6025
|
+
children: arrSecondaryMeasures
|
6026
|
+
});
|
6027
|
+
}
|
6028
|
+
const id = [
|
6029
|
+
primaryAlias,
|
6030
|
+
secondaryAlias,
|
6031
|
+
index
|
6032
|
+
].filter((d)=>!chunk_JK3VNB42_n(d)).join('-');
|
6033
|
+
return {
|
6034
|
+
id,
|
6035
|
+
alias: id,
|
6036
|
+
children: groupChildren
|
6037
|
+
};
|
6038
|
+
});
|
6039
|
+
if (1 === dualMeasures.length) return measureTree[0].children || [];
|
6040
|
+
return measureTree;
|
6041
|
+
};
|
6042
|
+
const dualAxisAdvancedPipeline = [
|
6043
|
+
initAdvancedVSeed_initAdvancedVSeed,
|
6044
|
+
autoDualMeasures,
|
6045
|
+
autoDimensions_autoDimensions,
|
6046
|
+
pivotAdapter([
|
6047
|
+
reshapeTo2D2M
|
6048
|
+
], [
|
6049
|
+
pivotReshapeTo2D2M
|
6050
|
+
]),
|
6051
|
+
encodingXYY,
|
6052
|
+
sortXBandAxis,
|
6053
|
+
sort_sortLegend,
|
6054
|
+
dualAxisConfig,
|
6055
|
+
theme_theme,
|
6056
|
+
markStyle_markStyle,
|
6057
|
+
annotation_annotation
|
6058
|
+
];
|
6059
|
+
const initDualAxisPrimary = (spec, context)=>{
|
6060
|
+
const result = {
|
6061
|
+
...spec
|
6062
|
+
};
|
6063
|
+
const { advancedVSeed } = context;
|
6064
|
+
const { encoding, datasetReshapeInfo } = advancedVSeed;
|
6065
|
+
if (!encoding[0].y || !encoding[0].x || !encoding[0].group) return result;
|
6066
|
+
result.id = `${datasetReshapeInfo[0].id}-primary-series`;
|
6067
|
+
result.type = 'bar';
|
6068
|
+
result.direction = 'vertical';
|
6069
|
+
result.xField = encoding[0].x[0];
|
6070
|
+
result.yField = encoding[0].y[0];
|
6071
|
+
result.seriesField = encoding[0].group[0];
|
6072
|
+
result.animation = true;
|
6073
|
+
return result;
|
6074
|
+
};
|
6075
|
+
const initDualAxisSecondary = (spec, context)=>{
|
6076
|
+
const result = {
|
6077
|
+
...spec
|
6078
|
+
};
|
6079
|
+
const { advancedVSeed } = context;
|
6080
|
+
const { encoding, datasetReshapeInfo } = advancedVSeed;
|
6081
|
+
if (!encoding[0].y || !encoding[0].x || !encoding[0].group) return result;
|
6082
|
+
result.id = `${datasetReshapeInfo[0].id}-secondary-series`;
|
6083
|
+
result.type = 'line';
|
6084
|
+
result.direction = 'vertical';
|
6085
|
+
result.xField = encoding[0].x[0];
|
6086
|
+
result.yField = encoding[0].y[1];
|
6087
|
+
result.seriesField = encoding[0].group[0];
|
6088
|
+
result.animation = true;
|
6089
|
+
return result;
|
6090
|
+
};
|
6091
|
+
const dualChartTypePrimary = (spec, context)=>{
|
6092
|
+
const result = {
|
6093
|
+
...spec
|
6094
|
+
};
|
6095
|
+
const { advancedVSeed, vseed } = context;
|
6096
|
+
const { chartType } = vseed;
|
6097
|
+
const { datasetReshapeInfo } = advancedVSeed;
|
6098
|
+
const config = advancedVSeed.config?.[chartType]?.dualChartType || {
|
6099
|
+
primary: 'column',
|
6100
|
+
secondary: 'line'
|
6101
|
+
};
|
6102
|
+
if (Array.isArray(config)) return result;
|
6103
|
+
switch(config.primary){
|
6104
|
+
case 'line':
|
6105
|
+
result.type = 'line';
|
6106
|
+
break;
|
6107
|
+
case 'column':
|
6108
|
+
result.type = 'bar';
|
6109
|
+
break;
|
6110
|
+
case 'columnParallel':
|
6111
|
+
{
|
6112
|
+
const columnSpec = result;
|
6113
|
+
if (Array.isArray(columnSpec.xField)) columnSpec.xField.push(datasetReshapeInfo[0].unfoldInfo.groupId);
|
6114
|
+
else if (columnSpec.xField) columnSpec.xField = [
|
6115
|
+
columnSpec.xField,
|
6116
|
+
datasetReshapeInfo[0].unfoldInfo.groupId
|
6117
|
+
];
|
6118
|
+
columnSpec.type = 'bar';
|
6119
|
+
break;
|
6120
|
+
}
|
6121
|
+
case 'columnPercent':
|
6122
|
+
result.type = 'bar';
|
6123
|
+
result.percent = true;
|
6124
|
+
break;
|
6125
|
+
case 'area':
|
6126
|
+
result.type = 'area';
|
6127
|
+
break;
|
6128
|
+
case 'areaPercent':
|
6129
|
+
result.type = 'area';
|
6130
|
+
result.percent = true;
|
6131
|
+
break;
|
6132
|
+
case 'scatter':
|
6133
|
+
result.type = 'scatter';
|
6134
|
+
break;
|
6135
|
+
default:
|
6136
|
+
result.type = config.primary;
|
6137
|
+
}
|
6138
|
+
return result;
|
6139
|
+
};
|
6140
|
+
const dualChartTypeSecondary = (spec, context)=>{
|
6141
|
+
const result = {
|
6142
|
+
...spec
|
6143
|
+
};
|
6144
|
+
const { advancedVSeed, vseed } = context;
|
6145
|
+
const { chartType } = vseed;
|
6146
|
+
const { datasetReshapeInfo } = advancedVSeed;
|
6147
|
+
const config = advancedVSeed.config?.[chartType]?.dualChartType || {
|
6148
|
+
primary: 'column',
|
6149
|
+
secondary: 'line'
|
6150
|
+
};
|
6151
|
+
if (Array.isArray(config)) return result;
|
6152
|
+
switch(config.secondary){
|
6153
|
+
case 'line':
|
6154
|
+
result.type = 'line';
|
6155
|
+
break;
|
6156
|
+
case 'column':
|
6157
|
+
result.type = 'bar';
|
6158
|
+
break;
|
6159
|
+
case 'columnParallel':
|
6160
|
+
{
|
6161
|
+
const columnSpec = result;
|
6162
|
+
if (Array.isArray(columnSpec.xField)) columnSpec.xField.push(datasetReshapeInfo[0].unfoldInfo.groupId);
|
6163
|
+
else if (columnSpec.xField) columnSpec.xField = [
|
6164
|
+
columnSpec.xField,
|
6165
|
+
datasetReshapeInfo[0].unfoldInfo.groupId
|
6166
|
+
];
|
6167
|
+
columnSpec.type = 'bar';
|
6168
|
+
break;
|
6169
|
+
}
|
6170
|
+
case 'columnPercent':
|
6171
|
+
result.type = 'bar';
|
6172
|
+
result.percent = true;
|
6173
|
+
break;
|
6174
|
+
case 'area':
|
6175
|
+
result.type = 'area';
|
6176
|
+
break;
|
6177
|
+
case 'areaPercent':
|
6178
|
+
result.type = 'area';
|
6179
|
+
result.percent = true;
|
6180
|
+
break;
|
6181
|
+
case 'scatter':
|
6182
|
+
result.type = 'scatter';
|
6183
|
+
break;
|
6184
|
+
default:
|
6185
|
+
result.type = config.secondary;
|
6186
|
+
}
|
6187
|
+
return result;
|
6188
|
+
};
|
6189
|
+
const datasetPrimary = (spec, context)=>{
|
6190
|
+
const { advancedVSeed, vseed } = context;
|
6191
|
+
const { encoding, analysis, datasetReshapeInfo } = advancedVSeed;
|
6192
|
+
const { orderMapping = {} } = analysis ?? {};
|
6193
|
+
const x = encoding[0]?.x?.[0];
|
6194
|
+
const group = encoding[0]?.group?.[0];
|
6195
|
+
const id = datasetReshapeInfo[0].id;
|
6196
|
+
const fields = {};
|
6197
|
+
if (x) {
|
6198
|
+
const order = orderMapping[x];
|
6199
|
+
if (order) fields[x] = {
|
6200
|
+
sortIndex: 0,
|
6201
|
+
domain: order,
|
6202
|
+
lockStatisticsByDomain: true
|
6203
|
+
};
|
6204
|
+
else fields[x] = {
|
6205
|
+
sortIndex: 0
|
6206
|
+
};
|
6207
|
+
}
|
6208
|
+
if (group) {
|
6209
|
+
const order = orderMapping[group];
|
6210
|
+
if (order) fields[group] = {
|
6211
|
+
sortIndex: 0,
|
6212
|
+
domain: order,
|
6213
|
+
lockStatisticsByDomain: true
|
6214
|
+
};
|
6215
|
+
else fields[group] = {
|
6216
|
+
sortIndex: 0
|
6217
|
+
};
|
6218
|
+
}
|
6219
|
+
return {
|
6220
|
+
...spec,
|
6221
|
+
data: {
|
6222
|
+
id: `${id}-primary-dataset`,
|
6223
|
+
values: isPivotChart(vseed) ? void 0 : advancedVSeed.dataset[0],
|
6224
|
+
fields: fields
|
6225
|
+
}
|
6226
|
+
};
|
6227
|
+
};
|
6228
|
+
const datasetSecondary = (spec, context)=>{
|
6229
|
+
const { advancedVSeed, vseed } = context;
|
6230
|
+
const { encoding, analysis, datasetReshapeInfo } = advancedVSeed;
|
6231
|
+
const { orderMapping = {} } = analysis ?? {};
|
6232
|
+
const x = encoding[0]?.x?.[0];
|
6233
|
+
const group = encoding[0]?.group?.[0];
|
6234
|
+
const id = datasetReshapeInfo[0].id;
|
6235
|
+
const fields = {};
|
6236
|
+
if (x) {
|
6237
|
+
const order = orderMapping[x];
|
6238
|
+
if (order) fields[x] = {
|
6239
|
+
sortIndex: 0,
|
6240
|
+
domain: order,
|
6241
|
+
lockStatisticsByDomain: true
|
6242
|
+
};
|
6243
|
+
else fields[x] = {
|
6244
|
+
sortIndex: 0
|
6245
|
+
};
|
6246
|
+
}
|
6247
|
+
if (group) {
|
6248
|
+
const order = orderMapping[group];
|
6249
|
+
if (order) fields[group] = {
|
6250
|
+
sortIndex: 0,
|
6251
|
+
domain: order,
|
6252
|
+
lockStatisticsByDomain: true
|
6253
|
+
};
|
6254
|
+
else fields[group] = {
|
6255
|
+
sortIndex: 0
|
6256
|
+
};
|
6257
|
+
}
|
6258
|
+
return {
|
6259
|
+
...spec,
|
6260
|
+
data: {
|
6261
|
+
id: `${id}-secondary-dataset`,
|
6262
|
+
values: isPivotChart(vseed) ? void 0 : advancedVSeed.dataset[1],
|
6263
|
+
fields: fields
|
6264
|
+
}
|
6265
|
+
};
|
6266
|
+
};
|
6267
|
+
const labelPrimary = (spec, context)=>{
|
6268
|
+
const result = {
|
6269
|
+
...spec
|
6270
|
+
};
|
6271
|
+
const { advancedVSeed } = context;
|
6272
|
+
const { measures, datasetReshapeInfo, locale } = advancedVSeed;
|
6273
|
+
const { chartType } = advancedVSeed;
|
6274
|
+
const baseConfig = advancedVSeed.config[chartType];
|
6275
|
+
if (!baseConfig || !baseConfig.label) return result;
|
6276
|
+
const foldInfoList = datasetReshapeInfo[0].foldInfoList;
|
6277
|
+
const { measureId, measureValue } = foldInfoList[0];
|
6278
|
+
const { label } = baseConfig;
|
6279
|
+
const { enable } = label;
|
6280
|
+
result.label = {
|
6281
|
+
visible: enable,
|
6282
|
+
formatMethod: (value, datum)=>{
|
6283
|
+
const result = [];
|
6284
|
+
const formatValue = (value)=>{
|
6285
|
+
const id = datum[measureId];
|
6286
|
+
const measure = findMeasureById(measures, id);
|
6287
|
+
if (!measure) return value;
|
6288
|
+
const { format = {}, autoFormat = true } = measure;
|
6289
|
+
if (!chunk_VCYTMP4D_n(format)) {
|
6290
|
+
const formatter = createFormatter(format);
|
6291
|
+
return formatter(value);
|
6292
|
+
}
|
6293
|
+
if (autoFormat) return autoFormatter(value, locale);
|
6294
|
+
return String(value);
|
6295
|
+
};
|
6296
|
+
result.push(formatValue(datum[measureValue]));
|
6297
|
+
return result.join(' ');
|
6298
|
+
}
|
6299
|
+
};
|
6300
|
+
return result;
|
6301
|
+
};
|
6302
|
+
const labelSecondary = (spec, context)=>{
|
6303
|
+
const result = {
|
6304
|
+
...spec
|
6305
|
+
};
|
6306
|
+
const { advancedVSeed } = context;
|
6307
|
+
const { measures, datasetReshapeInfo, locale } = advancedVSeed;
|
6308
|
+
const { chartType } = advancedVSeed;
|
6309
|
+
const baseConfig = advancedVSeed.config[chartType];
|
6310
|
+
if (!baseConfig || !baseConfig.label) return result;
|
6311
|
+
if (chunk_JK3VNB42_n(datasetReshapeInfo[0].foldInfoList?.[1])) return result;
|
6312
|
+
const foldInfoList = datasetReshapeInfo[0].foldInfoList;
|
6313
|
+
const { measureId, measureValue } = foldInfoList[1];
|
6314
|
+
const { label } = baseConfig;
|
6315
|
+
const { enable } = label;
|
6316
|
+
result.label = {
|
6317
|
+
visible: enable,
|
6318
|
+
formatMethod: (value, datum)=>{
|
6319
|
+
const result = [];
|
6320
|
+
const formatValue = (value)=>{
|
6321
|
+
const id = datum[measureId];
|
6322
|
+
const measure = findMeasureById(measures, id);
|
6323
|
+
if (!measure) return value;
|
6324
|
+
const { format = {}, autoFormat = true } = measure;
|
6325
|
+
if (!chunk_VCYTMP4D_n(format)) {
|
6326
|
+
const formatter = createFormatter(format);
|
6327
|
+
return formatter(value);
|
6328
|
+
}
|
6329
|
+
if (autoFormat) return autoFormatter(value, locale);
|
6330
|
+
return String(value);
|
6331
|
+
};
|
6332
|
+
result.push(formatValue(datum[measureValue]));
|
6333
|
+
return result.join(' ');
|
6334
|
+
}
|
6335
|
+
};
|
6336
|
+
return result;
|
6337
|
+
};
|
6338
|
+
const tooltipPrimary = (spec, context)=>{
|
6339
|
+
const result = {
|
6340
|
+
...spec
|
6341
|
+
};
|
6342
|
+
const { advancedVSeed } = context;
|
6343
|
+
const { measures, datasetReshapeInfo, chartType, locale, dimensions } = advancedVSeed;
|
6344
|
+
const baseConfig = advancedVSeed.config[chartType];
|
6345
|
+
const { tooltip = {
|
6346
|
+
enable: true
|
6347
|
+
} } = baseConfig;
|
6348
|
+
const { enable } = tooltip;
|
6349
|
+
const foldInfoList = datasetReshapeInfo[0].foldInfoList;
|
6350
|
+
const unfoldInfo = datasetReshapeInfo[0].unfoldInfo;
|
6351
|
+
const { measureId, measureValue, measureName } = foldInfoList[0];
|
6352
|
+
const { groupName } = unfoldInfo;
|
6353
|
+
result.tooltip = {
|
6354
|
+
visible: enable,
|
6355
|
+
mark: {
|
6356
|
+
title: {
|
6357
|
+
visible: true
|
6358
|
+
},
|
6359
|
+
content: [
|
6360
|
+
...dimensions.map((item)=>({
|
6361
|
+
visible: true,
|
6362
|
+
hasShape: true,
|
6363
|
+
shapeType: 'rectRound',
|
6364
|
+
key: (datum)=>{
|
6365
|
+
if (item.alias || item.id) return item.alias || item.id;
|
6366
|
+
return datum && datum[item.id];
|
6367
|
+
},
|
6368
|
+
value: (datum)=>datum && datum[item.id]
|
6369
|
+
})),
|
6370
|
+
{
|
6371
|
+
visible: true,
|
6372
|
+
hasShape: true,
|
6373
|
+
key: (datum)=>datum && datum[measureName || groupName] || '',
|
6374
|
+
value: (datum)=>{
|
6375
|
+
if (!datum) return '';
|
6376
|
+
const value = datum[measureValue];
|
6377
|
+
const id = datum[measureId];
|
6378
|
+
const measure = findMeasureById(measures, id);
|
6379
|
+
if (!measure) return String(value);
|
6380
|
+
const { format = {}, autoFormat = true } = measure;
|
6381
|
+
if (!chunk_VCYTMP4D_n(format)) {
|
6382
|
+
const formatter = createFormatter(format);
|
6383
|
+
return formatter(value);
|
6384
|
+
}
|
6385
|
+
if (autoFormat) return autoFormatter(value, locale);
|
6386
|
+
return String(value);
|
6387
|
+
}
|
6388
|
+
}
|
6389
|
+
]
|
6390
|
+
},
|
6391
|
+
dimension: {
|
6392
|
+
content: [
|
6393
|
+
{
|
6394
|
+
visible: true,
|
6395
|
+
key: (datum)=>datum && datum[groupName] || '',
|
6396
|
+
value: (datum)=>{
|
6397
|
+
if (!datum) return '';
|
6398
|
+
const value = datum[measureValue];
|
6399
|
+
const id = datum[measureId];
|
6400
|
+
const measure = findMeasureById(measures, id);
|
6401
|
+
if (!measure) return String(value);
|
6402
|
+
const { format = {}, autoFormat = true } = measure;
|
6403
|
+
if (!chunk_VCYTMP4D_n(format)) {
|
6404
|
+
const formatter = createFormatter(format);
|
6405
|
+
return formatter(value);
|
6406
|
+
}
|
6407
|
+
if (autoFormat) return autoFormatter(value, locale);
|
6408
|
+
return String(value);
|
6409
|
+
},
|
6410
|
+
shapeType: 'rectRound'
|
6411
|
+
}
|
6412
|
+
]
|
6413
|
+
}
|
6414
|
+
};
|
6415
|
+
return result;
|
6416
|
+
};
|
6417
|
+
const tooltipSecondary = (spec, context)=>{
|
6418
|
+
const result = {
|
6419
|
+
...spec
|
6420
|
+
};
|
6421
|
+
const { advancedVSeed } = context;
|
6422
|
+
const { measures, datasetReshapeInfo, chartType, locale, dimensions } = advancedVSeed;
|
6423
|
+
const baseConfig = advancedVSeed.config[chartType];
|
6424
|
+
const { tooltip = {
|
6425
|
+
enable: true
|
6426
|
+
} } = baseConfig;
|
6427
|
+
const { enable } = tooltip;
|
6428
|
+
if (chunk_JK3VNB42_n(datasetReshapeInfo[0].foldInfoList?.[1])) return result;
|
6429
|
+
const foldInfoList = datasetReshapeInfo[0].foldInfoList;
|
6430
|
+
const unfoldInfo = datasetReshapeInfo[0].unfoldInfo;
|
6431
|
+
const { measureId, measureValue, measureName } = foldInfoList[1];
|
6432
|
+
const { groupName } = unfoldInfo;
|
6433
|
+
result.tooltip = {
|
6434
|
+
visible: enable,
|
6435
|
+
mark: {
|
6436
|
+
title: {
|
6437
|
+
visible: true
|
6438
|
+
},
|
6439
|
+
content: [
|
6440
|
+
...dimensions.map((item)=>({
|
6441
|
+
visible: true,
|
6442
|
+
hasShape: true,
|
6443
|
+
shapeType: 'rectRound',
|
6444
|
+
key: (datum)=>{
|
6445
|
+
if (item.alias || item.id) return item.alias || item.id;
|
6446
|
+
return datum && datum[item.id];
|
6447
|
+
},
|
6448
|
+
value: (datum)=>datum && datum[item.id]
|
6449
|
+
})),
|
6450
|
+
{
|
6451
|
+
visible: true,
|
6452
|
+
hasShape: true,
|
6453
|
+
key: (datum)=>datum && datum[measureName || groupName] || '',
|
6454
|
+
value: (datum)=>{
|
6455
|
+
if (!datum) return '';
|
6456
|
+
const value = datum[measureValue];
|
6457
|
+
const id = datum[measureId];
|
6458
|
+
const measure = findMeasureById(measures, id);
|
6459
|
+
if (!measure) return String(value);
|
6460
|
+
const { format = {}, autoFormat = true } = measure;
|
6461
|
+
if (!chunk_VCYTMP4D_n(format)) {
|
6462
|
+
const formatter = createFormatter(format);
|
6463
|
+
return formatter(value);
|
6464
|
+
}
|
6465
|
+
if (autoFormat) return autoFormatter(value, locale);
|
6466
|
+
return String(value);
|
6467
|
+
}
|
6468
|
+
}
|
6469
|
+
]
|
6470
|
+
},
|
6471
|
+
dimension: {
|
6472
|
+
content: [
|
6473
|
+
{
|
6474
|
+
visible: true,
|
6475
|
+
key: (datum)=>datum && datum[groupName] || '',
|
6476
|
+
value: (datum)=>{
|
6477
|
+
if (!datum) return '';
|
6478
|
+
const value = datum[measureValue];
|
6479
|
+
const id = datum[measureId];
|
6480
|
+
const measure = findMeasureById(measures, id);
|
6481
|
+
if (!measure) return String(value);
|
6482
|
+
const { format = {}, autoFormat = true } = measure;
|
6483
|
+
if (!chunk_VCYTMP4D_n(format)) {
|
6484
|
+
const formatter = createFormatter(format);
|
6485
|
+
return formatter(value);
|
6486
|
+
}
|
6487
|
+
if (autoFormat) return autoFormatter(value, locale);
|
6488
|
+
return String(value);
|
6489
|
+
},
|
6490
|
+
shapeType: 'rectRound'
|
6491
|
+
}
|
6492
|
+
]
|
6493
|
+
}
|
6494
|
+
};
|
6495
|
+
return result;
|
6496
|
+
};
|
6497
|
+
const yLinearPrimary = (spec, context)=>{
|
6498
|
+
const result = {
|
6499
|
+
...spec
|
6500
|
+
};
|
6501
|
+
const { advancedVSeed, vseed } = context;
|
6502
|
+
const { chartType } = vseed;
|
6503
|
+
const { locale, datasetReshapeInfo } = advancedVSeed;
|
6504
|
+
const config = advancedVSeed.config?.[chartType]?.primaryYAxis;
|
6505
|
+
if (datasetReshapeInfo[0].foldInfoList?.[0] && chunk_VCYTMP4D_n(datasetReshapeInfo[0].foldInfoList[0].foldMap)) return result;
|
6506
|
+
const id = `${datasetReshapeInfo[0].id}-primary-axis`;
|
6507
|
+
const seriesId = `${datasetReshapeInfo[0].id}-primary-series`;
|
6508
|
+
if (!result.axes) result.axes = [];
|
6509
|
+
if (!config) {
|
6510
|
+
result.axes = [
|
6511
|
+
...result.axes,
|
6512
|
+
{
|
6513
|
+
visible: true,
|
6514
|
+
id,
|
6515
|
+
seriesId,
|
6516
|
+
type: 'linear',
|
6517
|
+
orient: 'left',
|
6518
|
+
sync: {
|
6519
|
+
axisId: `${datasetReshapeInfo[0].id}-secondary-axis`,
|
6520
|
+
tickAlign: false,
|
6521
|
+
zeroAlign: true
|
6522
|
+
}
|
6523
|
+
}
|
6524
|
+
];
|
6525
|
+
return result;
|
6526
|
+
}
|
6527
|
+
const { visible = true, label, tick, title, grid, line, zero, nice, inverse, max, min, log, logBase = 10 } = config;
|
6528
|
+
const linearAxis = {
|
6529
|
+
visible,
|
6530
|
+
id,
|
6531
|
+
seriesId,
|
6532
|
+
sync: {
|
6533
|
+
axisId: `${datasetReshapeInfo[0].id}-secondary-axis`,
|
6534
|
+
tickAlign: false,
|
6535
|
+
zeroAlign: true
|
6536
|
+
},
|
6537
|
+
type: log ? 'log' : 'linear',
|
6538
|
+
base: logBase,
|
6539
|
+
orient: 'left',
|
6540
|
+
nice,
|
6541
|
+
zero: log ? false : zero,
|
6542
|
+
inverse,
|
6543
|
+
max,
|
6544
|
+
min,
|
6545
|
+
label: {
|
6546
|
+
visible: label?.visible,
|
6547
|
+
formatMethod: (value)=>autoFormatter(value, locale),
|
6548
|
+
style: {
|
6549
|
+
fill: label?.labelColor,
|
6550
|
+
angle: label?.labelAngle,
|
6551
|
+
fontSize: label?.labelFontSize,
|
6552
|
+
fontWeight: label?.labelFontWeight
|
6553
|
+
}
|
6554
|
+
},
|
6555
|
+
title: {
|
6556
|
+
visible: title?.visible,
|
6557
|
+
text: title?.titleText,
|
6558
|
+
style: {
|
6559
|
+
fill: title?.titleColor,
|
6560
|
+
fontSize: title?.titleFontSize,
|
6561
|
+
fontWeight: title?.titleFontWeight
|
6562
|
+
}
|
6563
|
+
},
|
6564
|
+
tick: {
|
6565
|
+
visible: tick?.visible,
|
6566
|
+
tickSize: tick?.tickSize,
|
6567
|
+
inside: tick?.tickInside,
|
6568
|
+
style: {
|
6569
|
+
stroke: tick?.tickColor
|
6570
|
+
}
|
6571
|
+
},
|
6572
|
+
grid: {
|
6573
|
+
visible: grid?.visible,
|
6574
|
+
style: {
|
6575
|
+
lineWidth: grid?.gridWidth,
|
6576
|
+
stroke: grid?.gridColor
|
6577
|
+
}
|
6578
|
+
},
|
6579
|
+
domainLine: {
|
6580
|
+
visible: line?.visible,
|
6581
|
+
style: {
|
6582
|
+
lineWidth: line?.lineWidth,
|
6583
|
+
stroke: line?.lineColor
|
6584
|
+
}
|
6585
|
+
},
|
6586
|
+
innerOffset: {
|
6587
|
+
top: LINEAR_AXIS_INNER_OFFSET_TOP
|
5626
6588
|
}
|
6589
|
+
};
|
6590
|
+
result.axes = [
|
6591
|
+
...result.axes,
|
6592
|
+
linearAxis
|
5627
6593
|
];
|
5628
|
-
result.animation = true;
|
5629
6594
|
return result;
|
5630
6595
|
};
|
5631
|
-
const
|
6596
|
+
const yLinearSecondary = (spec, context)=>{
|
5632
6597
|
const result = {
|
5633
6598
|
...spec
|
5634
6599
|
};
|
5635
6600
|
const { advancedVSeed, vseed } = context;
|
5636
6601
|
const { chartType } = vseed;
|
5637
|
-
const
|
5638
|
-
|
5639
|
-
if (
|
5640
|
-
const
|
5641
|
-
const
|
5642
|
-
|
6602
|
+
const { locale, datasetReshapeInfo } = advancedVSeed;
|
6603
|
+
const config = advancedVSeed.config?.[chartType]?.secondaryYAxis;
|
6604
|
+
if (chunk_JK3VNB42_n(datasetReshapeInfo[0].foldInfoList?.[1])) return result;
|
6605
|
+
const id = `${datasetReshapeInfo[0].id}-secondary-axis`;
|
6606
|
+
const seriesId = `${datasetReshapeInfo[0].id}-secondary-series`;
|
6607
|
+
if (!result.axes) result.axes = [];
|
6608
|
+
if (!config) {
|
6609
|
+
result.axes = [
|
6610
|
+
...result.axes,
|
6611
|
+
{
|
6612
|
+
visible: true,
|
6613
|
+
id,
|
6614
|
+
seriesId,
|
6615
|
+
type: 'linear',
|
6616
|
+
orient: 'right'
|
6617
|
+
}
|
6618
|
+
];
|
6619
|
+
return result;
|
6620
|
+
}
|
6621
|
+
const { visible = true, label, tick, title, grid, line, zero, nice, inverse, max, min, log, logBase = 10 } = config;
|
6622
|
+
const linearAxis = {
|
5643
6623
|
visible,
|
5644
|
-
|
5645
|
-
|
6624
|
+
id,
|
6625
|
+
seriesId,
|
6626
|
+
type: log ? 'log' : 'linear',
|
6627
|
+
base: logBase,
|
6628
|
+
orient: 'right',
|
6629
|
+
nice,
|
6630
|
+
zero: log ? false : zero,
|
6631
|
+
inverse,
|
6632
|
+
max,
|
6633
|
+
min,
|
6634
|
+
label: {
|
6635
|
+
visible: label?.visible,
|
6636
|
+
formatMethod: (value)=>autoFormatter(value, locale),
|
5646
6637
|
style: {
|
5647
|
-
|
5648
|
-
|
5649
|
-
|
5650
|
-
|
5651
|
-
4,
|
5652
|
-
2
|
5653
|
-
]
|
6638
|
+
fill: label?.labelColor,
|
6639
|
+
angle: label?.labelAngle,
|
6640
|
+
fontSize: label?.labelFontSize,
|
6641
|
+
fontWeight: label?.labelFontWeight
|
5654
6642
|
}
|
5655
6643
|
},
|
5656
|
-
|
5657
|
-
visible:
|
5658
|
-
|
5659
|
-
visible: labelVisible,
|
5660
|
-
style: {
|
5661
|
-
fill: labelBackgroundColor
|
5662
|
-
}
|
5663
|
-
},
|
6644
|
+
title: {
|
6645
|
+
visible: title?.visible,
|
6646
|
+
text: title?.titleText,
|
5664
6647
|
style: {
|
5665
|
-
fill:
|
6648
|
+
fill: title?.titleColor,
|
6649
|
+
fontSize: title?.titleFontSize,
|
6650
|
+
fontWeight: title?.titleFontWeight
|
6651
|
+
}
|
6652
|
+
},
|
6653
|
+
tick: {
|
6654
|
+
visible: tick?.visible,
|
6655
|
+
tickSize: tick?.tickSize,
|
6656
|
+
inside: tick?.tickInside,
|
6657
|
+
style: {
|
6658
|
+
stroke: tick?.tickColor
|
6659
|
+
}
|
6660
|
+
},
|
6661
|
+
grid: {
|
6662
|
+
visible: grid?.visible,
|
6663
|
+
style: {
|
6664
|
+
lineWidth: grid?.gridWidth,
|
6665
|
+
stroke: grid?.gridColor
|
5666
6666
|
}
|
6667
|
+
},
|
6668
|
+
domainLine: {
|
6669
|
+
visible: line?.visible,
|
6670
|
+
style: {
|
6671
|
+
lineWidth: line?.lineWidth,
|
6672
|
+
stroke: line?.lineColor
|
6673
|
+
}
|
6674
|
+
},
|
6675
|
+
innerOffset: {
|
6676
|
+
top: LINEAR_AXIS_INNER_OFFSET_TOP
|
5667
6677
|
}
|
5668
6678
|
};
|
6679
|
+
result.axes = [
|
6680
|
+
...result.axes,
|
6681
|
+
linearAxis
|
6682
|
+
];
|
5669
6683
|
return result;
|
5670
6684
|
};
|
5671
|
-
const
|
5672
|
-
|
6685
|
+
const dualAxis = [
|
6686
|
+
series([
|
6687
|
+
initDualAxisPrimary,
|
6688
|
+
dualChartTypePrimary,
|
6689
|
+
datasetPrimary,
|
6690
|
+
labelPrimary,
|
6691
|
+
tooltipPrimary,
|
6692
|
+
progressive,
|
6693
|
+
barStyle_barStyle,
|
6694
|
+
pointStyle_pointStyle,
|
6695
|
+
pointStateDimensionHover,
|
6696
|
+
lineStyle_lineStyle,
|
6697
|
+
areaStyle_areaStyle
|
6698
|
+
], [
|
6699
|
+
initDualAxisSecondary,
|
6700
|
+
dualChartTypeSecondary,
|
6701
|
+
datasetSecondary,
|
6702
|
+
labelSecondary,
|
6703
|
+
tooltipSecondary,
|
6704
|
+
progressive,
|
6705
|
+
barStyle_barStyle,
|
6706
|
+
pointStyle_pointStyle,
|
6707
|
+
pointStateDimensionHover,
|
6708
|
+
lineStyle_lineStyle,
|
6709
|
+
areaStyle_areaStyle
|
6710
|
+
]),
|
6711
|
+
xBand,
|
6712
|
+
yLinearPrimary,
|
6713
|
+
yLinearSecondary,
|
5673
6714
|
color_color,
|
5674
6715
|
background_backgroundColor,
|
5675
|
-
datasetXY,
|
5676
|
-
progressive,
|
5677
|
-
xLinear,
|
5678
|
-
yLinear,
|
5679
|
-
label_label,
|
5680
|
-
tooltip_tooltip,
|
5681
|
-
verticalCrosshairLine,
|
5682
|
-
horizontalCrosshairLine,
|
5683
6716
|
discreteLegend,
|
5684
|
-
|
5685
|
-
pointStateHover,
|
6717
|
+
verticalCrosshairRect,
|
5686
6718
|
annotationPoint_annotationPoint,
|
5687
6719
|
annotationVerticalLine_annotationVerticalLine,
|
5688
6720
|
annotationHorizontalLine_annotationHorizontalLine,
|
5689
6721
|
annotationArea_annotationArea
|
5690
6722
|
];
|
5691
|
-
const
|
6723
|
+
const pivotDualAxis = [
|
5692
6724
|
initPivot,
|
5693
6725
|
pivotGridStyle,
|
5694
6726
|
pivotIndicators_pivotIndicatorsAsRow,
|
5695
6727
|
datasetPivot,
|
5696
6728
|
pivotIndicators_pivotIndicators([
|
5697
|
-
|
6729
|
+
series([
|
6730
|
+
initDualAxisPrimary,
|
6731
|
+
datasetPrimary,
|
6732
|
+
labelPrimary,
|
6733
|
+
tooltipPrimary,
|
6734
|
+
progressive,
|
6735
|
+
barStyle_barStyle,
|
6736
|
+
pointStyle_pointStyle,
|
6737
|
+
pointStateDimensionHover,
|
6738
|
+
lineStyle_lineStyle,
|
6739
|
+
areaStyle_areaStyle
|
6740
|
+
], [
|
6741
|
+
initDualAxisSecondary,
|
6742
|
+
datasetSecondary,
|
6743
|
+
labelSecondary,
|
6744
|
+
tooltipSecondary,
|
6745
|
+
progressive,
|
6746
|
+
barStyle_barStyle,
|
6747
|
+
pointStyle_pointStyle,
|
6748
|
+
pointStateDimensionHover,
|
6749
|
+
lineStyle_lineStyle,
|
6750
|
+
areaStyle_areaStyle
|
6751
|
+
]),
|
6752
|
+
xBand,
|
6753
|
+
yLinearPrimary,
|
6754
|
+
yLinearSecondary,
|
5698
6755
|
color_color,
|
5699
6756
|
background_backgroundColor,
|
5700
|
-
|
5701
|
-
progressive,
|
5702
|
-
xLinear,
|
5703
|
-
yLinear,
|
5704
|
-
label_label,
|
5705
|
-
tooltip_tooltip,
|
5706
|
-
verticalCrosshairLine,
|
5707
|
-
horizontalCrosshairLine,
|
5708
|
-
pointStyle_pointStyle,
|
5709
|
-
pointStateHover,
|
6757
|
+
verticalCrosshairRect,
|
5710
6758
|
annotationPoint_annotationPoint,
|
5711
6759
|
annotationVerticalLine_annotationVerticalLine,
|
5712
6760
|
annotationHorizontalLine_annotationHorizontalLine,
|
@@ -5716,12 +6764,12 @@
|
|
5716
6764
|
pivotColumnDimensions,
|
5717
6765
|
pivotDiscreteLegend
|
5718
6766
|
];
|
5719
|
-
const
|
5720
|
-
pivotAdapter_pivotAdapter(
|
6767
|
+
const dualAxisSpecPipeline = [
|
6768
|
+
pivotAdapter_pivotAdapter(dualAxis, pivotDualAxis)
|
5721
6769
|
];
|
5722
|
-
const
|
5723
|
-
Builder._advancedPipelineMap.
|
5724
|
-
Builder._specPipelineMap.
|
6770
|
+
const registerDualAxis = ()=>{
|
6771
|
+
Builder._advancedPipelineMap.dualAxis = dualAxisAdvancedPipeline;
|
6772
|
+
Builder._specPipelineMap.dualAxis = dualAxisSpecPipeline;
|
5725
6773
|
};
|
5726
6774
|
const dataReshapeFor1D1M_emptyReshapeResult = {
|
5727
6775
|
dataset: [],
|
@@ -5801,6 +6849,7 @@
|
|
5801
6849
|
datasetReshapeInfo: [
|
5802
6850
|
{
|
5803
6851
|
id: '1D1M',
|
6852
|
+
index: 0,
|
5804
6853
|
foldInfo,
|
5805
6854
|
unfoldInfo
|
5806
6855
|
}
|
@@ -5822,7 +6871,7 @@
|
|
5822
6871
|
});
|
5823
6872
|
const newDatasets = [];
|
5824
6873
|
const datasetReshapeInfo = [];
|
5825
|
-
measureGroups.forEach((measureGroup)=>{
|
6874
|
+
measureGroups.forEach((measureGroup, index)=>{
|
5826
6875
|
const measures = measureGroup.children;
|
5827
6876
|
if (!measures) return;
|
5828
6877
|
const commonDimensions = dimensions.filter((dim)=>'dimension' === dim.location);
|
@@ -5835,6 +6884,7 @@
|
|
5835
6884
|
});
|
5836
6885
|
const reshapeInfo = {
|
5837
6886
|
id: groupId,
|
6887
|
+
index,
|
5838
6888
|
foldInfo,
|
5839
6889
|
unfoldInfo
|
5840
6890
|
};
|
@@ -7188,6 +8238,17 @@
|
|
7188
8238
|
},
|
7189
8239
|
crosshairLine
|
7190
8240
|
},
|
8241
|
+
dualAxis: {
|
8242
|
+
...baseConfig,
|
8243
|
+
xAxis: bandAxis,
|
8244
|
+
primaryYAxis: linearAxis,
|
8245
|
+
secondaryYAxis: linearAxis,
|
8246
|
+
dualChartType: {
|
8247
|
+
primary: 'column',
|
8248
|
+
secondary: 'line'
|
8249
|
+
},
|
8250
|
+
crosshairRect
|
8251
|
+
},
|
7191
8252
|
pie: {
|
7192
8253
|
...baseConfig
|
7193
8254
|
},
|
@@ -7510,6 +8571,17 @@
|
|
7510
8571
|
},
|
7511
8572
|
crosshairLine
|
7512
8573
|
},
|
8574
|
+
dualAxis: {
|
8575
|
+
...baseConfig,
|
8576
|
+
xAxis: bandAxis,
|
8577
|
+
primaryYAxis: linearAxis,
|
8578
|
+
secondaryYAxis: linearAxis,
|
8579
|
+
dualChartType: {
|
8580
|
+
primary: 'column',
|
8581
|
+
secondary: 'line'
|
8582
|
+
},
|
8583
|
+
crosshairRect
|
8584
|
+
},
|
7513
8585
|
pie: {
|
7514
8586
|
...baseConfig
|
7515
8587
|
},
|
@@ -7575,6 +8647,7 @@
|
|
7575
8647
|
registerAreaPercent();
|
7576
8648
|
registerAreaRange();
|
7577
8649
|
registerScatter();
|
8650
|
+
registerDualAxis();
|
7578
8651
|
registerPie();
|
7579
8652
|
registerDonut();
|
7580
8653
|
registerRose();
|
@@ -10897,6 +11970,26 @@
|
|
10897
11970
|
'funnel',
|
10898
11971
|
'heatmap'
|
10899
11972
|
]);
|
11973
|
+
const zDualChartType = schemas_object({
|
11974
|
+
primary: schemas_enum([
|
11975
|
+
'line',
|
11976
|
+
'column',
|
11977
|
+
'columnPercent',
|
11978
|
+
'columnParallel',
|
11979
|
+
'area',
|
11980
|
+
'areaPercent',
|
11981
|
+
'scatter'
|
11982
|
+
]).default('column'),
|
11983
|
+
secondary: schemas_enum([
|
11984
|
+
'line',
|
11985
|
+
'column',
|
11986
|
+
'columnPercent',
|
11987
|
+
'columnParallel',
|
11988
|
+
'area',
|
11989
|
+
'areaPercent',
|
11990
|
+
'scatter'
|
11991
|
+
]).default('line')
|
11992
|
+
});
|
10900
11993
|
const zDatum = record(schemas_string().or(schemas_number()), any());
|
10901
11994
|
const zDataset = schemas_array(zDatum);
|
10902
11995
|
const zDimension = schemas_object({
|
@@ -10962,6 +12055,14 @@
|
|
10962
12055
|
});
|
10963
12056
|
const zMeasures = schemas_array(zMeasure);
|
10964
12057
|
const zMeasureTree = schemas_array(zMeasureGroup.or(zMeasure));
|
12058
|
+
const zDualMeasure = schemas_object({
|
12059
|
+
id: schemas_string(),
|
12060
|
+
primaryMeasures: schemas_array(zMeasure).or(zMeasure).optional(),
|
12061
|
+
primaryAlias: schemas_string().optional(),
|
12062
|
+
secondaryMeasures: schemas_array(zMeasure).or(zMeasure).optional(),
|
12063
|
+
secondaryAlias: schemas_string().optional()
|
12064
|
+
});
|
12065
|
+
const zDualMeasures = schemas_array(zDualMeasure);
|
10965
12066
|
const zFoldInfo = schemas_object({
|
10966
12067
|
foldMap: record(schemas_string(), schemas_string().or(schemas_undefined())),
|
10967
12068
|
measureId: schemas_string(),
|
@@ -10976,7 +12077,9 @@
|
|
10976
12077
|
});
|
10977
12078
|
const zDatasetReshapeInfo = schemas_array(schemas_object({
|
10978
12079
|
id: schemas_string(),
|
12080
|
+
index: schemas_number(),
|
10979
12081
|
foldInfo: zFoldInfo,
|
12082
|
+
foldInfoList: schemas_array(zFoldInfo).optional(),
|
10980
12083
|
unfoldInfo: zUnfoldInfo
|
10981
12084
|
}));
|
10982
12085
|
const zEncoding = schemas_array(schemas_object({
|
@@ -11256,7 +12359,12 @@
|
|
11256
12359
|
label: zLabel.optional(),
|
11257
12360
|
color: zColor.optional(),
|
11258
12361
|
tooltip: zTooltip.optional(),
|
11259
|
-
legend: zLegend.optional()
|
12362
|
+
legend: zLegend.optional(),
|
12363
|
+
dualChartType: schemas_array(zDualChartType).or(zDualChartType).optional(),
|
12364
|
+
primaryYAxis: schemas_array(zYLinearAxis).or(zYLinearAxis).optional(),
|
12365
|
+
secondaryYAxis: schemas_array(zYLinearAxis).or(zYLinearAxis).optional(),
|
12366
|
+
xAxis: zXBandAxis.optional(),
|
12367
|
+
crosshairRect: zCrosshairRect.optional()
|
11260
12368
|
});
|
11261
12369
|
const zScatterConfig = schemas_object({
|
11262
12370
|
backgroundColor: zBackgroundColor.optional(),
|
@@ -11300,8 +12408,8 @@
|
|
11300
12408
|
area: zAreaConfig.optional(),
|
11301
12409
|
areaPercent: zAreaPercentConfig.optional(),
|
11302
12410
|
areaRange: zAreaRangeConfig.optional(),
|
11303
|
-
dualAxis: zDualAxisConfig.optional(),
|
11304
12411
|
scatter: zScatterConfig.optional(),
|
12412
|
+
dualAxis: zDualAxisConfig.optional(),
|
11305
12413
|
rose: zRoseConfig.optional(),
|
11306
12414
|
roseParallel: zRoseParallelConfig.optional(),
|
11307
12415
|
pie: zPieConfig.optional(),
|
@@ -11551,20 +12659,20 @@
|
|
11551
12659
|
'middle',
|
11552
12660
|
'bottom'
|
11553
12661
|
]).default('top').optional(),
|
11554
|
-
lineVisible: schemas_boolean().optional(),
|
11555
|
-
lineColor: schemas_string().optional(),
|
11556
|
-
lineWidth: schemas_number().optional(),
|
12662
|
+
lineVisible: schemas_boolean().default(true).optional(),
|
12663
|
+
lineColor: schemas_string().default('#212121').optional(),
|
12664
|
+
lineWidth: schemas_number().default(1).optional(),
|
11557
12665
|
lineStyle: union([
|
11558
12666
|
literal('solid'),
|
11559
12667
|
literal('dashed'),
|
11560
12668
|
literal('dotted')
|
11561
|
-
]).optional(),
|
12669
|
+
]).default('dashed').optional(),
|
11562
12670
|
backgroundVisible: schemas_boolean().default(true).optional(),
|
11563
12671
|
backgroundColor: schemas_string().default('#212121').optional(),
|
11564
|
-
backgroundBorderColor: schemas_string().optional(),
|
11565
|
-
backgroundBorderWidth: schemas_number().default(1).optional(),
|
12672
|
+
backgroundBorderColor: schemas_string().default('#212121').optional(),
|
11566
12673
|
backgroundBorderRadius: schemas_number().default(4).optional(),
|
11567
|
-
|
12674
|
+
backgroundBorderWidth: schemas_number().default(1).optional(),
|
12675
|
+
backgroundPadding: schemas_number().default(2).optional(),
|
11568
12676
|
offsetX: schemas_number().default(0),
|
11569
12677
|
offsetY: schemas_number().default(0)
|
11570
12678
|
});
|
@@ -11589,7 +12697,7 @@
|
|
11589
12697
|
'insideStart',
|
11590
12698
|
'insideMiddle',
|
11591
12699
|
'insideEnd'
|
11592
|
-
]).default('
|
12700
|
+
]).default('insideEnd').optional(),
|
11593
12701
|
textColor: schemas_string().default('#ffffff').optional(),
|
11594
12702
|
textFontSize: schemas_number().default(12).optional(),
|
11595
12703
|
textFontWeight: schemas_number().default(400).optional(),
|
@@ -11597,26 +12705,26 @@
|
|
11597
12705
|
'left',
|
11598
12706
|
'right',
|
11599
12707
|
'center'
|
11600
|
-
]).default('
|
12708
|
+
]).default('right').optional(),
|
11601
12709
|
textBaseline: schemas_enum([
|
11602
12710
|
'top',
|
11603
12711
|
'middle',
|
11604
12712
|
'bottom'
|
11605
|
-
]).default('
|
11606
|
-
lineVisible: schemas_boolean().optional(),
|
11607
|
-
lineColor: schemas_string().optional(),
|
11608
|
-
lineWidth: schemas_number().optional(),
|
12713
|
+
]).default('top').optional(),
|
12714
|
+
lineVisible: schemas_boolean().default(true).optional(),
|
12715
|
+
lineColor: schemas_string().default('#212121').optional(),
|
12716
|
+
lineWidth: schemas_number().default(1).optional(),
|
11609
12717
|
lineStyle: union([
|
11610
12718
|
literal('solid'),
|
11611
12719
|
literal('dashed'),
|
11612
12720
|
literal('dotted')
|
11613
|
-
]).optional(),
|
12721
|
+
]).default('dashed').optional(),
|
11614
12722
|
backgroundVisible: schemas_boolean().default(true).optional(),
|
11615
12723
|
backgroundColor: schemas_string().default('#212121').optional(),
|
11616
|
-
backgroundBorderColor: schemas_string().optional(),
|
11617
|
-
backgroundBorderWidth: schemas_number().default(1).optional(),
|
12724
|
+
backgroundBorderColor: schemas_string().default('#212121').optional(),
|
11618
12725
|
backgroundBorderRadius: schemas_number().default(4).optional(),
|
11619
|
-
|
12726
|
+
backgroundBorderWidth: schemas_number().default(1).optional(),
|
12727
|
+
backgroundPadding: schemas_number().default(2).optional(),
|
11620
12728
|
offsetX: schemas_number().default(0),
|
11621
12729
|
offsetY: schemas_number().default(0)
|
11622
12730
|
});
|
@@ -11648,21 +12756,21 @@
|
|
11648
12756
|
'top',
|
11649
12757
|
'middle',
|
11650
12758
|
'bottom'
|
11651
|
-
]).default('
|
12759
|
+
]).default('top').optional(),
|
11652
12760
|
backgroundVisible: schemas_boolean().default(true).optional(),
|
11653
|
-
backgroundColor: schemas_string().default('#
|
11654
|
-
backgroundBorderColor: schemas_string().optional(),
|
12761
|
+
backgroundColor: schemas_string().default('#191d24').optional(),
|
12762
|
+
backgroundBorderColor: schemas_string().default('#191d24').optional(),
|
11655
12763
|
backgroundBorderWidth: schemas_number().default(1).optional(),
|
11656
12764
|
backgroundBorderRadius: schemas_number().default(4).optional(),
|
11657
|
-
backgroundPadding: schemas_number().optional(),
|
11658
|
-
areaColor: schemas_string().default('
|
11659
|
-
areaColorOpacity: schemas_number().default(0.
|
11660
|
-
areaBorderColor:
|
11661
|
-
areaBorderWidth: schemas_number().default(
|
12765
|
+
backgroundPadding: schemas_number().default(4).optional(),
|
12766
|
+
areaColor: schemas_string().default('#888888').optional(),
|
12767
|
+
areaColorOpacity: schemas_number().default(0.15).optional(),
|
12768
|
+
areaBorderColor: schemas_string().default('#888888').optional(),
|
12769
|
+
areaBorderWidth: schemas_number().default(1).optional(),
|
11662
12770
|
areaBorderRadius: schemas_number().default(4).optional(),
|
11663
|
-
outerPadding: schemas_number().optional(),
|
11664
|
-
offsetX: schemas_number().optional(),
|
11665
|
-
offsetY: schemas_number().optional()
|
12771
|
+
outerPadding: schemas_number().default(4).optional(),
|
12772
|
+
offsetX: schemas_number().default(0).optional(),
|
12773
|
+
offsetY: schemas_number().default(0).optional()
|
11666
12774
|
});
|
11667
12775
|
const zAnnotation = schemas_object({
|
11668
12776
|
annotationPoint: zAnnotationPoint.or(schemas_array(zAnnotationPoint)).optional(),
|
@@ -11954,6 +13062,35 @@
|
|
11954
13062
|
annotationArea: schemas_array(zAnnotationArea).or(zAnnotationArea).optional(),
|
11955
13063
|
locale: zLocale.optional()
|
11956
13064
|
});
|
13065
|
+
const zDualAxis = schemas_object({
|
13066
|
+
chartType: literal('dualAxis'),
|
13067
|
+
dataset: zDataset.optional(),
|
13068
|
+
dimensions: zDimensions.optional(),
|
13069
|
+
measures: zMeasureTree.optional(),
|
13070
|
+
dualMeasures: zDualMeasures.optional(),
|
13071
|
+
dualChartType: schemas_array(zDualChartType).or(zDualChartType).optional(),
|
13072
|
+
primaryYAxis: schemas_array(zYLinearAxis).or(zYLinearAxis).optional(),
|
13073
|
+
secondaryYAxis: schemas_array(zYLinearAxis).or(zYLinearAxis).optional(),
|
13074
|
+
xAxis: zXBandAxis.optional(),
|
13075
|
+
backgroundColor: zBackgroundColor.optional(),
|
13076
|
+
color: zColor.optional(),
|
13077
|
+
label: zLabel.optional(),
|
13078
|
+
legend: zLegend.optional(),
|
13079
|
+
tooltip: zTooltip.optional(),
|
13080
|
+
crosshairRect: zCrosshairRect.optional(),
|
13081
|
+
sort: zSort.optional(),
|
13082
|
+
sortLegend: zSortLegend.optional(),
|
13083
|
+
theme: zTheme.optional(),
|
13084
|
+
barStyle: schemas_array(zBarStyle).or(zBarStyle).optional(),
|
13085
|
+
pointStyle: schemas_array(zPointStyle).or(zPointStyle).optional(),
|
13086
|
+
lineStyle: schemas_array(zLineStyle).or(zLineStyle).optional(),
|
13087
|
+
areaStyle: schemas_array(zAreaStyle).or(zAreaStyle).optional(),
|
13088
|
+
annotationPoint: schemas_array(zAnnotationPoint).or(zAnnotationPoint).optional(),
|
13089
|
+
annotationVerticalLine: schemas_array(zAnnotationVerticalLine).or(zAnnotationVerticalLine).optional(),
|
13090
|
+
annotationHorizontalLine: schemas_array(zAnnotationHorizontalLine).or(zAnnotationHorizontalLine).optional(),
|
13091
|
+
annotationArea: schemas_array(zAnnotationArea).or(zAnnotationArea).optional(),
|
13092
|
+
locale: zLocale.optional()
|
13093
|
+
});
|
11957
13094
|
const zRose = schemas_object({
|
11958
13095
|
chartType: literal('rose'),
|
11959
13096
|
dataset: zDataset.optional(),
|
@@ -12059,6 +13196,7 @@
|
|
12059
13196
|
zAreaPercent,
|
12060
13197
|
zAreaRange,
|
12061
13198
|
zScatter,
|
13199
|
+
zDualAxis,
|
12062
13200
|
zPie,
|
12063
13201
|
zDonut,
|
12064
13202
|
zRose,
|