@visactor/vseed 0.0.33 → 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 +2794 -4887
- 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 +1352 -202
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1279 -156
- 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 +507 -14
- 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/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/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 +1961 -0
- package/dist/umd/index.js +1272 -140
- package/dist/umd/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
@@ -32,10 +32,11 @@ __webpack_require__.d(__webpack_exports__, {
|
|
32
32
|
areaSpecPipeline: ()=>areaSpecPipeline,
|
33
33
|
isTable: ()=>isTable,
|
34
34
|
zDonut: ()=>zDonut,
|
35
|
+
zDualMeasures: ()=>zDualMeasures,
|
35
36
|
zPie: ()=>zPie,
|
36
|
-
zRoseConfig: ()=>zRoseConfig,
|
37
37
|
findFirstMeasure: ()=>findFirstMeasure,
|
38
38
|
scatterAdvancedPipeline: ()=>scatterAdvancedPipeline,
|
39
|
+
zRoseConfig: ()=>zRoseConfig,
|
39
40
|
updateSpec: ()=>updateSpec,
|
40
41
|
zCrosshairRect: ()=>zCrosshairRect,
|
41
42
|
scatterSpecPipeline: ()=>scatterSpecPipeline,
|
@@ -44,6 +45,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
44
45
|
zColumnConfig: ()=>zColumnConfig,
|
45
46
|
zAnnotation: ()=>zAnnotation,
|
46
47
|
selector: ()=>selector_selector,
|
48
|
+
zDualMeasure: ()=>zDualMeasure,
|
47
49
|
zSortLegend: ()=>zSortLegend,
|
48
50
|
pivotTableAdvancedPipeline: ()=>pivotTableAdvancedPipeline,
|
49
51
|
zYBandAxis: ()=>zYBandAxis,
|
@@ -103,27 +105,27 @@ __webpack_require__.d(__webpack_exports__, {
|
|
103
105
|
registerPivotTable: ()=>registerPivotTable,
|
104
106
|
tableAdvancedPipeline: ()=>tableAdvancedPipeline,
|
105
107
|
pieSpecPipeline: ()=>pieSpecPipeline,
|
108
|
+
dualAxisSpecPipeline: ()=>dualAxisSpecPipeline,
|
106
109
|
registerDarkTheme: ()=>registerDarkTheme,
|
107
110
|
zAnnotationVerticalLine: ()=>zAnnotationVerticalLine,
|
108
|
-
zChartType: ()=>zChartType,
|
109
111
|
barSpecPipeline: ()=>barSpecPipeline,
|
110
|
-
|
112
|
+
zChartType: ()=>zChartType,
|
111
113
|
registerRose: ()=>registerRose,
|
112
|
-
|
114
|
+
zCrosshairLine: ()=>zCrosshairLine,
|
113
115
|
unfoldDimensions: ()=>unfoldDimensions,
|
114
116
|
roseParallelAdvancedPipeline: ()=>roseParallelAdvancedPipeline,
|
115
117
|
registerTable: ()=>registerTable,
|
116
|
-
Builder: ()=>Builder,
|
117
118
|
autoFormatter: ()=>autoFormatter,
|
118
119
|
findFirstDimension: ()=>findFirstDimension,
|
120
|
+
Builder: ()=>Builder,
|
119
121
|
registerAll: ()=>registerAll,
|
120
122
|
registerBar: ()=>registerBar,
|
121
123
|
isVChart: ()=>isVChart,
|
122
124
|
radarSpecPipeline: ()=>radarSpecPipeline,
|
125
|
+
zMeasureTree: ()=>zMeasureTree,
|
123
126
|
zPieConfig: ()=>zPieConfig,
|
124
127
|
zPivotTable: ()=>zPivotTable,
|
125
128
|
zRadar: ()=>zRadar,
|
126
|
-
zRose: ()=>zRose,
|
127
129
|
registerLine: ()=>registerLine,
|
128
130
|
registerCustomTheme: ()=>registerCustomTheme,
|
129
131
|
zColor: ()=>zColor,
|
@@ -134,16 +136,16 @@ __webpack_require__.d(__webpack_exports__, {
|
|
134
136
|
zDonutConfig: ()=>zDonutConfig,
|
135
137
|
zFunnelConfig: ()=>zFunnelConfig,
|
136
138
|
zMeasureGroup: ()=>zMeasureGroup,
|
137
|
-
|
139
|
+
zDualAxis: ()=>zDualAxis,
|
138
140
|
FoldMeasureName: ()=>FoldMeasureName,
|
139
|
-
|
141
|
+
zDualChartType: ()=>zDualChartType,
|
140
142
|
darkTheme: ()=>darkTheme,
|
141
143
|
createNumFormatter: ()=>createNumFormatter,
|
142
144
|
zAreaConfig: ()=>zAreaConfig,
|
143
145
|
zAxis: ()=>zAxis,
|
144
146
|
isVTable: ()=>isVTable,
|
145
|
-
|
146
|
-
|
147
|
+
zMeasures: ()=>zMeasures,
|
148
|
+
zRadarConfig: ()=>zRadarConfig,
|
147
149
|
zLine: ()=>zLine,
|
148
150
|
columnSpecPipeline: ()=>columnSpecPipeline,
|
149
151
|
UnfoldDimensionGroup: ()=>UnfoldDimensionGroup,
|
@@ -154,6 +156,8 @@ __webpack_require__.d(__webpack_exports__, {
|
|
154
156
|
ORIGINAL_DATA: ()=>ORIGINAL_DATA,
|
155
157
|
zStackCornerRadius: ()=>zStackCornerRadius,
|
156
158
|
zAnnotationArea: ()=>zAnnotationArea,
|
159
|
+
zUnfoldInfo: ()=>zUnfoldInfo,
|
160
|
+
zRose: ()=>zRose,
|
157
161
|
columnParallelSpecPipeline: ()=>columnParallelSpecPipeline,
|
158
162
|
i18n: ()=>i18n,
|
159
163
|
zPointStyle: ()=>zPointStyle,
|
@@ -162,12 +166,15 @@ __webpack_require__.d(__webpack_exports__, {
|
|
162
166
|
registerColumnParallel: ()=>registerColumnParallel,
|
163
167
|
updateAdvanced: ()=>updateAdvanced,
|
164
168
|
zDimension: ()=>zDimension,
|
169
|
+
zTable: ()=>zTable,
|
170
|
+
FoldSecondaryMeasureValue: ()=>FoldSecondaryMeasureValue,
|
165
171
|
zSort: ()=>zSort,
|
166
172
|
isPivotChart: ()=>isPivotChart,
|
167
173
|
zDualAxisConfig: ()=>zDualAxisConfig,
|
168
174
|
zColumn: ()=>zColumn,
|
169
175
|
zCustomTheme: ()=>zCustomTheme,
|
170
176
|
zLineConfig: ()=>zLineConfig,
|
177
|
+
FoldPrimaryMeasureValue: ()=>FoldPrimaryMeasureValue,
|
171
178
|
zTableConfig: ()=>zTableConfig,
|
172
179
|
zXBandAxis: ()=>zXBandAxis,
|
173
180
|
dataReshapeFor1D: ()=>dataReshapeFor1D,
|
@@ -185,15 +192,17 @@ __webpack_require__.d(__webpack_exports__, {
|
|
185
192
|
zMeasure: ()=>zMeasure,
|
186
193
|
areaRangeSpecPipeline: ()=>areaRangeSpecPipeline,
|
187
194
|
areaRangeAdvancedPipeline: ()=>areaRangeAdvancedPipeline,
|
188
|
-
|
195
|
+
dualAxisAdvancedPipeline: ()=>dualAxisAdvancedPipeline,
|
189
196
|
registerScatter: ()=>registerScatter,
|
190
|
-
|
197
|
+
zAreaRange: ()=>zAreaRange,
|
198
|
+
measureDepth: ()=>measureDepth,
|
191
199
|
autoNumFormatter: ()=>autoNumFormatter,
|
192
200
|
zAdvancedVSeed: ()=>zAdvancedVSeed,
|
193
201
|
tableSpecPipeline: ()=>tableSpecPipeline,
|
194
202
|
zConfig: ()=>zConfig,
|
195
|
-
|
203
|
+
zEncoding: ()=>zEncoding,
|
196
204
|
zBarStyle: ()=>zBarStyle,
|
205
|
+
zRoseParallelConfig: ()=>zRoseParallelConfig,
|
197
206
|
zXLinearAxis: ()=>zXLinearAxis,
|
198
207
|
zAreaPercent: ()=>zAreaPercent,
|
199
208
|
columnParallelAdvancedPipeline: ()=>columnParallelAdvancedPipeline,
|
@@ -232,11 +241,11 @@ const buildAdvanced = (builder)=>{
|
|
232
241
|
const start = 'undefined' != typeof performance ? performance.now() : Date.now();
|
233
242
|
const { chartType } = builder.vseed;
|
234
243
|
if (!chartType) throw new Error('chartType is nil in buildAdvanced');
|
235
|
-
const pipeline =
|
244
|
+
const pipeline = Builder.getAdvancedPipeline(chartType);
|
236
245
|
if (!pipeline) throw new Error(`no advanced pipeline for chartType ${chartType}`);
|
237
246
|
const context = {
|
238
247
|
vseed: builder.vseed,
|
239
|
-
customTheme:
|
248
|
+
customTheme: Builder.getThemeMap()
|
240
249
|
};
|
241
250
|
try {
|
242
251
|
return execPipeline(pipeline, context);
|
@@ -252,7 +261,7 @@ const buildSpec = (builder, advancedVSeed)=>{
|
|
252
261
|
const start = 'undefined' != typeof performance ? performance.now() : Date.now();
|
253
262
|
const { chartType } = builder.vseed;
|
254
263
|
if (!chartType) throw new Error('chartType is nil in buildSpec');
|
255
|
-
const pipeline =
|
264
|
+
const pipeline = Builder.getSpecPipeline(chartType);
|
256
265
|
if (!pipeline) throw new Error(`no spec pipeline for chartType ${chartType}`);
|
257
266
|
const context = {
|
258
267
|
vseed: builder.vseed,
|
@@ -336,20 +345,6 @@ class Builder {
|
|
336
345
|
build = ()=>build(this);
|
337
346
|
buildSpec = (advanced)=>buildSpec(this, advanced);
|
338
347
|
buildAdvanced = ()=>buildAdvanced(this);
|
339
|
-
getAdvancedPipeline = (chartType)=>{
|
340
|
-
const customPipe = Builder._customAdvancedPipe[chartType];
|
341
|
-
const pipeline = Builder._advancedPipelineMap[chartType];
|
342
|
-
if (customPipe) pipeline.push(customPipe);
|
343
|
-
return pipeline;
|
344
|
-
};
|
345
|
-
getSpecPipeline = (chartType)=>{
|
346
|
-
const customPipe = Builder._customSpecPipe[chartType];
|
347
|
-
const pipeline = Builder._specPipelineMap[chartType];
|
348
|
-
if (customPipe) pipeline.push(customPipe);
|
349
|
-
return pipeline;
|
350
|
-
};
|
351
|
-
getTheme = (themeKey)=>Builder._themeMap[themeKey];
|
352
|
-
getThemeMap = ()=>Builder._themeMap;
|
353
348
|
getColorItems = ()=>getColorItems(this);
|
354
349
|
getColorIdMap = ()=>getColorIdMap(this);
|
355
350
|
get vseed() {
|
@@ -376,12 +371,26 @@ class Builder {
|
|
376
371
|
set performance(value) {
|
377
372
|
this._performance = value;
|
378
373
|
}
|
374
|
+
static getAdvancedPipeline = (chartType)=>{
|
375
|
+
const customPipe = Builder._customAdvancedPipe[chartType];
|
376
|
+
const pipeline = Builder._advancedPipelineMap[chartType];
|
377
|
+
if (customPipe) pipeline.push(customPipe);
|
378
|
+
return pipeline;
|
379
|
+
};
|
380
|
+
static getSpecPipeline = (chartType)=>{
|
381
|
+
const customPipe = Builder._customSpecPipe[chartType];
|
382
|
+
const pipeline = Builder._specPipelineMap[chartType];
|
383
|
+
if (customPipe) pipeline.push(customPipe);
|
384
|
+
return pipeline;
|
385
|
+
};
|
386
|
+
static getTheme = (themeKey)=>Builder._themeMap[themeKey];
|
387
|
+
static getThemeMap = ()=>Builder._themeMap;
|
388
|
+
static from = (vseed)=>new Builder(vseed);
|
379
389
|
static _advancedPipelineMap = {};
|
380
390
|
static _specPipelineMap = {};
|
381
391
|
static _customAdvancedPipe = {};
|
382
392
|
static _customSpecPipe = {};
|
383
393
|
static _themeMap = {};
|
384
|
-
static from = (vseed)=>new Builder(vseed);
|
385
394
|
}
|
386
395
|
const initAdvancedVSeed = (advancedVSeed, context)=>{
|
387
396
|
const { vseed } = context;
|
@@ -481,7 +490,10 @@ const autoDimensions = (advancedVSeed, context)=>{
|
|
481
490
|
if (!dataset) throw new Error('dataset is required');
|
482
491
|
if (0 === dataset.length) return result;
|
483
492
|
if (dimensions) {
|
484
|
-
result.dimensions = dimensions
|
493
|
+
result.dimensions = dimensions.map((dim)=>({
|
494
|
+
location: 'dimension',
|
495
|
+
...dim
|
496
|
+
}));
|
485
497
|
return result;
|
486
498
|
}
|
487
499
|
const top100dataset = dataset.slice(0, 100);
|
@@ -777,7 +789,7 @@ const autoPivotMeasures = (advancedVSeed, context)=>{
|
|
777
789
|
const measures = findAllMeasures(vseed.measures);
|
778
790
|
if (!dataset) throw new Error('dataset is required');
|
779
791
|
if (0 === dataset.length) return result;
|
780
|
-
if (measures) {
|
792
|
+
if (vseed.measures) {
|
781
793
|
result.measures = findAllMeasures(measures);
|
782
794
|
return result;
|
783
795
|
}
|
@@ -1075,6 +1087,15 @@ const initAdvancedVSeed_initAdvancedVSeed = (advancedVSeed, context)=>{
|
|
1075
1087
|
locale: locale || 'zh-CN'
|
1076
1088
|
};
|
1077
1089
|
};
|
1090
|
+
const measureDepth = (measures = [])=>{
|
1091
|
+
if (!measures) return 0;
|
1092
|
+
let depth = 1;
|
1093
|
+
preorderTraverse(measures, (node)=>{
|
1094
|
+
if ('children' in node) depth = Math.max(depth, 1 + measureDepth(node.children));
|
1095
|
+
return false;
|
1096
|
+
});
|
1097
|
+
return depth;
|
1098
|
+
};
|
1078
1099
|
const isTable = (vseed)=>'table' === vseed.chartType;
|
1079
1100
|
const isPivotTable = (vseed)=>'pivotTable' === vseed.chartType;
|
1080
1101
|
const isVTable = (vseed)=>[
|
@@ -1084,9 +1105,18 @@ const isVTable = (vseed)=>[
|
|
1084
1105
|
const isVChart = (vseed)=>!isVTable(vseed);
|
1085
1106
|
const isPivotChart = (vseed)=>{
|
1086
1107
|
if (isVTable(vseed)) return false;
|
1108
|
+
if ('dualAxis' === vseed.chartType) {
|
1109
|
+
if (vseed.measures) {
|
1110
|
+
const depth = measureDepth(vseed.measures);
|
1111
|
+
if (3 === depth) return true;
|
1112
|
+
return false;
|
1113
|
+
}
|
1114
|
+
if (vseed.dualMeasures && vseed.dualMeasures.length > 1) return true;
|
1115
|
+
return false;
|
1116
|
+
}
|
1087
1117
|
const { measures = [], dimensions = [] } = vseed;
|
1088
1118
|
const hasRowOrColumnDimension = dimensions && dimensions.some((dimension)=>'rowDimension' === dimension.location || 'columnDimension' === dimension.location);
|
1089
|
-
const hasMeasureGroup = measures && measures.
|
1119
|
+
const hasMeasureGroup = measures && measures.some((measure)=>measure && measure.children);
|
1090
1120
|
return hasRowOrColumnDimension || hasMeasureGroup;
|
1091
1121
|
};
|
1092
1122
|
const autoMeasures_autoMeasures = (advancedVSeed, context)=>{
|
@@ -1170,7 +1200,10 @@ const autoDimensions_autoDimensions = (advancedVSeed, context)=>{
|
|
1170
1200
|
if (!dataset) throw new Error('dataset is required');
|
1171
1201
|
if (0 === dataset.length) return result;
|
1172
1202
|
if (dimensions) {
|
1173
|
-
result.dimensions = dimensions
|
1203
|
+
result.dimensions = dimensions.map((dim)=>({
|
1204
|
+
location: 'dimension',
|
1205
|
+
...dim
|
1206
|
+
}));
|
1174
1207
|
return result;
|
1175
1208
|
}
|
1176
1209
|
const top100dataset = dataset.slice(0, 100);
|
@@ -1196,8 +1229,10 @@ const pivotAdapter = (pipeline, pivotPipeline)=>(advancedVSeed, context)=>{
|
|
1196
1229
|
return execPipeline(pipeline, context, advancedVSeed);
|
1197
1230
|
};
|
1198
1231
|
const FoldMeasureName = '__MeaName__';
|
1199
|
-
const FoldMeasureValue = '__MeaValue__';
|
1200
1232
|
const FoldMeasureId = '__MeaId__';
|
1233
|
+
const FoldMeasureValue = '__MeaValue__';
|
1234
|
+
const FoldPrimaryMeasureValue = '__MeaPrimaryValue__';
|
1235
|
+
const FoldSecondaryMeasureValue = '__MeaSecondaryValue__';
|
1201
1236
|
const UnfoldDimensionGroup = '__DimGroup__';
|
1202
1237
|
const UnfoldDimensionGroupId = '__DimGroupID__';
|
1203
1238
|
const Separator = '-';
|
@@ -1377,6 +1412,7 @@ const reshapeTo2D1M0Name = (advancedVSeed, context)=>{
|
|
1377
1412
|
datasetReshapeInfo: [
|
1378
1413
|
{
|
1379
1414
|
id: '2D1M',
|
1415
|
+
index: 0,
|
1380
1416
|
foldInfo,
|
1381
1417
|
unfoldInfo
|
1382
1418
|
}
|
@@ -1401,7 +1437,7 @@ const pivotReshapeTo2D1M0Name = (advancedVSeed, context)=>{
|
|
1401
1437
|
const commonDimensions = dimensions.filter((dim)=>'dimension' === dim.location);
|
1402
1438
|
const newDatasets = [];
|
1403
1439
|
const datasetReshapeInfo = [];
|
1404
|
-
measureGroups.forEach((measureGroup)=>{
|
1440
|
+
measureGroups.forEach((measureGroup, index)=>{
|
1405
1441
|
const measures = measureGroup.children;
|
1406
1442
|
if (!measures) return;
|
1407
1443
|
const groupId = measureGroup.id;
|
@@ -1413,6 +1449,7 @@ const pivotReshapeTo2D1M0Name = (advancedVSeed, context)=>{
|
|
1413
1449
|
});
|
1414
1450
|
const reshapeInfo = {
|
1415
1451
|
id: groupId,
|
1452
|
+
index,
|
1416
1453
|
foldInfo,
|
1417
1454
|
unfoldInfo
|
1418
1455
|
};
|
@@ -1694,11 +1731,13 @@ const color_color = (spec, context)=>{
|
|
1694
1731
|
const { unfoldInfo } = datasetReshapeInfo[0];
|
1695
1732
|
const baseConfig = advancedVSeed.config[chartType];
|
1696
1733
|
if (!baseConfig || !baseConfig.color) return result;
|
1734
|
+
const colorItems = unfoldInfo.colorItems;
|
1735
|
+
const colorIdMap = unfoldInfo.colorIdMap;
|
1697
1736
|
const { color } = baseConfig;
|
1698
1737
|
const { colorScheme, colorMapping } = color;
|
1699
1738
|
const mappingList = [];
|
1700
1739
|
if (colorMapping) Object.entries(colorMapping).sort((a, b)=>a[0].split(Separator).length - b[0].split(Separator).length).forEach(([key, value])=>{
|
1701
|
-
const idMap = Object.entries(
|
1740
|
+
const idMap = Object.entries(colorIdMap).filter(([_, v])=>v.includes(key));
|
1702
1741
|
for (const [colorId] of idMap)mappingList.push([
|
1703
1742
|
colorId,
|
1704
1743
|
value
|
@@ -1706,7 +1745,7 @@ const color_color = (spec, context)=>{
|
|
1706
1745
|
});
|
1707
1746
|
result.color = {
|
1708
1747
|
type: 'ordinal',
|
1709
|
-
domain:
|
1748
|
+
domain: colorItems,
|
1710
1749
|
range: colorScheme,
|
1711
1750
|
specified: Object.fromEntries(mappingList)
|
1712
1751
|
};
|
@@ -3416,6 +3455,7 @@ const reshapeTo2D1M = (advancedVSeed, context)=>{
|
|
3416
3455
|
datasetReshapeInfo: [
|
3417
3456
|
{
|
3418
3457
|
id: '2D1M',
|
3458
|
+
index: 0,
|
3419
3459
|
foldInfo,
|
3420
3460
|
unfoldInfo
|
3421
3461
|
}
|
@@ -3440,7 +3480,7 @@ const pivotReshapeTo2D1M = (advancedVSeed, context)=>{
|
|
3440
3480
|
const commonDimensions = dimensions.filter((dim)=>'dimension' === dim.location);
|
3441
3481
|
const newDatasets = [];
|
3442
3482
|
const datasetReshapeInfo = [];
|
3443
|
-
measureGroups.forEach((measureGroup)=>{
|
3483
|
+
measureGroups.forEach((measureGroup, index)=>{
|
3444
3484
|
const measures = measureGroup.children;
|
3445
3485
|
if (!measures) return;
|
3446
3486
|
const groupId = measureGroup.id;
|
@@ -3452,6 +3492,7 @@ const pivotReshapeTo2D1M = (advancedVSeed, context)=>{
|
|
3452
3492
|
});
|
3453
3493
|
const reshapeInfo = {
|
3454
3494
|
id: groupId,
|
3495
|
+
index,
|
3455
3496
|
foldInfo,
|
3456
3497
|
unfoldInfo
|
3457
3498
|
};
|
@@ -4858,6 +4899,7 @@ const reshapeTo1D = (advancedVSeed, context)=>{
|
|
4858
4899
|
datasetReshapeInfo: [
|
4859
4900
|
{
|
4860
4901
|
id: '1D2M',
|
4902
|
+
index: 0,
|
4861
4903
|
foldInfo,
|
4862
4904
|
unfoldInfo
|
4863
4905
|
}
|
@@ -4879,7 +4921,7 @@ const pivotReshapeTo1D = (advancedVSeed, context)=>{
|
|
4879
4921
|
});
|
4880
4922
|
const newDatasets = [];
|
4881
4923
|
const datasetReshapeInfo = [];
|
4882
|
-
measureGroups.forEach((measureGroup)=>{
|
4924
|
+
measureGroups.forEach((measureGroup, index)=>{
|
4883
4925
|
const measures = measureGroup.children;
|
4884
4926
|
if (!measures) return;
|
4885
4927
|
const commonDimensions = dimensions.filter((dim)=>'dimension' === dim.location);
|
@@ -4892,6 +4934,7 @@ const pivotReshapeTo1D = (advancedVSeed, context)=>{
|
|
4892
4934
|
});
|
4893
4935
|
const reshapeInfo = {
|
4894
4936
|
id: groupId,
|
4937
|
+
index,
|
4895
4938
|
foldInfo,
|
4896
4939
|
unfoldInfo
|
4897
4940
|
};
|
@@ -4904,7 +4947,7 @@ const pivotReshapeTo1D = (advancedVSeed, context)=>{
|
|
4904
4947
|
datasetReshapeInfo: datasetReshapeInfo
|
4905
4948
|
};
|
4906
4949
|
};
|
4907
|
-
const
|
4950
|
+
const encodingAreaRange = (advancedVSeed)=>{
|
4908
4951
|
const result = {
|
4909
4952
|
...advancedVSeed
|
4910
4953
|
};
|
@@ -4981,7 +5024,7 @@ const areaRangeAdvancedPipeline = [
|
|
4981
5024
|
], [
|
4982
5025
|
pivotReshapeTo1D
|
4983
5026
|
]),
|
4984
|
-
|
5027
|
+
encodingAreaRange,
|
4985
5028
|
sortXBandAxis,
|
4986
5029
|
areaConfig,
|
4987
5030
|
theme_theme,
|
@@ -5303,6 +5346,7 @@ const reshapeTo1D2M = (advancedVSeed, context)=>{
|
|
5303
5346
|
datasetReshapeInfo: [
|
5304
5347
|
{
|
5305
5348
|
id: '1D2M',
|
5349
|
+
index: 0,
|
5306
5350
|
foldInfo,
|
5307
5351
|
unfoldInfo
|
5308
5352
|
}
|
@@ -5324,7 +5368,7 @@ const pivotReshapeTo1D2M = (advancedVSeed, context)=>{
|
|
5324
5368
|
});
|
5325
5369
|
const newDatasets = [];
|
5326
5370
|
const datasetReshapeInfo = [];
|
5327
|
-
measureGroups.forEach((measureGroup)=>{
|
5371
|
+
measureGroups.forEach((measureGroup, index)=>{
|
5328
5372
|
const measures = measureGroup.children;
|
5329
5373
|
if (!measures) return;
|
5330
5374
|
const commonDimensions = dimensions.filter((dim)=>'dimension' === dim.location);
|
@@ -5337,6 +5381,7 @@ const pivotReshapeTo1D2M = (advancedVSeed, context)=>{
|
|
5337
5381
|
});
|
5338
5382
|
const reshapeInfo = {
|
5339
5383
|
id: groupId,
|
5384
|
+
index,
|
5340
5385
|
foldInfo,
|
5341
5386
|
unfoldInfo
|
5342
5387
|
};
|
@@ -5516,69 +5561,7 @@ const registerScatter = ()=>{
|
|
5516
5561
|
Builder._advancedPipelineMap.scatter = scatterAdvancedPipeline;
|
5517
5562
|
Builder._specPipelineMap.scatter = scatterSpecPipeline;
|
5518
5563
|
};
|
5519
|
-
const
|
5520
|
-
dataset: [],
|
5521
|
-
foldInfo: {
|
5522
|
-
foldMap: {},
|
5523
|
-
measureId: '',
|
5524
|
-
measureName: '',
|
5525
|
-
measureValue: ''
|
5526
|
-
},
|
5527
|
-
unfoldInfo: {
|
5528
|
-
groupName: '',
|
5529
|
-
groupId: '',
|
5530
|
-
colorItems: [],
|
5531
|
-
colorIdMap: {}
|
5532
|
-
}
|
5533
|
-
};
|
5534
|
-
const dataReshapeFor1D1M = (dataset, dimensions, measures, options)=>{
|
5535
|
-
const { foldMeasureId = FoldMeasureId, foldMeasureName = FoldMeasureName, foldMeasureValue = FoldMeasureValue, unfoldDimensionGroup = UnfoldDimensionGroup, unfoldDimensionGroupId = UnfoldDimensionGroupId } = options || {};
|
5536
|
-
if (0 === dimensions.length && 0 === measures.length) return dataReshapeFor1D1M_emptyReshapeResult;
|
5537
|
-
const { dataset: foldedDataset, foldInfo } = foldMeasures(dataset, measures, foldMeasureId, foldMeasureName, foldMeasureValue);
|
5538
|
-
if (0 === dimensions.length) {
|
5539
|
-
const { dataset: finalDataset, unfoldInfo } = unfoldDimensions(foldedDataset, [
|
5540
|
-
{
|
5541
|
-
id: foldMeasureName,
|
5542
|
-
alias: i18n`指标名称`,
|
5543
|
-
location: 'dimension'
|
5544
|
-
}
|
5545
|
-
], [
|
5546
|
-
{
|
5547
|
-
id: foldMeasureValue,
|
5548
|
-
alias: i18n`指标值`
|
5549
|
-
}
|
5550
|
-
], 0, unfoldDimensionGroup, unfoldDimensionGroupId, foldMeasureId);
|
5551
|
-
return {
|
5552
|
-
dataset: finalDataset,
|
5553
|
-
foldInfo,
|
5554
|
-
unfoldInfo
|
5555
|
-
};
|
5556
|
-
}
|
5557
|
-
{
|
5558
|
-
const dims = 1 === measures.length ? [
|
5559
|
-
...dimensions
|
5560
|
-
] : [
|
5561
|
-
...dimensions,
|
5562
|
-
{
|
5563
|
-
id: foldMeasureName,
|
5564
|
-
alias: i18n`指标名称`,
|
5565
|
-
location: 'dimension'
|
5566
|
-
}
|
5567
|
-
];
|
5568
|
-
const { dataset: finalDataset, unfoldInfo } = unfoldDimensions(foldedDataset, dims, [
|
5569
|
-
{
|
5570
|
-
id: foldMeasureValue,
|
5571
|
-
alias: i18n`指标值`
|
5572
|
-
}
|
5573
|
-
], 0, unfoldDimensionGroup, unfoldDimensionGroupId, foldMeasureId);
|
5574
|
-
return {
|
5575
|
-
dataset: finalDataset,
|
5576
|
-
foldInfo,
|
5577
|
-
unfoldInfo
|
5578
|
-
};
|
5579
|
-
}
|
5580
|
-
};
|
5581
|
-
const reshapeTo1D1M = (advancedVSeed, context)=>{
|
5564
|
+
const reshapeTo2D2M = (advancedVSeed, context)=>{
|
5582
5565
|
const result = {
|
5583
5566
|
...advancedVSeed
|
5584
5567
|
};
|
@@ -5587,84 +5570,138 @@ const reshapeTo1D1M = (advancedVSeed, context)=>{
|
|
5587
5570
|
const { dimensions, measures } = advancedVSeed;
|
5588
5571
|
if (!measures || !dimensions || !dataset) return result;
|
5589
5572
|
if (0 === measures.length) throw new Error('measures can not be empty');
|
5590
|
-
|
5573
|
+
if (measures.length > 2) throw new Error('measures can not be more than 2');
|
5574
|
+
const commonDimensions = dimensions.filter((dim)=>'dimension' === dim.location);
|
5575
|
+
const datasets = [];
|
5576
|
+
const foldInfoList = [];
|
5577
|
+
const unfoldInfoList = [];
|
5578
|
+
const primaryMeasures = measures[0];
|
5579
|
+
const secondaryMeasures = measures[1] || [];
|
5580
|
+
if (primaryMeasures && primaryMeasures.children) {
|
5581
|
+
const { dataset: newDatasets, foldInfo, unfoldInfo } = dataReshapeFor2D1M(dataset, commonDimensions, primaryMeasures.children, {
|
5582
|
+
foldMeasureValue: FoldPrimaryMeasureValue
|
5583
|
+
});
|
5584
|
+
datasets.push(newDatasets);
|
5585
|
+
foldInfoList.push(foldInfo);
|
5586
|
+
unfoldInfoList.push(unfoldInfo);
|
5587
|
+
}
|
5588
|
+
if (secondaryMeasures && secondaryMeasures.children) {
|
5589
|
+
const { dataset: newDatasets, foldInfo, unfoldInfo } = dataReshapeFor2D1M(dataset, commonDimensions, secondaryMeasures.children, {
|
5590
|
+
foldMeasureValue: FoldSecondaryMeasureValue
|
5591
|
+
});
|
5592
|
+
datasets.push(newDatasets);
|
5593
|
+
foldInfoList.push(foldInfo);
|
5594
|
+
unfoldInfoList.push(unfoldInfo);
|
5595
|
+
}
|
5596
|
+
const unfoldInfo = {
|
5597
|
+
groupName: unfoldInfoList[0].groupName,
|
5598
|
+
groupId: unfoldInfoList[0].groupId,
|
5599
|
+
colorItems: unfoldInfoList.flatMap((d)=>d.colorItems),
|
5600
|
+
colorIdMap: unfoldInfoList.reduce((prev, cur)=>({
|
5601
|
+
...prev,
|
5602
|
+
...cur.colorIdMap
|
5603
|
+
}), {})
|
5604
|
+
};
|
5591
5605
|
return {
|
5592
5606
|
...result,
|
5593
|
-
dataset:
|
5607
|
+
dataset: datasets,
|
5594
5608
|
datasetReshapeInfo: [
|
5595
5609
|
{
|
5596
|
-
id: '
|
5597
|
-
|
5598
|
-
|
5610
|
+
id: '2D2M',
|
5611
|
+
index: 0,
|
5612
|
+
foldInfo: foldInfoList[0],
|
5613
|
+
foldInfoList: foldInfoList,
|
5614
|
+
unfoldInfo: unfoldInfo
|
5599
5615
|
}
|
5600
5616
|
]
|
5601
5617
|
};
|
5602
5618
|
};
|
5603
|
-
const
|
5619
|
+
const pivotReshapeTo2D2M = (advancedVSeed, context)=>{
|
5604
5620
|
const result = {
|
5605
5621
|
...advancedVSeed
|
5606
5622
|
};
|
5607
5623
|
const { vseed } = context;
|
5608
5624
|
const { dataset } = vseed;
|
5609
|
-
const { measures } = advancedVSeed;
|
5610
|
-
|
5611
|
-
|
5612
|
-
const
|
5613
|
-
if (measures) measures.forEach((measure)=>{
|
5614
|
-
if (measure.children && measure.children.length > 0) measureGroups.push(measure);
|
5615
|
-
});
|
5616
|
-
const newDatasets = [];
|
5625
|
+
const { dimensions, measures } = advancedVSeed;
|
5626
|
+
if (!measures || !dimensions || !dataset) return result;
|
5627
|
+
const commonDimensions = dimensions.filter((dim)=>'dimension' === dim.location);
|
5628
|
+
const datasetList = [];
|
5617
5629
|
const datasetReshapeInfo = [];
|
5618
|
-
|
5619
|
-
const measures = measureGroup.children;
|
5620
|
-
if (
|
5621
|
-
|
5622
|
-
const
|
5623
|
-
const
|
5624
|
-
|
5625
|
-
|
5626
|
-
|
5627
|
-
|
5628
|
-
|
5630
|
+
measures.forEach((measureGroup, index)=>{
|
5631
|
+
const measures = measureGroup.children || [];
|
5632
|
+
if (0 === measures.length) throw new Error('measures can not be empty');
|
5633
|
+
if (measures.length > 2) throw new Error('measures can not be more than 2');
|
5634
|
+
const datasets = [];
|
5635
|
+
const foldInfoList = [];
|
5636
|
+
const unfoldInfoList = [];
|
5637
|
+
const primaryMeasures = measures[0];
|
5638
|
+
const secondaryMeasures = measures[1] || measures[0];
|
5639
|
+
if (primaryMeasures && primaryMeasures.children) {
|
5640
|
+
const { dataset: newDatasets, foldInfo, unfoldInfo } = dataReshapeFor2D1M(dataset, commonDimensions, primaryMeasures.children, {
|
5641
|
+
foldMeasureValue: `${FoldPrimaryMeasureValue}${index}`
|
5642
|
+
});
|
5643
|
+
datasets.push(newDatasets);
|
5644
|
+
foldInfoList.push(foldInfo);
|
5645
|
+
unfoldInfoList.push(unfoldInfo);
|
5646
|
+
}
|
5647
|
+
if (secondaryMeasures && secondaryMeasures.children) {
|
5648
|
+
const { dataset: newDatasets, foldInfo, unfoldInfo } = dataReshapeFor2D1M(dataset, commonDimensions, secondaryMeasures.children, {
|
5649
|
+
foldMeasureValue: `${FoldSecondaryMeasureValue}${index}`
|
5650
|
+
});
|
5651
|
+
datasets.push(newDatasets);
|
5652
|
+
foldInfoList.push(foldInfo);
|
5653
|
+
unfoldInfoList.push(unfoldInfo);
|
5654
|
+
}
|
5655
|
+
datasetList.push(datasets.flat(2));
|
5656
|
+
const unfoldInfo = {
|
5657
|
+
groupName: unfoldInfoList[0].groupName,
|
5658
|
+
groupId: unfoldInfoList[0].groupId,
|
5659
|
+
colorItems: unfoldInfoList.flatMap((d)=>d.colorItems),
|
5660
|
+
colorIdMap: unfoldInfoList.reduce((prev, cur)=>({
|
5661
|
+
...prev,
|
5662
|
+
...cur.colorIdMap
|
5663
|
+
}), {})
|
5664
|
+
};
|
5629
5665
|
const reshapeInfo = {
|
5630
|
-
id:
|
5631
|
-
|
5632
|
-
|
5666
|
+
id: `2D2M-${index}`,
|
5667
|
+
index,
|
5668
|
+
foldInfo: foldInfoList[0],
|
5669
|
+
unfoldInfo: unfoldInfo,
|
5670
|
+
foldInfoList: foldInfoList
|
5633
5671
|
};
|
5634
|
-
newDatasets.push(newSubDataset);
|
5635
5672
|
datasetReshapeInfo.push(reshapeInfo);
|
5636
5673
|
});
|
5637
5674
|
return {
|
5638
5675
|
...result,
|
5639
|
-
dataset:
|
5640
|
-
datasetReshapeInfo
|
5676
|
+
dataset: datasetList,
|
5677
|
+
datasetReshapeInfo
|
5641
5678
|
};
|
5642
5679
|
};
|
5643
|
-
const
|
5680
|
+
const encodingXYY = (advancedVSeed)=>{
|
5644
5681
|
const result = {
|
5645
5682
|
...advancedVSeed
|
5646
5683
|
};
|
5647
|
-
const { datasetReshapeInfo } = advancedVSeed;
|
5648
|
-
if (!datasetReshapeInfo) return result;
|
5684
|
+
const { datasetReshapeInfo, dimensions } = advancedVSeed;
|
5685
|
+
if (!datasetReshapeInfo || !dimensions) return result;
|
5686
|
+
const xDimension = dimensions.find((item)=>'rowDimension' !== item.location && 'columnDimension' !== item.location) || dimensions[0];
|
5687
|
+
const isZeroDimension = 0 === dimensions.length;
|
5649
5688
|
const encoding = datasetReshapeInfo.reduce((prev, cur)=>{
|
5650
|
-
const {
|
5651
|
-
const
|
5652
|
-
|
5653
|
-
];
|
5654
|
-
const angle = [
|
5655
|
-
unfoldInfo.groupId
|
5689
|
+
const { foldInfoList, unfoldInfo } = cur;
|
5690
|
+
const x = [
|
5691
|
+
isZeroDimension ? foldInfoList[0].measureName : xDimension?.id
|
5656
5692
|
];
|
5693
|
+
const y = foldInfoList.map((d)=>d.measureValue);
|
5657
5694
|
const group = [
|
5658
5695
|
unfoldInfo.groupId
|
5659
5696
|
];
|
5660
5697
|
const color = [
|
5661
|
-
|
5698
|
+
foldInfoList[0].measureName
|
5662
5699
|
];
|
5663
5700
|
return [
|
5664
5701
|
...prev,
|
5665
5702
|
{
|
5666
|
-
|
5667
|
-
|
5703
|
+
x,
|
5704
|
+
y,
|
5668
5705
|
group,
|
5669
5706
|
color
|
5670
5707
|
}
|
@@ -5675,62 +5712,1069 @@ const encodingPie = (advancedVSeed)=>{
|
|
5675
5712
|
encoding
|
5676
5713
|
};
|
5677
5714
|
};
|
5678
|
-
const
|
5679
|
-
|
5680
|
-
|
5681
|
-
autoDimensions_autoDimensions,
|
5682
|
-
pivotAdapter([
|
5683
|
-
reshapeTo1D1M
|
5684
|
-
], [
|
5685
|
-
pivotReshapeTo1D1M
|
5686
|
-
]),
|
5687
|
-
encodingPie,
|
5688
|
-
pieConfig,
|
5689
|
-
theme_theme,
|
5690
|
-
annotation_annotation
|
5691
|
-
];
|
5692
|
-
const initPie = (spec, context)=>{
|
5715
|
+
const dualAxisConfig = (advancedVSeed, context)=>{
|
5716
|
+
const { vseed } = context;
|
5717
|
+
const { chartType } = vseed;
|
5693
5718
|
const result = {
|
5694
|
-
...
|
5719
|
+
...advancedVSeed
|
5695
5720
|
};
|
5696
|
-
const
|
5697
|
-
|
5698
|
-
|
5699
|
-
|
5700
|
-
|
5701
|
-
|
5702
|
-
|
5703
|
-
|
5704
|
-
|
5705
|
-
|
5706
|
-
|
5707
|
-
result.
|
5708
|
-
{
|
5709
|
-
|
5710
|
-
|
5711
|
-
];
|
5712
|
-
result.pie = {
|
5713
|
-
style: {
|
5714
|
-
stroke: '#ffffff',
|
5715
|
-
lineWidth: showStroke ? 1 : 0,
|
5716
|
-
centerOffset: 0
|
5717
|
-
},
|
5718
|
-
state: {
|
5719
|
-
hover: {
|
5720
|
-
outerRadius: 1.1 * result.outerRadius
|
5721
|
-
}
|
5721
|
+
const config = (0, external_remeda_namespaceObject.pick)(vseed, [
|
5722
|
+
'backgroundColor',
|
5723
|
+
'color',
|
5724
|
+
'label',
|
5725
|
+
'legend',
|
5726
|
+
'tooltip',
|
5727
|
+
'dualChartType',
|
5728
|
+
'primaryYAxis',
|
5729
|
+
'secondaryYAxis',
|
5730
|
+
'crosshairLine'
|
5731
|
+
]);
|
5732
|
+
result.config = {
|
5733
|
+
...result.config || {},
|
5734
|
+
[chartType]: {
|
5735
|
+
...config
|
5722
5736
|
}
|
5723
5737
|
};
|
5724
|
-
result.animation = true;
|
5725
5738
|
return result;
|
5726
5739
|
};
|
5727
|
-
const
|
5728
|
-
|
5729
|
-
|
5730
|
-
|
5731
|
-
|
5732
|
-
|
5733
|
-
|
5740
|
+
const autoDualMeasures = (advancedVSeed, context)=>{
|
5741
|
+
const result = {
|
5742
|
+
...advancedVSeed
|
5743
|
+
};
|
5744
|
+
const { vseed } = context;
|
5745
|
+
const { dataset, dualMeasures, measures } = vseed;
|
5746
|
+
if (!dataset) throw new Error('dataset is required');
|
5747
|
+
if (0 === dataset.length) return result;
|
5748
|
+
if (dualMeasures) {
|
5749
|
+
result.measures = dualMeasuresToMeasureTree(dualMeasures);
|
5750
|
+
return result;
|
5751
|
+
}
|
5752
|
+
if (measures && measureDepth(measures) > 1) {
|
5753
|
+
result.measures = measures;
|
5754
|
+
return result;
|
5755
|
+
}
|
5756
|
+
const top100dataset = dataset.slice(0, 100);
|
5757
|
+
const sample = top100dataset.reduce((prev, cur)=>({
|
5758
|
+
...prev,
|
5759
|
+
...cur
|
5760
|
+
}), {});
|
5761
|
+
const newMeasures = measures || Object.keys(sample).filter((key)=>top100dataset.some((item)=>'number' == typeof item[key]) && ![
|
5762
|
+
'',
|
5763
|
+
null,
|
5764
|
+
void 0
|
5765
|
+
].includes(key)).map((measure)=>({
|
5766
|
+
id: measure,
|
5767
|
+
alias: measure
|
5768
|
+
}));
|
5769
|
+
if (0 === newMeasures.length) result.measures = [];
|
5770
|
+
else if (1 === newMeasures.length) result.measures = [
|
5771
|
+
{
|
5772
|
+
id: 'primary',
|
5773
|
+
alias: 'primary',
|
5774
|
+
children: newMeasures
|
5775
|
+
}
|
5776
|
+
];
|
5777
|
+
else if (newMeasures.length > 1) result.measures = [
|
5778
|
+
{
|
5779
|
+
id: 'primary',
|
5780
|
+
alias: 'primary',
|
5781
|
+
children: newMeasures.slice(0, 1)
|
5782
|
+
},
|
5783
|
+
{
|
5784
|
+
id: 'secondary',
|
5785
|
+
alias: 'secondary',
|
5786
|
+
children: newMeasures.slice(1)
|
5787
|
+
}
|
5788
|
+
];
|
5789
|
+
return result;
|
5790
|
+
};
|
5791
|
+
const dualMeasuresToMeasureTree = (dualMeasures)=>{
|
5792
|
+
const measureTree = dualMeasures.map((item, index)=>{
|
5793
|
+
const { primaryMeasures, secondaryMeasures, primaryAlias, secondaryAlias } = item;
|
5794
|
+
const groupChildren = [];
|
5795
|
+
if (primaryMeasures) {
|
5796
|
+
const arrPrimaryMeasures = Array.isArray(primaryMeasures) ? primaryMeasures : [
|
5797
|
+
primaryMeasures
|
5798
|
+
];
|
5799
|
+
groupChildren.push({
|
5800
|
+
id: `${index}-primary`,
|
5801
|
+
alias: primaryAlias || arrPrimaryMeasures.map((item)=>item.alias || item.id).toString(),
|
5802
|
+
children: arrPrimaryMeasures
|
5803
|
+
});
|
5804
|
+
}
|
5805
|
+
if (secondaryMeasures) {
|
5806
|
+
const arrSecondaryMeasures = Array.isArray(secondaryMeasures) ? secondaryMeasures : [
|
5807
|
+
secondaryMeasures
|
5808
|
+
];
|
5809
|
+
groupChildren.push({
|
5810
|
+
id: `${index}-secondary`,
|
5811
|
+
alias: secondaryAlias || arrSecondaryMeasures.map((item)=>item.alias || item.id).toString(),
|
5812
|
+
children: arrSecondaryMeasures
|
5813
|
+
});
|
5814
|
+
}
|
5815
|
+
const id = [
|
5816
|
+
primaryAlias,
|
5817
|
+
secondaryAlias,
|
5818
|
+
index
|
5819
|
+
].filter((d)=>!(0, external_remeda_namespaceObject.isNullish)(d)).join('-');
|
5820
|
+
return {
|
5821
|
+
id,
|
5822
|
+
alias: id,
|
5823
|
+
children: groupChildren
|
5824
|
+
};
|
5825
|
+
});
|
5826
|
+
if (1 === dualMeasures.length) return measureTree[0].children || [];
|
5827
|
+
return measureTree;
|
5828
|
+
};
|
5829
|
+
const dualAxisAdvancedPipeline = [
|
5830
|
+
initAdvancedVSeed_initAdvancedVSeed,
|
5831
|
+
autoDualMeasures,
|
5832
|
+
autoDimensions_autoDimensions,
|
5833
|
+
pivotAdapter([
|
5834
|
+
reshapeTo2D2M
|
5835
|
+
], [
|
5836
|
+
pivotReshapeTo2D2M
|
5837
|
+
]),
|
5838
|
+
encodingXYY,
|
5839
|
+
sortXBandAxis,
|
5840
|
+
sort_sortLegend,
|
5841
|
+
dualAxisConfig,
|
5842
|
+
theme_theme,
|
5843
|
+
markStyle_markStyle,
|
5844
|
+
annotation_annotation
|
5845
|
+
];
|
5846
|
+
const initDualAxisPrimary = (spec, context)=>{
|
5847
|
+
const result = {
|
5848
|
+
...spec
|
5849
|
+
};
|
5850
|
+
const { advancedVSeed } = context;
|
5851
|
+
const { encoding, datasetReshapeInfo } = advancedVSeed;
|
5852
|
+
if (!encoding[0].y || !encoding[0].x || !encoding[0].group) return result;
|
5853
|
+
result.id = `${datasetReshapeInfo[0].id}-primary-series`;
|
5854
|
+
result.type = 'bar';
|
5855
|
+
result.direction = 'vertical';
|
5856
|
+
result.xField = encoding[0].x[0];
|
5857
|
+
result.yField = encoding[0].y[0];
|
5858
|
+
result.seriesField = encoding[0].group[0];
|
5859
|
+
result.animation = true;
|
5860
|
+
return result;
|
5861
|
+
};
|
5862
|
+
const initDualAxisSecondary = (spec, context)=>{
|
5863
|
+
const result = {
|
5864
|
+
...spec
|
5865
|
+
};
|
5866
|
+
const { advancedVSeed } = context;
|
5867
|
+
const { encoding, datasetReshapeInfo } = advancedVSeed;
|
5868
|
+
if (!encoding[0].y || !encoding[0].x || !encoding[0].group) return result;
|
5869
|
+
result.id = `${datasetReshapeInfo[0].id}-secondary-series`;
|
5870
|
+
result.type = 'line';
|
5871
|
+
result.direction = 'vertical';
|
5872
|
+
result.xField = encoding[0].x[0];
|
5873
|
+
result.yField = encoding[0].y[1];
|
5874
|
+
result.seriesField = encoding[0].group[0];
|
5875
|
+
result.animation = true;
|
5876
|
+
return result;
|
5877
|
+
};
|
5878
|
+
const dualChartTypePrimary = (spec, context)=>{
|
5879
|
+
const result = {
|
5880
|
+
...spec
|
5881
|
+
};
|
5882
|
+
const { advancedVSeed, vseed } = context;
|
5883
|
+
const { chartType } = vseed;
|
5884
|
+
const { datasetReshapeInfo } = advancedVSeed;
|
5885
|
+
const config = advancedVSeed.config?.[chartType]?.dualChartType || {
|
5886
|
+
primary: 'column',
|
5887
|
+
secondary: 'line'
|
5888
|
+
};
|
5889
|
+
if (Array.isArray(config)) return result;
|
5890
|
+
switch(config.primary){
|
5891
|
+
case 'line':
|
5892
|
+
result.type = 'line';
|
5893
|
+
break;
|
5894
|
+
case 'column':
|
5895
|
+
result.type = 'bar';
|
5896
|
+
break;
|
5897
|
+
case 'columnParallel':
|
5898
|
+
{
|
5899
|
+
const columnSpec = result;
|
5900
|
+
if (Array.isArray(columnSpec.xField)) columnSpec.xField.push(datasetReshapeInfo[0].unfoldInfo.groupId);
|
5901
|
+
else if (columnSpec.xField) columnSpec.xField = [
|
5902
|
+
columnSpec.xField,
|
5903
|
+
datasetReshapeInfo[0].unfoldInfo.groupId
|
5904
|
+
];
|
5905
|
+
columnSpec.type = 'bar';
|
5906
|
+
break;
|
5907
|
+
}
|
5908
|
+
case 'columnPercent':
|
5909
|
+
result.type = 'bar';
|
5910
|
+
result.percent = true;
|
5911
|
+
break;
|
5912
|
+
case 'area':
|
5913
|
+
result.type = 'area';
|
5914
|
+
break;
|
5915
|
+
case 'areaPercent':
|
5916
|
+
result.type = 'area';
|
5917
|
+
result.percent = true;
|
5918
|
+
break;
|
5919
|
+
case 'scatter':
|
5920
|
+
result.type = 'scatter';
|
5921
|
+
break;
|
5922
|
+
default:
|
5923
|
+
result.type = config.primary;
|
5924
|
+
}
|
5925
|
+
return result;
|
5926
|
+
};
|
5927
|
+
const dualChartTypeSecondary = (spec, context)=>{
|
5928
|
+
const result = {
|
5929
|
+
...spec
|
5930
|
+
};
|
5931
|
+
const { advancedVSeed, vseed } = context;
|
5932
|
+
const { chartType } = vseed;
|
5933
|
+
const { datasetReshapeInfo } = advancedVSeed;
|
5934
|
+
const config = advancedVSeed.config?.[chartType]?.dualChartType || {
|
5935
|
+
primary: 'column',
|
5936
|
+
secondary: 'line'
|
5937
|
+
};
|
5938
|
+
if (Array.isArray(config)) return result;
|
5939
|
+
switch(config.secondary){
|
5940
|
+
case 'line':
|
5941
|
+
result.type = 'line';
|
5942
|
+
break;
|
5943
|
+
case 'column':
|
5944
|
+
result.type = 'bar';
|
5945
|
+
break;
|
5946
|
+
case 'columnParallel':
|
5947
|
+
{
|
5948
|
+
const columnSpec = result;
|
5949
|
+
if (Array.isArray(columnSpec.xField)) columnSpec.xField.push(datasetReshapeInfo[0].unfoldInfo.groupId);
|
5950
|
+
else if (columnSpec.xField) columnSpec.xField = [
|
5951
|
+
columnSpec.xField,
|
5952
|
+
datasetReshapeInfo[0].unfoldInfo.groupId
|
5953
|
+
];
|
5954
|
+
columnSpec.type = 'bar';
|
5955
|
+
break;
|
5956
|
+
}
|
5957
|
+
case 'columnPercent':
|
5958
|
+
result.type = 'bar';
|
5959
|
+
result.percent = true;
|
5960
|
+
break;
|
5961
|
+
case 'area':
|
5962
|
+
result.type = 'area';
|
5963
|
+
break;
|
5964
|
+
case 'areaPercent':
|
5965
|
+
result.type = 'area';
|
5966
|
+
result.percent = true;
|
5967
|
+
break;
|
5968
|
+
case 'scatter':
|
5969
|
+
result.type = 'scatter';
|
5970
|
+
break;
|
5971
|
+
default:
|
5972
|
+
result.type = config.secondary;
|
5973
|
+
}
|
5974
|
+
return result;
|
5975
|
+
};
|
5976
|
+
const datasetPrimary = (spec, context)=>{
|
5977
|
+
const { advancedVSeed, vseed } = context;
|
5978
|
+
const { encoding, analysis, datasetReshapeInfo } = advancedVSeed;
|
5979
|
+
const { orderMapping = {} } = analysis ?? {};
|
5980
|
+
const x = encoding[0]?.x?.[0];
|
5981
|
+
const group = encoding[0]?.group?.[0];
|
5982
|
+
const id = datasetReshapeInfo[0].id;
|
5983
|
+
const fields = {};
|
5984
|
+
if (x) {
|
5985
|
+
const order = orderMapping[x];
|
5986
|
+
if (order) fields[x] = {
|
5987
|
+
sortIndex: 0,
|
5988
|
+
domain: order,
|
5989
|
+
lockStatisticsByDomain: true
|
5990
|
+
};
|
5991
|
+
else fields[x] = {
|
5992
|
+
sortIndex: 0
|
5993
|
+
};
|
5994
|
+
}
|
5995
|
+
if (group) {
|
5996
|
+
const order = orderMapping[group];
|
5997
|
+
if (order) fields[group] = {
|
5998
|
+
sortIndex: 0,
|
5999
|
+
domain: order,
|
6000
|
+
lockStatisticsByDomain: true
|
6001
|
+
};
|
6002
|
+
else fields[group] = {
|
6003
|
+
sortIndex: 0
|
6004
|
+
};
|
6005
|
+
}
|
6006
|
+
return {
|
6007
|
+
...spec,
|
6008
|
+
data: {
|
6009
|
+
id: `${id}-primary-dataset`,
|
6010
|
+
values: isPivotChart(vseed) ? void 0 : advancedVSeed.dataset[0],
|
6011
|
+
fields: fields
|
6012
|
+
}
|
6013
|
+
};
|
6014
|
+
};
|
6015
|
+
const datasetSecondary = (spec, context)=>{
|
6016
|
+
const { advancedVSeed, vseed } = context;
|
6017
|
+
const { encoding, analysis, datasetReshapeInfo } = advancedVSeed;
|
6018
|
+
const { orderMapping = {} } = analysis ?? {};
|
6019
|
+
const x = encoding[0]?.x?.[0];
|
6020
|
+
const group = encoding[0]?.group?.[0];
|
6021
|
+
const id = datasetReshapeInfo[0].id;
|
6022
|
+
const fields = {};
|
6023
|
+
if (x) {
|
6024
|
+
const order = orderMapping[x];
|
6025
|
+
if (order) fields[x] = {
|
6026
|
+
sortIndex: 0,
|
6027
|
+
domain: order,
|
6028
|
+
lockStatisticsByDomain: true
|
6029
|
+
};
|
6030
|
+
else fields[x] = {
|
6031
|
+
sortIndex: 0
|
6032
|
+
};
|
6033
|
+
}
|
6034
|
+
if (group) {
|
6035
|
+
const order = orderMapping[group];
|
6036
|
+
if (order) fields[group] = {
|
6037
|
+
sortIndex: 0,
|
6038
|
+
domain: order,
|
6039
|
+
lockStatisticsByDomain: true
|
6040
|
+
};
|
6041
|
+
else fields[group] = {
|
6042
|
+
sortIndex: 0
|
6043
|
+
};
|
6044
|
+
}
|
6045
|
+
return {
|
6046
|
+
...spec,
|
6047
|
+
data: {
|
6048
|
+
id: `${id}-secondary-dataset`,
|
6049
|
+
values: isPivotChart(vseed) ? void 0 : advancedVSeed.dataset[1],
|
6050
|
+
fields: fields
|
6051
|
+
}
|
6052
|
+
};
|
6053
|
+
};
|
6054
|
+
const labelPrimary = (spec, context)=>{
|
6055
|
+
const result = {
|
6056
|
+
...spec
|
6057
|
+
};
|
6058
|
+
const { advancedVSeed } = context;
|
6059
|
+
const { measures, datasetReshapeInfo, locale } = advancedVSeed;
|
6060
|
+
const { chartType } = advancedVSeed;
|
6061
|
+
const baseConfig = advancedVSeed.config[chartType];
|
6062
|
+
if (!baseConfig || !baseConfig.label) return result;
|
6063
|
+
const foldInfoList = datasetReshapeInfo[0].foldInfoList;
|
6064
|
+
const { measureId, measureValue } = foldInfoList[0];
|
6065
|
+
const { label } = baseConfig;
|
6066
|
+
const { enable } = label;
|
6067
|
+
result.label = {
|
6068
|
+
visible: enable,
|
6069
|
+
formatMethod: (value, datum)=>{
|
6070
|
+
const result = [];
|
6071
|
+
const formatValue = (value)=>{
|
6072
|
+
const id = datum[measureId];
|
6073
|
+
const measure = findMeasureById(measures, id);
|
6074
|
+
if (!measure) return value;
|
6075
|
+
const { format = {}, autoFormat = true } = measure;
|
6076
|
+
if (!(0, external_remeda_namespaceObject.isEmpty)(format)) {
|
6077
|
+
const formatter = createFormatter(format);
|
6078
|
+
return formatter(value);
|
6079
|
+
}
|
6080
|
+
if (autoFormat) return autoFormatter(value, locale);
|
6081
|
+
return String(value);
|
6082
|
+
};
|
6083
|
+
result.push(formatValue(datum[measureValue]));
|
6084
|
+
return result.join(' ');
|
6085
|
+
}
|
6086
|
+
};
|
6087
|
+
return result;
|
6088
|
+
};
|
6089
|
+
const labelSecondary = (spec, context)=>{
|
6090
|
+
const result = {
|
6091
|
+
...spec
|
6092
|
+
};
|
6093
|
+
const { advancedVSeed } = context;
|
6094
|
+
const { measures, datasetReshapeInfo, locale } = advancedVSeed;
|
6095
|
+
const { chartType } = advancedVSeed;
|
6096
|
+
const baseConfig = advancedVSeed.config[chartType];
|
6097
|
+
if (!baseConfig || !baseConfig.label) return result;
|
6098
|
+
if ((0, external_remeda_namespaceObject.isNullish)(datasetReshapeInfo[0].foldInfoList?.[1])) return result;
|
6099
|
+
const foldInfoList = datasetReshapeInfo[0].foldInfoList;
|
6100
|
+
const { measureId, measureValue } = foldInfoList[1];
|
6101
|
+
const { label } = baseConfig;
|
6102
|
+
const { enable } = label;
|
6103
|
+
result.label = {
|
6104
|
+
visible: enable,
|
6105
|
+
formatMethod: (value, datum)=>{
|
6106
|
+
const result = [];
|
6107
|
+
const formatValue = (value)=>{
|
6108
|
+
const id = datum[measureId];
|
6109
|
+
const measure = findMeasureById(measures, id);
|
6110
|
+
if (!measure) return value;
|
6111
|
+
const { format = {}, autoFormat = true } = measure;
|
6112
|
+
if (!(0, external_remeda_namespaceObject.isEmpty)(format)) {
|
6113
|
+
const formatter = createFormatter(format);
|
6114
|
+
return formatter(value);
|
6115
|
+
}
|
6116
|
+
if (autoFormat) return autoFormatter(value, locale);
|
6117
|
+
return String(value);
|
6118
|
+
};
|
6119
|
+
result.push(formatValue(datum[measureValue]));
|
6120
|
+
return result.join(' ');
|
6121
|
+
}
|
6122
|
+
};
|
6123
|
+
return result;
|
6124
|
+
};
|
6125
|
+
const tooltipPrimary = (spec, context)=>{
|
6126
|
+
const result = {
|
6127
|
+
...spec
|
6128
|
+
};
|
6129
|
+
const { advancedVSeed } = context;
|
6130
|
+
const { measures, datasetReshapeInfo, chartType, locale, dimensions } = advancedVSeed;
|
6131
|
+
const baseConfig = advancedVSeed.config[chartType];
|
6132
|
+
const { tooltip = {
|
6133
|
+
enable: true
|
6134
|
+
} } = baseConfig;
|
6135
|
+
const { enable } = tooltip;
|
6136
|
+
const foldInfoList = datasetReshapeInfo[0].foldInfoList;
|
6137
|
+
const unfoldInfo = datasetReshapeInfo[0].unfoldInfo;
|
6138
|
+
const { measureId, measureValue, measureName } = foldInfoList[0];
|
6139
|
+
const { groupName } = unfoldInfo;
|
6140
|
+
result.tooltip = {
|
6141
|
+
visible: enable,
|
6142
|
+
mark: {
|
6143
|
+
title: {
|
6144
|
+
visible: true
|
6145
|
+
},
|
6146
|
+
content: [
|
6147
|
+
...dimensions.map((item)=>({
|
6148
|
+
visible: true,
|
6149
|
+
hasShape: true,
|
6150
|
+
shapeType: 'rectRound',
|
6151
|
+
key: (datum)=>{
|
6152
|
+
if (item.alias || item.id) return item.alias || item.id;
|
6153
|
+
return datum && datum[item.id];
|
6154
|
+
},
|
6155
|
+
value: (datum)=>datum && datum[item.id]
|
6156
|
+
})),
|
6157
|
+
{
|
6158
|
+
visible: true,
|
6159
|
+
hasShape: true,
|
6160
|
+
key: (datum)=>datum && datum[measureName || groupName] || '',
|
6161
|
+
value: (datum)=>{
|
6162
|
+
if (!datum) return '';
|
6163
|
+
const value = datum[measureValue];
|
6164
|
+
const id = datum[measureId];
|
6165
|
+
const measure = findMeasureById(measures, id);
|
6166
|
+
if (!measure) return String(value);
|
6167
|
+
const { format = {}, autoFormat = true } = measure;
|
6168
|
+
if (!(0, external_remeda_namespaceObject.isEmpty)(format)) {
|
6169
|
+
const formatter = createFormatter(format);
|
6170
|
+
return formatter(value);
|
6171
|
+
}
|
6172
|
+
if (autoFormat) return autoFormatter(value, locale);
|
6173
|
+
return String(value);
|
6174
|
+
}
|
6175
|
+
}
|
6176
|
+
]
|
6177
|
+
},
|
6178
|
+
dimension: {
|
6179
|
+
content: [
|
6180
|
+
{
|
6181
|
+
visible: true,
|
6182
|
+
key: (datum)=>datum && datum[groupName] || '',
|
6183
|
+
value: (datum)=>{
|
6184
|
+
if (!datum) return '';
|
6185
|
+
const value = datum[measureValue];
|
6186
|
+
const id = datum[measureId];
|
6187
|
+
const measure = findMeasureById(measures, id);
|
6188
|
+
if (!measure) return String(value);
|
6189
|
+
const { format = {}, autoFormat = true } = measure;
|
6190
|
+
if (!(0, external_remeda_namespaceObject.isEmpty)(format)) {
|
6191
|
+
const formatter = createFormatter(format);
|
6192
|
+
return formatter(value);
|
6193
|
+
}
|
6194
|
+
if (autoFormat) return autoFormatter(value, locale);
|
6195
|
+
return String(value);
|
6196
|
+
},
|
6197
|
+
shapeType: 'rectRound'
|
6198
|
+
}
|
6199
|
+
]
|
6200
|
+
}
|
6201
|
+
};
|
6202
|
+
return result;
|
6203
|
+
};
|
6204
|
+
const tooltipSecondary = (spec, context)=>{
|
6205
|
+
const result = {
|
6206
|
+
...spec
|
6207
|
+
};
|
6208
|
+
const { advancedVSeed } = context;
|
6209
|
+
const { measures, datasetReshapeInfo, chartType, locale, dimensions } = advancedVSeed;
|
6210
|
+
const baseConfig = advancedVSeed.config[chartType];
|
6211
|
+
const { tooltip = {
|
6212
|
+
enable: true
|
6213
|
+
} } = baseConfig;
|
6214
|
+
const { enable } = tooltip;
|
6215
|
+
if ((0, external_remeda_namespaceObject.isNullish)(datasetReshapeInfo[0].foldInfoList?.[1])) return result;
|
6216
|
+
const foldInfoList = datasetReshapeInfo[0].foldInfoList;
|
6217
|
+
const unfoldInfo = datasetReshapeInfo[0].unfoldInfo;
|
6218
|
+
const { measureId, measureValue, measureName } = foldInfoList[1];
|
6219
|
+
const { groupName } = unfoldInfo;
|
6220
|
+
result.tooltip = {
|
6221
|
+
visible: enable,
|
6222
|
+
mark: {
|
6223
|
+
title: {
|
6224
|
+
visible: true
|
6225
|
+
},
|
6226
|
+
content: [
|
6227
|
+
...dimensions.map((item)=>({
|
6228
|
+
visible: true,
|
6229
|
+
hasShape: true,
|
6230
|
+
shapeType: 'rectRound',
|
6231
|
+
key: (datum)=>{
|
6232
|
+
if (item.alias || item.id) return item.alias || item.id;
|
6233
|
+
return datum && datum[item.id];
|
6234
|
+
},
|
6235
|
+
value: (datum)=>datum && datum[item.id]
|
6236
|
+
})),
|
6237
|
+
{
|
6238
|
+
visible: true,
|
6239
|
+
hasShape: true,
|
6240
|
+
key: (datum)=>datum && datum[measureName || groupName] || '',
|
6241
|
+
value: (datum)=>{
|
6242
|
+
if (!datum) return '';
|
6243
|
+
const value = datum[measureValue];
|
6244
|
+
const id = datum[measureId];
|
6245
|
+
const measure = findMeasureById(measures, id);
|
6246
|
+
if (!measure) return String(value);
|
6247
|
+
const { format = {}, autoFormat = true } = measure;
|
6248
|
+
if (!(0, external_remeda_namespaceObject.isEmpty)(format)) {
|
6249
|
+
const formatter = createFormatter(format);
|
6250
|
+
return formatter(value);
|
6251
|
+
}
|
6252
|
+
if (autoFormat) return autoFormatter(value, locale);
|
6253
|
+
return String(value);
|
6254
|
+
}
|
6255
|
+
}
|
6256
|
+
]
|
6257
|
+
},
|
6258
|
+
dimension: {
|
6259
|
+
content: [
|
6260
|
+
{
|
6261
|
+
visible: true,
|
6262
|
+
key: (datum)=>datum && datum[groupName] || '',
|
6263
|
+
value: (datum)=>{
|
6264
|
+
if (!datum) return '';
|
6265
|
+
const value = datum[measureValue];
|
6266
|
+
const id = datum[measureId];
|
6267
|
+
const measure = findMeasureById(measures, id);
|
6268
|
+
if (!measure) return String(value);
|
6269
|
+
const { format = {}, autoFormat = true } = measure;
|
6270
|
+
if (!(0, external_remeda_namespaceObject.isEmpty)(format)) {
|
6271
|
+
const formatter = createFormatter(format);
|
6272
|
+
return formatter(value);
|
6273
|
+
}
|
6274
|
+
if (autoFormat) return autoFormatter(value, locale);
|
6275
|
+
return String(value);
|
6276
|
+
},
|
6277
|
+
shapeType: 'rectRound'
|
6278
|
+
}
|
6279
|
+
]
|
6280
|
+
}
|
6281
|
+
};
|
6282
|
+
return result;
|
6283
|
+
};
|
6284
|
+
const yLinearPrimary = (spec, context)=>{
|
6285
|
+
const result = {
|
6286
|
+
...spec
|
6287
|
+
};
|
6288
|
+
const { advancedVSeed, vseed } = context;
|
6289
|
+
const { chartType } = vseed;
|
6290
|
+
const { locale, datasetReshapeInfo } = advancedVSeed;
|
6291
|
+
const config = advancedVSeed.config?.[chartType]?.primaryYAxis;
|
6292
|
+
if (datasetReshapeInfo[0].foldInfoList?.[0] && (0, external_remeda_namespaceObject.isEmpty)(datasetReshapeInfo[0].foldInfoList[0].foldMap)) return result;
|
6293
|
+
const id = `${datasetReshapeInfo[0].id}-primary-axis`;
|
6294
|
+
const seriesId = `${datasetReshapeInfo[0].id}-primary-series`;
|
6295
|
+
if (!result.axes) result.axes = [];
|
6296
|
+
if (!config) {
|
6297
|
+
result.axes = [
|
6298
|
+
...result.axes,
|
6299
|
+
{
|
6300
|
+
visible: true,
|
6301
|
+
id,
|
6302
|
+
seriesId,
|
6303
|
+
type: 'linear',
|
6304
|
+
orient: 'left',
|
6305
|
+
sync: {
|
6306
|
+
axisId: `${datasetReshapeInfo[0].id}-secondary-axis`,
|
6307
|
+
tickAlign: false,
|
6308
|
+
zeroAlign: true
|
6309
|
+
}
|
6310
|
+
}
|
6311
|
+
];
|
6312
|
+
return result;
|
6313
|
+
}
|
6314
|
+
const { visible = true, label, tick, title, grid, line, zero, nice, inverse, max, min, log, logBase = 10 } = config;
|
6315
|
+
const linearAxis = {
|
6316
|
+
visible,
|
6317
|
+
id,
|
6318
|
+
seriesId,
|
6319
|
+
sync: {
|
6320
|
+
axisId: `${datasetReshapeInfo[0].id}-secondary-axis`,
|
6321
|
+
tickAlign: false,
|
6322
|
+
zeroAlign: true
|
6323
|
+
},
|
6324
|
+
type: log ? 'log' : 'linear',
|
6325
|
+
base: logBase,
|
6326
|
+
orient: 'left',
|
6327
|
+
nice,
|
6328
|
+
zero: log ? false : zero,
|
6329
|
+
inverse,
|
6330
|
+
max,
|
6331
|
+
min,
|
6332
|
+
label: {
|
6333
|
+
visible: label?.visible,
|
6334
|
+
formatMethod: (value)=>autoFormatter(value, locale),
|
6335
|
+
style: {
|
6336
|
+
fill: label?.labelColor,
|
6337
|
+
angle: label?.labelAngle,
|
6338
|
+
fontSize: label?.labelFontSize,
|
6339
|
+
fontWeight: label?.labelFontWeight
|
6340
|
+
}
|
6341
|
+
},
|
6342
|
+
title: {
|
6343
|
+
visible: title?.visible,
|
6344
|
+
text: title?.titleText,
|
6345
|
+
style: {
|
6346
|
+
fill: title?.titleColor,
|
6347
|
+
fontSize: title?.titleFontSize,
|
6348
|
+
fontWeight: title?.titleFontWeight
|
6349
|
+
}
|
6350
|
+
},
|
6351
|
+
tick: {
|
6352
|
+
visible: tick?.visible,
|
6353
|
+
tickSize: tick?.tickSize,
|
6354
|
+
inside: tick?.tickInside,
|
6355
|
+
style: {
|
6356
|
+
stroke: tick?.tickColor
|
6357
|
+
}
|
6358
|
+
},
|
6359
|
+
grid: {
|
6360
|
+
visible: grid?.visible,
|
6361
|
+
style: {
|
6362
|
+
lineWidth: grid?.gridWidth,
|
6363
|
+
stroke: grid?.gridColor
|
6364
|
+
}
|
6365
|
+
},
|
6366
|
+
domainLine: {
|
6367
|
+
visible: line?.visible,
|
6368
|
+
style: {
|
6369
|
+
lineWidth: line?.lineWidth,
|
6370
|
+
stroke: line?.lineColor
|
6371
|
+
}
|
6372
|
+
},
|
6373
|
+
innerOffset: {
|
6374
|
+
top: LINEAR_AXIS_INNER_OFFSET_TOP
|
6375
|
+
}
|
6376
|
+
};
|
6377
|
+
result.axes = [
|
6378
|
+
...result.axes,
|
6379
|
+
linearAxis
|
6380
|
+
];
|
6381
|
+
return result;
|
6382
|
+
};
|
6383
|
+
const yLinearSecondary = (spec, context)=>{
|
6384
|
+
const result = {
|
6385
|
+
...spec
|
6386
|
+
};
|
6387
|
+
const { advancedVSeed, vseed } = context;
|
6388
|
+
const { chartType } = vseed;
|
6389
|
+
const { locale, datasetReshapeInfo } = advancedVSeed;
|
6390
|
+
const config = advancedVSeed.config?.[chartType]?.secondaryYAxis;
|
6391
|
+
if ((0, external_remeda_namespaceObject.isNullish)(datasetReshapeInfo[0].foldInfoList?.[1])) return result;
|
6392
|
+
const id = `${datasetReshapeInfo[0].id}-secondary-axis`;
|
6393
|
+
const seriesId = `${datasetReshapeInfo[0].id}-secondary-series`;
|
6394
|
+
if (!result.axes) result.axes = [];
|
6395
|
+
if (!config) {
|
6396
|
+
result.axes = [
|
6397
|
+
...result.axes,
|
6398
|
+
{
|
6399
|
+
visible: true,
|
6400
|
+
id,
|
6401
|
+
seriesId,
|
6402
|
+
type: 'linear',
|
6403
|
+
orient: 'right'
|
6404
|
+
}
|
6405
|
+
];
|
6406
|
+
return result;
|
6407
|
+
}
|
6408
|
+
const { visible = true, label, tick, title, grid, line, zero, nice, inverse, max, min, log, logBase = 10 } = config;
|
6409
|
+
const linearAxis = {
|
6410
|
+
visible,
|
6411
|
+
id,
|
6412
|
+
seriesId,
|
6413
|
+
type: log ? 'log' : 'linear',
|
6414
|
+
base: logBase,
|
6415
|
+
orient: 'right',
|
6416
|
+
nice,
|
6417
|
+
zero: log ? false : zero,
|
6418
|
+
inverse,
|
6419
|
+
max,
|
6420
|
+
min,
|
6421
|
+
label: {
|
6422
|
+
visible: label?.visible,
|
6423
|
+
formatMethod: (value)=>autoFormatter(value, locale),
|
6424
|
+
style: {
|
6425
|
+
fill: label?.labelColor,
|
6426
|
+
angle: label?.labelAngle,
|
6427
|
+
fontSize: label?.labelFontSize,
|
6428
|
+
fontWeight: label?.labelFontWeight
|
6429
|
+
}
|
6430
|
+
},
|
6431
|
+
title: {
|
6432
|
+
visible: title?.visible,
|
6433
|
+
text: title?.titleText,
|
6434
|
+
style: {
|
6435
|
+
fill: title?.titleColor,
|
6436
|
+
fontSize: title?.titleFontSize,
|
6437
|
+
fontWeight: title?.titleFontWeight
|
6438
|
+
}
|
6439
|
+
},
|
6440
|
+
tick: {
|
6441
|
+
visible: tick?.visible,
|
6442
|
+
tickSize: tick?.tickSize,
|
6443
|
+
inside: tick?.tickInside,
|
6444
|
+
style: {
|
6445
|
+
stroke: tick?.tickColor
|
6446
|
+
}
|
6447
|
+
},
|
6448
|
+
grid: {
|
6449
|
+
visible: grid?.visible,
|
6450
|
+
style: {
|
6451
|
+
lineWidth: grid?.gridWidth,
|
6452
|
+
stroke: grid?.gridColor
|
6453
|
+
}
|
6454
|
+
},
|
6455
|
+
domainLine: {
|
6456
|
+
visible: line?.visible,
|
6457
|
+
style: {
|
6458
|
+
lineWidth: line?.lineWidth,
|
6459
|
+
stroke: line?.lineColor
|
6460
|
+
}
|
6461
|
+
},
|
6462
|
+
innerOffset: {
|
6463
|
+
top: LINEAR_AXIS_INNER_OFFSET_TOP
|
6464
|
+
}
|
6465
|
+
};
|
6466
|
+
result.axes = [
|
6467
|
+
...result.axes,
|
6468
|
+
linearAxis
|
6469
|
+
];
|
6470
|
+
return result;
|
6471
|
+
};
|
6472
|
+
const dualAxis = [
|
6473
|
+
series([
|
6474
|
+
initDualAxisPrimary,
|
6475
|
+
dualChartTypePrimary,
|
6476
|
+
datasetPrimary,
|
6477
|
+
labelPrimary,
|
6478
|
+
tooltipPrimary,
|
6479
|
+
progressive,
|
6480
|
+
barStyle_barStyle,
|
6481
|
+
pointStyle_pointStyle,
|
6482
|
+
pointStateDimensionHover,
|
6483
|
+
lineStyle_lineStyle,
|
6484
|
+
areaStyle_areaStyle
|
6485
|
+
], [
|
6486
|
+
initDualAxisSecondary,
|
6487
|
+
dualChartTypeSecondary,
|
6488
|
+
datasetSecondary,
|
6489
|
+
labelSecondary,
|
6490
|
+
tooltipSecondary,
|
6491
|
+
progressive,
|
6492
|
+
barStyle_barStyle,
|
6493
|
+
pointStyle_pointStyle,
|
6494
|
+
pointStateDimensionHover,
|
6495
|
+
lineStyle_lineStyle,
|
6496
|
+
areaStyle_areaStyle
|
6497
|
+
]),
|
6498
|
+
xBand,
|
6499
|
+
yLinearPrimary,
|
6500
|
+
yLinearSecondary,
|
6501
|
+
color_color,
|
6502
|
+
background_backgroundColor,
|
6503
|
+
discreteLegend,
|
6504
|
+
verticalCrosshairRect,
|
6505
|
+
annotationPoint_annotationPoint,
|
6506
|
+
annotationVerticalLine_annotationVerticalLine,
|
6507
|
+
annotationHorizontalLine_annotationHorizontalLine,
|
6508
|
+
annotationArea_annotationArea
|
6509
|
+
];
|
6510
|
+
const pivotDualAxis = [
|
6511
|
+
initPivot,
|
6512
|
+
pivotGridStyle,
|
6513
|
+
pivotIndicators_pivotIndicatorsAsRow,
|
6514
|
+
datasetPivot,
|
6515
|
+
pivotIndicators_pivotIndicators([
|
6516
|
+
series([
|
6517
|
+
initDualAxisPrimary,
|
6518
|
+
datasetPrimary,
|
6519
|
+
labelPrimary,
|
6520
|
+
tooltipPrimary,
|
6521
|
+
progressive,
|
6522
|
+
barStyle_barStyle,
|
6523
|
+
pointStyle_pointStyle,
|
6524
|
+
pointStateDimensionHover,
|
6525
|
+
lineStyle_lineStyle,
|
6526
|
+
areaStyle_areaStyle
|
6527
|
+
], [
|
6528
|
+
initDualAxisSecondary,
|
6529
|
+
datasetSecondary,
|
6530
|
+
labelSecondary,
|
6531
|
+
tooltipSecondary,
|
6532
|
+
progressive,
|
6533
|
+
barStyle_barStyle,
|
6534
|
+
pointStyle_pointStyle,
|
6535
|
+
pointStateDimensionHover,
|
6536
|
+
lineStyle_lineStyle,
|
6537
|
+
areaStyle_areaStyle
|
6538
|
+
]),
|
6539
|
+
xBand,
|
6540
|
+
yLinearPrimary,
|
6541
|
+
yLinearSecondary,
|
6542
|
+
color_color,
|
6543
|
+
background_backgroundColor,
|
6544
|
+
verticalCrosshairRect,
|
6545
|
+
annotationPoint_annotationPoint,
|
6546
|
+
annotationVerticalLine_annotationVerticalLine,
|
6547
|
+
annotationHorizontalLine_annotationHorizontalLine,
|
6548
|
+
annotationArea_annotationArea
|
6549
|
+
]),
|
6550
|
+
pivotRowDimensions,
|
6551
|
+
pivotColumnDimensions,
|
6552
|
+
pivotDiscreteLegend
|
6553
|
+
];
|
6554
|
+
const dualAxisSpecPipeline = [
|
6555
|
+
pivotAdapter_pivotAdapter(dualAxis, pivotDualAxis)
|
6556
|
+
];
|
6557
|
+
const registerDualAxis = ()=>{
|
6558
|
+
Builder._advancedPipelineMap.dualAxis = dualAxisAdvancedPipeline;
|
6559
|
+
Builder._specPipelineMap.dualAxis = dualAxisSpecPipeline;
|
6560
|
+
};
|
6561
|
+
const dataReshapeFor1D1M_emptyReshapeResult = {
|
6562
|
+
dataset: [],
|
6563
|
+
foldInfo: {
|
6564
|
+
foldMap: {},
|
6565
|
+
measureId: '',
|
6566
|
+
measureName: '',
|
6567
|
+
measureValue: ''
|
6568
|
+
},
|
6569
|
+
unfoldInfo: {
|
6570
|
+
groupName: '',
|
6571
|
+
groupId: '',
|
6572
|
+
colorItems: [],
|
6573
|
+
colorIdMap: {}
|
6574
|
+
}
|
6575
|
+
};
|
6576
|
+
const dataReshapeFor1D1M = (dataset, dimensions, measures, options)=>{
|
6577
|
+
const { foldMeasureId = FoldMeasureId, foldMeasureName = FoldMeasureName, foldMeasureValue = FoldMeasureValue, unfoldDimensionGroup = UnfoldDimensionGroup, unfoldDimensionGroupId = UnfoldDimensionGroupId } = options || {};
|
6578
|
+
if (0 === dimensions.length && 0 === measures.length) return dataReshapeFor1D1M_emptyReshapeResult;
|
6579
|
+
const { dataset: foldedDataset, foldInfo } = foldMeasures(dataset, measures, foldMeasureId, foldMeasureName, foldMeasureValue);
|
6580
|
+
if (0 === dimensions.length) {
|
6581
|
+
const { dataset: finalDataset, unfoldInfo } = unfoldDimensions(foldedDataset, [
|
6582
|
+
{
|
6583
|
+
id: foldMeasureName,
|
6584
|
+
alias: i18n`指标名称`,
|
6585
|
+
location: 'dimension'
|
6586
|
+
}
|
6587
|
+
], [
|
6588
|
+
{
|
6589
|
+
id: foldMeasureValue,
|
6590
|
+
alias: i18n`指标值`
|
6591
|
+
}
|
6592
|
+
], 0, unfoldDimensionGroup, unfoldDimensionGroupId, foldMeasureId);
|
6593
|
+
return {
|
6594
|
+
dataset: finalDataset,
|
6595
|
+
foldInfo,
|
6596
|
+
unfoldInfo
|
6597
|
+
};
|
6598
|
+
}
|
6599
|
+
{
|
6600
|
+
const dims = 1 === measures.length ? [
|
6601
|
+
...dimensions
|
6602
|
+
] : [
|
6603
|
+
...dimensions,
|
6604
|
+
{
|
6605
|
+
id: foldMeasureName,
|
6606
|
+
alias: i18n`指标名称`,
|
6607
|
+
location: 'dimension'
|
6608
|
+
}
|
6609
|
+
];
|
6610
|
+
const { dataset: finalDataset, unfoldInfo } = unfoldDimensions(foldedDataset, dims, [
|
6611
|
+
{
|
6612
|
+
id: foldMeasureValue,
|
6613
|
+
alias: i18n`指标值`
|
6614
|
+
}
|
6615
|
+
], 0, unfoldDimensionGroup, unfoldDimensionGroupId, foldMeasureId);
|
6616
|
+
return {
|
6617
|
+
dataset: finalDataset,
|
6618
|
+
foldInfo,
|
6619
|
+
unfoldInfo
|
6620
|
+
};
|
6621
|
+
}
|
6622
|
+
};
|
6623
|
+
const reshapeTo1D1M = (advancedVSeed, context)=>{
|
6624
|
+
const result = {
|
6625
|
+
...advancedVSeed
|
6626
|
+
};
|
6627
|
+
const { vseed } = context;
|
6628
|
+
const { dataset } = vseed;
|
6629
|
+
const { dimensions, measures } = advancedVSeed;
|
6630
|
+
if (!measures || !dimensions || !dataset) return result;
|
6631
|
+
if (0 === measures.length) throw new Error('measures can not be empty');
|
6632
|
+
const { dataset: newDatasets, foldInfo, unfoldInfo } = dataReshapeFor1D1M(dataset, dimensions, measures);
|
6633
|
+
return {
|
6634
|
+
...result,
|
6635
|
+
dataset: newDatasets,
|
6636
|
+
datasetReshapeInfo: [
|
6637
|
+
{
|
6638
|
+
id: '1D1M',
|
6639
|
+
index: 0,
|
6640
|
+
foldInfo,
|
6641
|
+
unfoldInfo
|
6642
|
+
}
|
6643
|
+
]
|
6644
|
+
};
|
6645
|
+
};
|
6646
|
+
const pivotReshapeTo1D1M = (advancedVSeed, context)=>{
|
6647
|
+
const result = {
|
6648
|
+
...advancedVSeed
|
6649
|
+
};
|
6650
|
+
const { vseed } = context;
|
6651
|
+
const { dataset } = vseed;
|
6652
|
+
const { measures } = advancedVSeed;
|
6653
|
+
const dimensions = advancedVSeed.dimensions;
|
6654
|
+
if (!measures || !dimensions) return result;
|
6655
|
+
const measureGroups = [];
|
6656
|
+
if (measures) measures.forEach((measure)=>{
|
6657
|
+
if (measure.children && measure.children.length > 0) measureGroups.push(measure);
|
6658
|
+
});
|
6659
|
+
const newDatasets = [];
|
6660
|
+
const datasetReshapeInfo = [];
|
6661
|
+
measureGroups.forEach((measureGroup, index)=>{
|
6662
|
+
const measures = measureGroup.children;
|
6663
|
+
if (!measures) return;
|
6664
|
+
const commonDimensions = dimensions.filter((dim)=>'dimension' === dim.location);
|
6665
|
+
const groupId = measureGroup.id;
|
6666
|
+
const { dataset: newSubDataset, foldInfo, unfoldInfo } = dataReshapeFor1D1M(dataset, commonDimensions, measures, {
|
6667
|
+
foldMeasureId: FoldMeasureId,
|
6668
|
+
foldMeasureName: FoldMeasureName,
|
6669
|
+
foldMeasureValue: FoldMeasureValue + groupId,
|
6670
|
+
unfoldDimensionGroup: UnfoldDimensionGroup
|
6671
|
+
});
|
6672
|
+
const reshapeInfo = {
|
6673
|
+
id: groupId,
|
6674
|
+
index,
|
6675
|
+
foldInfo,
|
6676
|
+
unfoldInfo
|
6677
|
+
};
|
6678
|
+
newDatasets.push(newSubDataset);
|
6679
|
+
datasetReshapeInfo.push(reshapeInfo);
|
6680
|
+
});
|
6681
|
+
return {
|
6682
|
+
...result,
|
6683
|
+
dataset: newDatasets,
|
6684
|
+
datasetReshapeInfo: datasetReshapeInfo
|
6685
|
+
};
|
6686
|
+
};
|
6687
|
+
const encodingPie = (advancedVSeed)=>{
|
6688
|
+
const result = {
|
6689
|
+
...advancedVSeed
|
6690
|
+
};
|
6691
|
+
const { datasetReshapeInfo } = advancedVSeed;
|
6692
|
+
if (!datasetReshapeInfo) return result;
|
6693
|
+
const encoding = datasetReshapeInfo.reduce((prev, cur)=>{
|
6694
|
+
const { foldInfo, unfoldInfo } = cur;
|
6695
|
+
const radius = [
|
6696
|
+
foldInfo.measureValue
|
6697
|
+
];
|
6698
|
+
const angle = [
|
6699
|
+
unfoldInfo.groupId
|
6700
|
+
];
|
6701
|
+
const group = [
|
6702
|
+
unfoldInfo.groupId
|
6703
|
+
];
|
6704
|
+
const color = [
|
6705
|
+
unfoldInfo.groupId
|
6706
|
+
];
|
6707
|
+
return [
|
6708
|
+
...prev,
|
6709
|
+
{
|
6710
|
+
angle,
|
6711
|
+
radius,
|
6712
|
+
group,
|
6713
|
+
color
|
6714
|
+
}
|
6715
|
+
];
|
6716
|
+
}, []);
|
6717
|
+
return {
|
6718
|
+
...result,
|
6719
|
+
encoding
|
6720
|
+
};
|
6721
|
+
};
|
6722
|
+
const pieAdvancedPipeline = [
|
6723
|
+
initAdvancedVSeed_initAdvancedVSeed,
|
6724
|
+
autoMeasures_autoMeasures,
|
6725
|
+
autoDimensions_autoDimensions,
|
6726
|
+
pivotAdapter([
|
6727
|
+
reshapeTo1D1M
|
6728
|
+
], [
|
6729
|
+
pivotReshapeTo1D1M
|
6730
|
+
]),
|
6731
|
+
encodingPie,
|
6732
|
+
pieConfig,
|
6733
|
+
theme_theme,
|
6734
|
+
annotation_annotation
|
6735
|
+
];
|
6736
|
+
const initPie = (spec, context)=>{
|
6737
|
+
const result = {
|
6738
|
+
...spec
|
6739
|
+
};
|
6740
|
+
const { advancedVSeed } = context;
|
6741
|
+
const { encoding, dataset } = advancedVSeed;
|
6742
|
+
if (!encoding[0].angle || !encoding[0].radius || !encoding[0].group) return result;
|
6743
|
+
const showStroke = dataset.length <= 30;
|
6744
|
+
result.type = 'pie';
|
6745
|
+
result.outerRadius = 0.8;
|
6746
|
+
result.innerRadius = 0;
|
6747
|
+
result.valueField = encoding[0].radius[0];
|
6748
|
+
result.categoryField = encoding[0].angle[0];
|
6749
|
+
result.seriesField = encoding[0].group[0];
|
6750
|
+
result.padding = 0;
|
6751
|
+
result.region = [
|
6752
|
+
{
|
6753
|
+
clip: true
|
6754
|
+
}
|
6755
|
+
];
|
6756
|
+
result.pie = {
|
6757
|
+
style: {
|
6758
|
+
stroke: '#ffffff',
|
6759
|
+
lineWidth: showStroke ? 1 : 0,
|
6760
|
+
centerOffset: 0
|
6761
|
+
},
|
6762
|
+
state: {
|
6763
|
+
hover: {
|
6764
|
+
outerRadius: 1.1 * result.outerRadius
|
6765
|
+
}
|
6766
|
+
}
|
6767
|
+
};
|
6768
|
+
result.animation = true;
|
6769
|
+
return result;
|
6770
|
+
};
|
6771
|
+
const pie = [
|
6772
|
+
initPie,
|
6773
|
+
color_color,
|
6774
|
+
background_backgroundColor,
|
6775
|
+
datasetXY,
|
6776
|
+
progressive,
|
6777
|
+
label_label,
|
5734
6778
|
tooltip_tooltip,
|
5735
6779
|
discreteLegend,
|
5736
6780
|
annotationPoint_annotationPoint,
|
@@ -6981,6 +8025,17 @@ const lightTheme = ()=>{
|
|
6981
8025
|
},
|
6982
8026
|
crosshairLine
|
6983
8027
|
},
|
8028
|
+
dualAxis: {
|
8029
|
+
...baseConfig,
|
8030
|
+
xAxis: bandAxis,
|
8031
|
+
primaryYAxis: linearAxis,
|
8032
|
+
secondaryYAxis: linearAxis,
|
8033
|
+
dualChartType: {
|
8034
|
+
primary: 'column',
|
8035
|
+
secondary: 'line'
|
8036
|
+
},
|
8037
|
+
crosshairRect
|
8038
|
+
},
|
6984
8039
|
pie: {
|
6985
8040
|
...baseConfig
|
6986
8041
|
},
|
@@ -7303,6 +8358,17 @@ const darkTheme = ()=>{
|
|
7303
8358
|
},
|
7304
8359
|
crosshairLine
|
7305
8360
|
},
|
8361
|
+
dualAxis: {
|
8362
|
+
...baseConfig,
|
8363
|
+
xAxis: bandAxis,
|
8364
|
+
primaryYAxis: linearAxis,
|
8365
|
+
secondaryYAxis: linearAxis,
|
8366
|
+
dualChartType: {
|
8367
|
+
primary: 'column',
|
8368
|
+
secondary: 'line'
|
8369
|
+
},
|
8370
|
+
crosshairRect
|
8371
|
+
},
|
7306
8372
|
pie: {
|
7307
8373
|
...baseConfig
|
7308
8374
|
},
|
@@ -7368,6 +8434,7 @@ const registerAll = ()=>{
|
|
7368
8434
|
registerAreaPercent();
|
7369
8435
|
registerAreaRange();
|
7370
8436
|
registerScatter();
|
8437
|
+
registerDualAxis();
|
7371
8438
|
registerPie();
|
7372
8439
|
registerDonut();
|
7373
8440
|
registerRose();
|
@@ -7408,6 +8475,26 @@ const zChartType = external_zod_namespaceObject.z["enum"]([
|
|
7408
8475
|
'funnel',
|
7409
8476
|
'heatmap'
|
7410
8477
|
]);
|
8478
|
+
const zDualChartType = external_zod_namespaceObject.z.object({
|
8479
|
+
primary: external_zod_namespaceObject.z["enum"]([
|
8480
|
+
'line',
|
8481
|
+
'column',
|
8482
|
+
'columnPercent',
|
8483
|
+
'columnParallel',
|
8484
|
+
'area',
|
8485
|
+
'areaPercent',
|
8486
|
+
'scatter'
|
8487
|
+
]).default('column'),
|
8488
|
+
secondary: external_zod_namespaceObject.z["enum"]([
|
8489
|
+
'line',
|
8490
|
+
'column',
|
8491
|
+
'columnPercent',
|
8492
|
+
'columnParallel',
|
8493
|
+
'area',
|
8494
|
+
'areaPercent',
|
8495
|
+
'scatter'
|
8496
|
+
]).default('line')
|
8497
|
+
});
|
7411
8498
|
const zDatum = external_zod_namespaceObject.z.record(external_zod_namespaceObject.z.string().or(external_zod_namespaceObject.z.number()), external_zod_namespaceObject.z.any());
|
7412
8499
|
const zDataset = external_zod_namespaceObject.z.array(zDatum);
|
7413
8500
|
const zDimension = external_zod_namespaceObject.z.object({
|
@@ -7473,6 +8560,14 @@ const zMeasureGroup = external_zod_namespaceObject.z.object({
|
|
7473
8560
|
});
|
7474
8561
|
const zMeasures = external_zod_namespaceObject.z.array(zMeasure);
|
7475
8562
|
const zMeasureTree = external_zod_namespaceObject.z.array(zMeasureGroup.or(zMeasure));
|
8563
|
+
const zDualMeasure = external_zod_namespaceObject.z.object({
|
8564
|
+
id: external_zod_namespaceObject.z.string(),
|
8565
|
+
primaryMeasures: external_zod_namespaceObject.z.array(zMeasure).or(zMeasure).optional(),
|
8566
|
+
primaryAlias: external_zod_namespaceObject.z.string().optional(),
|
8567
|
+
secondaryMeasures: external_zod_namespaceObject.z.array(zMeasure).or(zMeasure).optional(),
|
8568
|
+
secondaryAlias: external_zod_namespaceObject.z.string().optional()
|
8569
|
+
});
|
8570
|
+
const zDualMeasures = external_zod_namespaceObject.z.array(zDualMeasure);
|
7476
8571
|
const zFoldInfo = external_zod_namespaceObject.z.object({
|
7477
8572
|
foldMap: external_zod_namespaceObject.z.record(external_zod_namespaceObject.z.string(), external_zod_namespaceObject.z.string().or(external_zod_namespaceObject.z.undefined())),
|
7478
8573
|
measureId: external_zod_namespaceObject.z.string(),
|
@@ -7487,7 +8582,9 @@ const zUnfoldInfo = external_zod_namespaceObject.z.object({
|
|
7487
8582
|
});
|
7488
8583
|
const zDatasetReshapeInfo = external_zod_namespaceObject.z.array(external_zod_namespaceObject.z.object({
|
7489
8584
|
id: external_zod_namespaceObject.z.string(),
|
8585
|
+
index: external_zod_namespaceObject.z.number(),
|
7490
8586
|
foldInfo: zFoldInfo,
|
8587
|
+
foldInfoList: external_zod_namespaceObject.z.array(zFoldInfo).optional(),
|
7491
8588
|
unfoldInfo: zUnfoldInfo
|
7492
8589
|
}));
|
7493
8590
|
const zEncoding = external_zod_namespaceObject.z.array(external_zod_namespaceObject.z.object({
|
@@ -7767,7 +8864,12 @@ const zDualAxisConfig = external_zod_namespaceObject.z.object({
|
|
7767
8864
|
label: zLabel.optional(),
|
7768
8865
|
color: zColor.optional(),
|
7769
8866
|
tooltip: zTooltip.optional(),
|
7770
|
-
legend: zLegend.optional()
|
8867
|
+
legend: zLegend.optional(),
|
8868
|
+
dualChartType: external_zod_namespaceObject.z.array(zDualChartType).or(zDualChartType).optional(),
|
8869
|
+
primaryYAxis: external_zod_namespaceObject.z.array(zYLinearAxis).or(zYLinearAxis).optional(),
|
8870
|
+
secondaryYAxis: external_zod_namespaceObject.z.array(zYLinearAxis).or(zYLinearAxis).optional(),
|
8871
|
+
xAxis: zXBandAxis.optional(),
|
8872
|
+
crosshairRect: zCrosshairRect.optional()
|
7771
8873
|
});
|
7772
8874
|
const zScatterConfig = external_zod_namespaceObject.z.object({
|
7773
8875
|
backgroundColor: zBackgroundColor.optional(),
|
@@ -7811,8 +8913,8 @@ const zConfig = external_zod_namespaceObject.z.object({
|
|
7811
8913
|
area: zAreaConfig.optional(),
|
7812
8914
|
areaPercent: zAreaPercentConfig.optional(),
|
7813
8915
|
areaRange: zAreaRangeConfig.optional(),
|
7814
|
-
dualAxis: zDualAxisConfig.optional(),
|
7815
8916
|
scatter: zScatterConfig.optional(),
|
8917
|
+
dualAxis: zDualAxisConfig.optional(),
|
7816
8918
|
rose: zRoseConfig.optional(),
|
7817
8919
|
roseParallel: zRoseParallelConfig.optional(),
|
7818
8920
|
pie: zPieConfig.optional(),
|
@@ -8465,6 +9567,35 @@ const zScatter = external_zod_namespaceObject.z.object({
|
|
8465
9567
|
annotationArea: external_zod_namespaceObject.z.array(zAnnotationArea).or(zAnnotationArea).optional(),
|
8466
9568
|
locale: zLocale.optional()
|
8467
9569
|
});
|
9570
|
+
const zDualAxis = external_zod_namespaceObject.z.object({
|
9571
|
+
chartType: external_zod_namespaceObject.z.literal('dualAxis'),
|
9572
|
+
dataset: zDataset.optional(),
|
9573
|
+
dimensions: zDimensions.optional(),
|
9574
|
+
measures: zMeasureTree.optional(),
|
9575
|
+
dualMeasures: zDualMeasures.optional(),
|
9576
|
+
dualChartType: external_zod_namespaceObject.z.array(zDualChartType).or(zDualChartType).optional(),
|
9577
|
+
primaryYAxis: external_zod_namespaceObject.z.array(zYLinearAxis).or(zYLinearAxis).optional(),
|
9578
|
+
secondaryYAxis: external_zod_namespaceObject.z.array(zYLinearAxis).or(zYLinearAxis).optional(),
|
9579
|
+
xAxis: zXBandAxis.optional(),
|
9580
|
+
backgroundColor: zBackgroundColor.optional(),
|
9581
|
+
color: zColor.optional(),
|
9582
|
+
label: zLabel.optional(),
|
9583
|
+
legend: zLegend.optional(),
|
9584
|
+
tooltip: zTooltip.optional(),
|
9585
|
+
crosshairRect: zCrosshairRect.optional(),
|
9586
|
+
sort: zSort.optional(),
|
9587
|
+
sortLegend: zSortLegend.optional(),
|
9588
|
+
theme: zTheme.optional(),
|
9589
|
+
barStyle: external_zod_namespaceObject.z.array(zBarStyle).or(zBarStyle).optional(),
|
9590
|
+
pointStyle: external_zod_namespaceObject.z.array(zPointStyle).or(zPointStyle).optional(),
|
9591
|
+
lineStyle: external_zod_namespaceObject.z.array(zLineStyle).or(zLineStyle).optional(),
|
9592
|
+
areaStyle: external_zod_namespaceObject.z.array(zAreaStyle).or(zAreaStyle).optional(),
|
9593
|
+
annotationPoint: external_zod_namespaceObject.z.array(zAnnotationPoint).or(zAnnotationPoint).optional(),
|
9594
|
+
annotationVerticalLine: external_zod_namespaceObject.z.array(zAnnotationVerticalLine).or(zAnnotationVerticalLine).optional(),
|
9595
|
+
annotationHorizontalLine: external_zod_namespaceObject.z.array(zAnnotationHorizontalLine).or(zAnnotationHorizontalLine).optional(),
|
9596
|
+
annotationArea: external_zod_namespaceObject.z.array(zAnnotationArea).or(zAnnotationArea).optional(),
|
9597
|
+
locale: zLocale.optional()
|
9598
|
+
});
|
8468
9599
|
const zRose = external_zod_namespaceObject.z.object({
|
8469
9600
|
chartType: external_zod_namespaceObject.z.literal('rose'),
|
8470
9601
|
dataset: zDataset.optional(),
|
@@ -8570,6 +9701,7 @@ const zVSeed = external_zod_namespaceObject.z.discriminatedUnion('chartType', [
|
|
8570
9701
|
zAreaPercent,
|
8571
9702
|
zAreaRange,
|
8572
9703
|
zScatter,
|
9704
|
+
zDualAxis,
|
8573
9705
|
zPie,
|
8574
9706
|
zDonut,
|
8575
9707
|
zRose,
|
@@ -8597,6 +9729,8 @@ exports.Builder = __webpack_exports__.Builder;
|
|
8597
9729
|
exports.FoldMeasureId = __webpack_exports__.FoldMeasureId;
|
8598
9730
|
exports.FoldMeasureName = __webpack_exports__.FoldMeasureName;
|
8599
9731
|
exports.FoldMeasureValue = __webpack_exports__.FoldMeasureValue;
|
9732
|
+
exports.FoldPrimaryMeasureValue = __webpack_exports__.FoldPrimaryMeasureValue;
|
9733
|
+
exports.FoldSecondaryMeasureValue = __webpack_exports__.FoldSecondaryMeasureValue;
|
8600
9734
|
exports.ORIGINAL_DATA = __webpack_exports__.ORIGINAL_DATA;
|
8601
9735
|
exports.Separator = __webpack_exports__.Separator;
|
8602
9736
|
exports.UnfoldDimensionGroup = __webpack_exports__.UnfoldDimensionGroup;
|
@@ -8631,6 +9765,8 @@ exports.dataReshapeFor2D1M = __webpack_exports__.dataReshapeFor2D1M;
|
|
8631
9765
|
exports.dataReshapeFor2D1M0Name = __webpack_exports__.dataReshapeFor2D1M0Name;
|
8632
9766
|
exports.donutAdvancedPipeline = __webpack_exports__.donutAdvancedPipeline;
|
8633
9767
|
exports.donutSpecPipeline = __webpack_exports__.donutSpecPipeline;
|
9768
|
+
exports.dualAxisAdvancedPipeline = __webpack_exports__.dualAxisAdvancedPipeline;
|
9769
|
+
exports.dualAxisSpecPipeline = __webpack_exports__.dualAxisSpecPipeline;
|
8634
9770
|
exports.execPipeline = __webpack_exports__.execPipeline;
|
8635
9771
|
exports.findAllDimensions = __webpack_exports__.findAllDimensions;
|
8636
9772
|
exports.findAllMeasures = __webpack_exports__.findAllMeasures;
|
@@ -8657,6 +9793,7 @@ exports.isValueSelector = __webpack_exports__.isValueSelector;
|
|
8657
9793
|
exports.lightTheme = __webpack_exports__.lightTheme;
|
8658
9794
|
exports.lineAdvancedPipeline = __webpack_exports__.lineAdvancedPipeline;
|
8659
9795
|
exports.lineSpecPipeline = __webpack_exports__.lineSpecPipeline;
|
9796
|
+
exports.measureDepth = __webpack_exports__.measureDepth;
|
8660
9797
|
exports.pieAdvancedPipeline = __webpack_exports__.pieAdvancedPipeline;
|
8661
9798
|
exports.pieSpecPipeline = __webpack_exports__.pieSpecPipeline;
|
8662
9799
|
exports.pivotTableAdvancedPipeline = __webpack_exports__.pivotTableAdvancedPipeline;
|
@@ -8746,7 +9883,11 @@ exports.zDimensionTree = __webpack_exports__.zDimensionTree;
|
|
8746
9883
|
exports.zDimensions = __webpack_exports__.zDimensions;
|
8747
9884
|
exports.zDonut = __webpack_exports__.zDonut;
|
8748
9885
|
exports.zDonutConfig = __webpack_exports__.zDonutConfig;
|
9886
|
+
exports.zDualAxis = __webpack_exports__.zDualAxis;
|
8749
9887
|
exports.zDualAxisConfig = __webpack_exports__.zDualAxisConfig;
|
9888
|
+
exports.zDualChartType = __webpack_exports__.zDualChartType;
|
9889
|
+
exports.zDualMeasure = __webpack_exports__.zDualMeasure;
|
9890
|
+
exports.zDualMeasures = __webpack_exports__.zDualMeasures;
|
8750
9891
|
exports.zEncoding = __webpack_exports__.zEncoding;
|
8751
9892
|
exports.zFoldInfo = __webpack_exports__.zFoldInfo;
|
8752
9893
|
exports.zFunnel = __webpack_exports__.zFunnel;
|
@@ -8797,6 +9938,8 @@ for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
8797
9938
|
"FoldMeasureId",
|
8798
9939
|
"FoldMeasureName",
|
8799
9940
|
"FoldMeasureValue",
|
9941
|
+
"FoldPrimaryMeasureValue",
|
9942
|
+
"FoldSecondaryMeasureValue",
|
8800
9943
|
"ORIGINAL_DATA",
|
8801
9944
|
"Separator",
|
8802
9945
|
"UnfoldDimensionGroup",
|
@@ -8831,6 +9974,8 @@ for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
8831
9974
|
"dataReshapeFor2D1M0Name",
|
8832
9975
|
"donutAdvancedPipeline",
|
8833
9976
|
"donutSpecPipeline",
|
9977
|
+
"dualAxisAdvancedPipeline",
|
9978
|
+
"dualAxisSpecPipeline",
|
8834
9979
|
"execPipeline",
|
8835
9980
|
"findAllDimensions",
|
8836
9981
|
"findAllMeasures",
|
@@ -8857,6 +10002,7 @@ for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
8857
10002
|
"lightTheme",
|
8858
10003
|
"lineAdvancedPipeline",
|
8859
10004
|
"lineSpecPipeline",
|
10005
|
+
"measureDepth",
|
8860
10006
|
"pieAdvancedPipeline",
|
8861
10007
|
"pieSpecPipeline",
|
8862
10008
|
"pivotTableAdvancedPipeline",
|
@@ -8946,7 +10092,11 @@ for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
8946
10092
|
"zDimensions",
|
8947
10093
|
"zDonut",
|
8948
10094
|
"zDonutConfig",
|
10095
|
+
"zDualAxis",
|
8949
10096
|
"zDualAxisConfig",
|
10097
|
+
"zDualChartType",
|
10098
|
+
"zDualMeasure",
|
10099
|
+
"zDualMeasures",
|
8950
10100
|
"zEncoding",
|
8951
10101
|
"zFoldInfo",
|
8952
10102
|
"zFunnel",
|