@visactor/vseed 0.0.33 → 0.0.35
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 +1362 -202
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1289 -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 +491 -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 +1955 -0
- package/dist/types/chartType/index.d.ts +1 -1
- package/dist/types/properties/chartType/dualChartType.d.ts +18 -0
- package/dist/types/properties/chartType/index.d.ts +2 -0
- package/dist/types/properties/config/config.d.ts +477 -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 +484 -14
- package/dist/types/vseed.d.ts +1953 -0
- package/dist/umd/index.js +1282 -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,1073 @@ 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 index = datasetReshapeInfo[0].index;
|
5886
|
+
const config = advancedVSeed.config?.[chartType]?.dualChartType || {
|
5887
|
+
primary: 'column',
|
5888
|
+
secondary: 'line'
|
5889
|
+
};
|
5890
|
+
const primary = Array.isArray(config) ? config[index].primary || config[0].primary : config.primary;
|
5891
|
+
switch(primary){
|
5892
|
+
case 'line':
|
5893
|
+
result.type = 'line';
|
5894
|
+
break;
|
5895
|
+
case 'column':
|
5896
|
+
result.type = 'bar';
|
5897
|
+
break;
|
5898
|
+
case 'columnParallel':
|
5899
|
+
{
|
5900
|
+
const columnSpec = result;
|
5901
|
+
if (Array.isArray(columnSpec.xField)) columnSpec.xField.push(datasetReshapeInfo[0].unfoldInfo.groupId);
|
5902
|
+
else if (columnSpec.xField) columnSpec.xField = [
|
5903
|
+
columnSpec.xField,
|
5904
|
+
datasetReshapeInfo[0].unfoldInfo.groupId
|
5905
|
+
];
|
5906
|
+
columnSpec.type = 'bar';
|
5907
|
+
break;
|
5908
|
+
}
|
5909
|
+
case 'columnPercent':
|
5910
|
+
result.type = 'bar';
|
5911
|
+
result.percent = true;
|
5912
|
+
break;
|
5913
|
+
case 'area':
|
5914
|
+
result.type = 'area';
|
5915
|
+
break;
|
5916
|
+
case 'areaPercent':
|
5917
|
+
result.type = 'area';
|
5918
|
+
result.percent = true;
|
5919
|
+
break;
|
5920
|
+
case 'scatter':
|
5921
|
+
result.type = 'scatter';
|
5922
|
+
break;
|
5923
|
+
default:
|
5924
|
+
result.type = primary;
|
5925
|
+
}
|
5926
|
+
return result;
|
5927
|
+
};
|
5928
|
+
const dualChartTypeSecondary = (spec, context)=>{
|
5929
|
+
const result = {
|
5930
|
+
...spec
|
5931
|
+
};
|
5932
|
+
const { advancedVSeed, vseed } = context;
|
5933
|
+
const { chartType } = vseed;
|
5934
|
+
const { datasetReshapeInfo } = advancedVSeed;
|
5935
|
+
const config = advancedVSeed.config?.[chartType]?.dualChartType || {
|
5936
|
+
primary: 'column',
|
5937
|
+
secondary: 'line'
|
5938
|
+
};
|
5939
|
+
const index = datasetReshapeInfo[0].index;
|
5940
|
+
const secondary = Array.isArray(config) ? config[index].secondary || config[0].secondary : config.secondary;
|
5941
|
+
switch(secondary){
|
5942
|
+
case 'line':
|
5943
|
+
result.type = 'line';
|
5944
|
+
break;
|
5945
|
+
case 'column':
|
5946
|
+
result.type = 'bar';
|
5947
|
+
break;
|
5948
|
+
case 'columnParallel':
|
5949
|
+
{
|
5950
|
+
const columnSpec = result;
|
5951
|
+
if (Array.isArray(columnSpec.xField)) columnSpec.xField.push(datasetReshapeInfo[0].unfoldInfo.groupId);
|
5952
|
+
else if (columnSpec.xField) columnSpec.xField = [
|
5953
|
+
columnSpec.xField,
|
5954
|
+
datasetReshapeInfo[0].unfoldInfo.groupId
|
5955
|
+
];
|
5956
|
+
columnSpec.type = 'bar';
|
5957
|
+
break;
|
5958
|
+
}
|
5959
|
+
case 'columnPercent':
|
5960
|
+
result.type = 'bar';
|
5961
|
+
result.percent = true;
|
5962
|
+
break;
|
5963
|
+
case 'area':
|
5964
|
+
result.type = 'area';
|
5965
|
+
break;
|
5966
|
+
case 'areaPercent':
|
5967
|
+
result.type = 'area';
|
5968
|
+
result.percent = true;
|
5969
|
+
break;
|
5970
|
+
case 'scatter':
|
5971
|
+
result.type = 'scatter';
|
5972
|
+
break;
|
5973
|
+
default:
|
5974
|
+
result.type = secondary;
|
5975
|
+
}
|
5976
|
+
return result;
|
5977
|
+
};
|
5978
|
+
const datasetPrimary = (spec, context)=>{
|
5979
|
+
const { advancedVSeed, vseed } = context;
|
5980
|
+
const { encoding, analysis, datasetReshapeInfo } = advancedVSeed;
|
5981
|
+
const { orderMapping = {} } = analysis ?? {};
|
5982
|
+
const x = encoding[0]?.x?.[0];
|
5983
|
+
const group = encoding[0]?.group?.[0];
|
5984
|
+
const id = datasetReshapeInfo[0].id;
|
5985
|
+
const fields = {};
|
5986
|
+
if (x) {
|
5987
|
+
const order = orderMapping[x];
|
5988
|
+
if (order) fields[x] = {
|
5989
|
+
sortIndex: 0,
|
5990
|
+
domain: order,
|
5991
|
+
lockStatisticsByDomain: true
|
5992
|
+
};
|
5993
|
+
else fields[x] = {
|
5994
|
+
sortIndex: 0
|
5995
|
+
};
|
5996
|
+
}
|
5997
|
+
if (group) {
|
5998
|
+
const order = orderMapping[group];
|
5999
|
+
if (order) fields[group] = {
|
6000
|
+
sortIndex: 0,
|
6001
|
+
domain: order,
|
6002
|
+
lockStatisticsByDomain: true
|
6003
|
+
};
|
6004
|
+
else fields[group] = {
|
6005
|
+
sortIndex: 0
|
6006
|
+
};
|
6007
|
+
}
|
6008
|
+
return {
|
6009
|
+
...spec,
|
6010
|
+
data: {
|
6011
|
+
id: `${id}-primary-dataset`,
|
6012
|
+
values: isPivotChart(vseed) ? void 0 : advancedVSeed.dataset[0],
|
6013
|
+
fields: fields
|
6014
|
+
}
|
6015
|
+
};
|
6016
|
+
};
|
6017
|
+
const datasetSecondary = (spec, context)=>{
|
6018
|
+
const { advancedVSeed, vseed } = context;
|
6019
|
+
const { encoding, analysis, datasetReshapeInfo } = advancedVSeed;
|
6020
|
+
const { orderMapping = {} } = analysis ?? {};
|
6021
|
+
const x = encoding[0]?.x?.[0];
|
6022
|
+
const group = encoding[0]?.group?.[0];
|
6023
|
+
const id = datasetReshapeInfo[0].id;
|
6024
|
+
const fields = {};
|
6025
|
+
if (x) {
|
6026
|
+
const order = orderMapping[x];
|
6027
|
+
if (order) fields[x] = {
|
6028
|
+
sortIndex: 0,
|
6029
|
+
domain: order,
|
6030
|
+
lockStatisticsByDomain: true
|
6031
|
+
};
|
6032
|
+
else fields[x] = {
|
6033
|
+
sortIndex: 0
|
6034
|
+
};
|
6035
|
+
}
|
6036
|
+
if (group) {
|
6037
|
+
const order = orderMapping[group];
|
6038
|
+
if (order) fields[group] = {
|
6039
|
+
sortIndex: 0,
|
6040
|
+
domain: order,
|
6041
|
+
lockStatisticsByDomain: true
|
6042
|
+
};
|
6043
|
+
else fields[group] = {
|
6044
|
+
sortIndex: 0
|
6045
|
+
};
|
6046
|
+
}
|
6047
|
+
return {
|
6048
|
+
...spec,
|
6049
|
+
data: {
|
6050
|
+
id: `${id}-secondary-dataset`,
|
6051
|
+
values: isPivotChart(vseed) ? void 0 : advancedVSeed.dataset[1],
|
6052
|
+
fields: fields
|
6053
|
+
}
|
6054
|
+
};
|
6055
|
+
};
|
6056
|
+
const labelPrimary = (spec, context)=>{
|
6057
|
+
const result = {
|
6058
|
+
...spec
|
6059
|
+
};
|
6060
|
+
const { advancedVSeed } = context;
|
6061
|
+
const { measures, datasetReshapeInfo, locale } = advancedVSeed;
|
6062
|
+
const { chartType } = advancedVSeed;
|
6063
|
+
const baseConfig = advancedVSeed.config[chartType];
|
6064
|
+
if (!baseConfig || !baseConfig.label) return result;
|
6065
|
+
const foldInfoList = datasetReshapeInfo[0].foldInfoList;
|
6066
|
+
const { measureId, measureValue } = foldInfoList[0];
|
6067
|
+
const { label } = baseConfig;
|
6068
|
+
const { enable } = label;
|
6069
|
+
result.label = {
|
6070
|
+
visible: enable,
|
6071
|
+
formatMethod: (value, datum)=>{
|
6072
|
+
const result = [];
|
6073
|
+
const formatValue = (value)=>{
|
6074
|
+
const id = datum[measureId];
|
6075
|
+
const measure = findMeasureById(measures, id);
|
6076
|
+
if (!measure) return value;
|
6077
|
+
const { format = {}, autoFormat = true } = measure;
|
6078
|
+
if (!(0, external_remeda_namespaceObject.isEmpty)(format)) {
|
6079
|
+
const formatter = createFormatter(format);
|
6080
|
+
return formatter(value);
|
6081
|
+
}
|
6082
|
+
if (autoFormat) return autoFormatter(value, locale);
|
6083
|
+
return String(value);
|
6084
|
+
};
|
6085
|
+
result.push(formatValue(datum[measureValue]));
|
6086
|
+
return result.join(' ');
|
6087
|
+
}
|
6088
|
+
};
|
6089
|
+
return result;
|
6090
|
+
};
|
6091
|
+
const labelSecondary = (spec, context)=>{
|
6092
|
+
const result = {
|
6093
|
+
...spec
|
6094
|
+
};
|
6095
|
+
const { advancedVSeed } = context;
|
6096
|
+
const { measures, datasetReshapeInfo, locale } = advancedVSeed;
|
6097
|
+
const { chartType } = advancedVSeed;
|
6098
|
+
const baseConfig = advancedVSeed.config[chartType];
|
6099
|
+
if (!baseConfig || !baseConfig.label) return result;
|
6100
|
+
if ((0, external_remeda_namespaceObject.isNullish)(datasetReshapeInfo[0].foldInfoList?.[1])) return result;
|
6101
|
+
const foldInfoList = datasetReshapeInfo[0].foldInfoList;
|
6102
|
+
const { measureId, measureValue } = foldInfoList[1];
|
6103
|
+
const { label } = baseConfig;
|
6104
|
+
const { enable } = label;
|
6105
|
+
result.label = {
|
6106
|
+
visible: enable,
|
6107
|
+
formatMethod: (value, datum)=>{
|
6108
|
+
const result = [];
|
6109
|
+
const formatValue = (value)=>{
|
6110
|
+
const id = datum[measureId];
|
6111
|
+
const measure = findMeasureById(measures, id);
|
6112
|
+
if (!measure) return value;
|
6113
|
+
const { format = {}, autoFormat = true } = measure;
|
6114
|
+
if (!(0, external_remeda_namespaceObject.isEmpty)(format)) {
|
6115
|
+
const formatter = createFormatter(format);
|
6116
|
+
return formatter(value);
|
6117
|
+
}
|
6118
|
+
if (autoFormat) return autoFormatter(value, locale);
|
6119
|
+
return String(value);
|
6120
|
+
};
|
6121
|
+
result.push(formatValue(datum[measureValue]));
|
6122
|
+
return result.join(' ');
|
6123
|
+
}
|
6124
|
+
};
|
6125
|
+
return result;
|
6126
|
+
};
|
6127
|
+
const tooltipPrimary = (spec, context)=>{
|
6128
|
+
const result = {
|
6129
|
+
...spec
|
6130
|
+
};
|
6131
|
+
const { advancedVSeed } = context;
|
6132
|
+
const { measures, datasetReshapeInfo, chartType, locale, dimensions } = advancedVSeed;
|
6133
|
+
const baseConfig = advancedVSeed.config[chartType];
|
6134
|
+
const { tooltip = {
|
6135
|
+
enable: true
|
6136
|
+
} } = baseConfig;
|
6137
|
+
const { enable } = tooltip;
|
6138
|
+
const foldInfoList = datasetReshapeInfo[0].foldInfoList;
|
6139
|
+
const unfoldInfo = datasetReshapeInfo[0].unfoldInfo;
|
6140
|
+
const { measureId, measureValue, measureName } = foldInfoList[0];
|
6141
|
+
const { groupName } = unfoldInfo;
|
6142
|
+
result.tooltip = {
|
6143
|
+
visible: enable,
|
6144
|
+
mark: {
|
6145
|
+
title: {
|
6146
|
+
visible: true
|
6147
|
+
},
|
6148
|
+
content: [
|
6149
|
+
...dimensions.map((item)=>({
|
6150
|
+
visible: true,
|
6151
|
+
hasShape: true,
|
6152
|
+
shapeType: 'rectRound',
|
6153
|
+
key: (datum)=>{
|
6154
|
+
if (item.alias || item.id) return item.alias || item.id;
|
6155
|
+
return datum && datum[item.id];
|
6156
|
+
},
|
6157
|
+
value: (datum)=>datum && datum[item.id]
|
6158
|
+
})),
|
6159
|
+
{
|
6160
|
+
visible: true,
|
6161
|
+
hasShape: true,
|
6162
|
+
key: (datum)=>datum && datum[measureName || groupName] || '',
|
6163
|
+
value: (datum)=>{
|
6164
|
+
if (!datum) return '';
|
6165
|
+
const value = datum[measureValue];
|
6166
|
+
const id = datum[measureId];
|
6167
|
+
const measure = findMeasureById(measures, id);
|
6168
|
+
if (!measure) return String(value);
|
6169
|
+
const { format = {}, autoFormat = true } = measure;
|
6170
|
+
if (!(0, external_remeda_namespaceObject.isEmpty)(format)) {
|
6171
|
+
const formatter = createFormatter(format);
|
6172
|
+
return formatter(value);
|
6173
|
+
}
|
6174
|
+
if (autoFormat) return autoFormatter(value, locale);
|
6175
|
+
return String(value);
|
6176
|
+
}
|
6177
|
+
}
|
6178
|
+
]
|
6179
|
+
},
|
6180
|
+
dimension: {
|
6181
|
+
content: [
|
6182
|
+
{
|
6183
|
+
visible: true,
|
6184
|
+
key: (datum)=>datum && datum[groupName] || '',
|
6185
|
+
value: (datum)=>{
|
6186
|
+
if (!datum) return '';
|
6187
|
+
const value = datum[measureValue];
|
6188
|
+
const id = datum[measureId];
|
6189
|
+
const measure = findMeasureById(measures, id);
|
6190
|
+
if (!measure) return String(value);
|
6191
|
+
const { format = {}, autoFormat = true } = measure;
|
6192
|
+
if (!(0, external_remeda_namespaceObject.isEmpty)(format)) {
|
6193
|
+
const formatter = createFormatter(format);
|
6194
|
+
return formatter(value);
|
6195
|
+
}
|
6196
|
+
if (autoFormat) return autoFormatter(value, locale);
|
6197
|
+
return String(value);
|
6198
|
+
},
|
6199
|
+
shapeType: 'rectRound'
|
6200
|
+
}
|
6201
|
+
]
|
6202
|
+
}
|
6203
|
+
};
|
6204
|
+
return result;
|
6205
|
+
};
|
6206
|
+
const tooltipSecondary = (spec, context)=>{
|
6207
|
+
const result = {
|
6208
|
+
...spec
|
6209
|
+
};
|
6210
|
+
const { advancedVSeed } = context;
|
6211
|
+
const { measures, datasetReshapeInfo, chartType, locale, dimensions } = advancedVSeed;
|
6212
|
+
const baseConfig = advancedVSeed.config[chartType];
|
6213
|
+
const { tooltip = {
|
6214
|
+
enable: true
|
6215
|
+
} } = baseConfig;
|
6216
|
+
const { enable } = tooltip;
|
6217
|
+
if ((0, external_remeda_namespaceObject.isNullish)(datasetReshapeInfo[0].foldInfoList?.[1])) return result;
|
6218
|
+
const foldInfoList = datasetReshapeInfo[0].foldInfoList;
|
6219
|
+
const unfoldInfo = datasetReshapeInfo[0].unfoldInfo;
|
6220
|
+
const { measureId, measureValue, measureName } = foldInfoList[1];
|
6221
|
+
const { groupName } = unfoldInfo;
|
6222
|
+
result.tooltip = {
|
6223
|
+
visible: enable,
|
6224
|
+
mark: {
|
6225
|
+
title: {
|
6226
|
+
visible: true
|
6227
|
+
},
|
6228
|
+
content: [
|
6229
|
+
...dimensions.map((item)=>({
|
6230
|
+
visible: true,
|
6231
|
+
hasShape: true,
|
6232
|
+
shapeType: 'rectRound',
|
6233
|
+
key: (datum)=>{
|
6234
|
+
if (item.alias || item.id) return item.alias || item.id;
|
6235
|
+
return datum && datum[item.id];
|
6236
|
+
},
|
6237
|
+
value: (datum)=>datum && datum[item.id]
|
6238
|
+
})),
|
6239
|
+
{
|
6240
|
+
visible: true,
|
6241
|
+
hasShape: true,
|
6242
|
+
key: (datum)=>datum && datum[measureName || groupName] || '',
|
6243
|
+
value: (datum)=>{
|
6244
|
+
if (!datum) return '';
|
6245
|
+
const value = datum[measureValue];
|
6246
|
+
const id = datum[measureId];
|
6247
|
+
const measure = findMeasureById(measures, id);
|
6248
|
+
if (!measure) return String(value);
|
6249
|
+
const { format = {}, autoFormat = true } = measure;
|
6250
|
+
if (!(0, external_remeda_namespaceObject.isEmpty)(format)) {
|
6251
|
+
const formatter = createFormatter(format);
|
6252
|
+
return formatter(value);
|
6253
|
+
}
|
6254
|
+
if (autoFormat) return autoFormatter(value, locale);
|
6255
|
+
return String(value);
|
6256
|
+
}
|
6257
|
+
}
|
6258
|
+
]
|
6259
|
+
},
|
6260
|
+
dimension: {
|
6261
|
+
content: [
|
6262
|
+
{
|
6263
|
+
visible: true,
|
6264
|
+
key: (datum)=>datum && datum[groupName] || '',
|
6265
|
+
value: (datum)=>{
|
6266
|
+
if (!datum) return '';
|
6267
|
+
const value = datum[measureValue];
|
6268
|
+
const id = datum[measureId];
|
6269
|
+
const measure = findMeasureById(measures, id);
|
6270
|
+
if (!measure) return String(value);
|
6271
|
+
const { format = {}, autoFormat = true } = measure;
|
6272
|
+
if (!(0, external_remeda_namespaceObject.isEmpty)(format)) {
|
6273
|
+
const formatter = createFormatter(format);
|
6274
|
+
return formatter(value);
|
6275
|
+
}
|
6276
|
+
if (autoFormat) return autoFormatter(value, locale);
|
6277
|
+
return String(value);
|
6278
|
+
},
|
6279
|
+
shapeType: 'rectRound'
|
6280
|
+
}
|
6281
|
+
]
|
6282
|
+
}
|
6283
|
+
};
|
6284
|
+
return result;
|
6285
|
+
};
|
6286
|
+
const yLinearPrimary = (spec, context)=>{
|
6287
|
+
const result = {
|
6288
|
+
...spec
|
6289
|
+
};
|
6290
|
+
const { advancedVSeed, vseed } = context;
|
6291
|
+
const { chartType } = vseed;
|
6292
|
+
const { locale, datasetReshapeInfo } = advancedVSeed;
|
6293
|
+
const config = advancedVSeed.config?.[chartType]?.primaryYAxis;
|
6294
|
+
if (datasetReshapeInfo[0].foldInfoList?.[0] && (0, external_remeda_namespaceObject.isEmpty)(datasetReshapeInfo[0].foldInfoList[0].foldMap)) return result;
|
6295
|
+
const id = `${datasetReshapeInfo[0].id}-primary-axis`;
|
6296
|
+
const seriesId = `${datasetReshapeInfo[0].id}-primary-series`;
|
6297
|
+
if (!result.axes) result.axes = [];
|
6298
|
+
if (!config) {
|
6299
|
+
result.axes = [
|
6300
|
+
...result.axes,
|
6301
|
+
{
|
6302
|
+
visible: true,
|
6303
|
+
id,
|
6304
|
+
seriesId,
|
6305
|
+
type: 'linear',
|
6306
|
+
orient: 'left',
|
6307
|
+
sync: {
|
6308
|
+
axisId: `${datasetReshapeInfo[0].id}-secondary-axis`,
|
6309
|
+
tickAlign: false,
|
6310
|
+
zeroAlign: true
|
6311
|
+
}
|
6312
|
+
}
|
6313
|
+
];
|
6314
|
+
return result;
|
6315
|
+
}
|
6316
|
+
const { visible = true, label, tick, title, grid, line, zero, nice, inverse, max, min, log, logBase = 10 } = config;
|
6317
|
+
const linearAxis = {
|
6318
|
+
visible,
|
6319
|
+
id,
|
6320
|
+
seriesId,
|
6321
|
+
sync: {
|
6322
|
+
axisId: `${datasetReshapeInfo[0].id}-secondary-axis`,
|
6323
|
+
tickAlign: false,
|
6324
|
+
zeroAlign: true
|
6325
|
+
},
|
6326
|
+
type: log ? 'log' : 'linear',
|
6327
|
+
base: logBase,
|
6328
|
+
orient: 'left',
|
6329
|
+
nice,
|
6330
|
+
zero: log ? false : zero,
|
6331
|
+
inverse,
|
6332
|
+
max,
|
6333
|
+
min,
|
6334
|
+
label: {
|
6335
|
+
visible: label?.visible,
|
6336
|
+
formatMethod: (value)=>autoFormatter(value, locale),
|
6337
|
+
style: {
|
6338
|
+
fill: label?.labelColor,
|
6339
|
+
angle: label?.labelAngle,
|
6340
|
+
fontSize: label?.labelFontSize,
|
6341
|
+
fontWeight: label?.labelFontWeight
|
6342
|
+
}
|
6343
|
+
},
|
6344
|
+
title: {
|
6345
|
+
visible: title?.visible,
|
6346
|
+
text: title?.titleText,
|
6347
|
+
style: {
|
6348
|
+
fill: title?.titleColor,
|
6349
|
+
fontSize: title?.titleFontSize,
|
6350
|
+
fontWeight: title?.titleFontWeight
|
6351
|
+
}
|
6352
|
+
},
|
6353
|
+
tick: {
|
6354
|
+
visible: tick?.visible,
|
6355
|
+
tickSize: tick?.tickSize,
|
6356
|
+
inside: tick?.tickInside,
|
6357
|
+
style: {
|
6358
|
+
stroke: tick?.tickColor
|
6359
|
+
}
|
6360
|
+
},
|
6361
|
+
grid: {
|
6362
|
+
visible: grid?.visible,
|
6363
|
+
style: {
|
6364
|
+
lineWidth: grid?.gridWidth,
|
6365
|
+
stroke: grid?.gridColor
|
6366
|
+
}
|
6367
|
+
},
|
6368
|
+
domainLine: {
|
6369
|
+
visible: line?.visible,
|
6370
|
+
style: {
|
6371
|
+
lineWidth: line?.lineWidth,
|
6372
|
+
stroke: line?.lineColor
|
6373
|
+
}
|
6374
|
+
},
|
6375
|
+
innerOffset: {
|
6376
|
+
top: LINEAR_AXIS_INNER_OFFSET_TOP
|
6377
|
+
}
|
6378
|
+
};
|
6379
|
+
result.axes = [
|
6380
|
+
...result.axes,
|
6381
|
+
linearAxis
|
6382
|
+
];
|
6383
|
+
return result;
|
6384
|
+
};
|
6385
|
+
const yLinearSecondary = (spec, context)=>{
|
6386
|
+
const result = {
|
6387
|
+
...spec
|
6388
|
+
};
|
6389
|
+
const { advancedVSeed, vseed } = context;
|
6390
|
+
const { chartType } = vseed;
|
6391
|
+
const { locale, datasetReshapeInfo } = advancedVSeed;
|
6392
|
+
const config = advancedVSeed.config?.[chartType]?.secondaryYAxis;
|
6393
|
+
if ((0, external_remeda_namespaceObject.isNullish)(datasetReshapeInfo[0].foldInfoList?.[1])) return result;
|
6394
|
+
const id = `${datasetReshapeInfo[0].id}-secondary-axis`;
|
6395
|
+
const seriesId = `${datasetReshapeInfo[0].id}-secondary-series`;
|
6396
|
+
if (!result.axes) result.axes = [];
|
6397
|
+
if (!config) {
|
6398
|
+
result.axes = [
|
6399
|
+
...result.axes,
|
6400
|
+
{
|
6401
|
+
visible: true,
|
6402
|
+
id,
|
6403
|
+
seriesId,
|
6404
|
+
type: 'linear',
|
6405
|
+
orient: 'right'
|
6406
|
+
}
|
6407
|
+
];
|
6408
|
+
return result;
|
6409
|
+
}
|
6410
|
+
const { visible = true, label, tick, title, grid, line, zero, nice, inverse, max, min, log, logBase = 10 } = config;
|
6411
|
+
const linearAxis = {
|
6412
|
+
visible,
|
6413
|
+
id,
|
6414
|
+
seriesId,
|
6415
|
+
type: log ? 'log' : 'linear',
|
6416
|
+
base: logBase,
|
6417
|
+
orient: 'right',
|
6418
|
+
nice,
|
6419
|
+
zero: log ? false : zero,
|
6420
|
+
inverse,
|
6421
|
+
max,
|
6422
|
+
min,
|
6423
|
+
label: {
|
6424
|
+
visible: label?.visible,
|
6425
|
+
formatMethod: (value)=>autoFormatter(value, locale),
|
6426
|
+
style: {
|
6427
|
+
fill: label?.labelColor,
|
6428
|
+
angle: label?.labelAngle,
|
6429
|
+
fontSize: label?.labelFontSize,
|
6430
|
+
fontWeight: label?.labelFontWeight
|
6431
|
+
}
|
6432
|
+
},
|
6433
|
+
title: {
|
6434
|
+
visible: title?.visible,
|
6435
|
+
text: title?.titleText,
|
6436
|
+
style: {
|
6437
|
+
fill: title?.titleColor,
|
6438
|
+
fontSize: title?.titleFontSize,
|
6439
|
+
fontWeight: title?.titleFontWeight
|
6440
|
+
}
|
6441
|
+
},
|
6442
|
+
tick: {
|
6443
|
+
visible: tick?.visible,
|
6444
|
+
tickSize: tick?.tickSize,
|
6445
|
+
inside: tick?.tickInside,
|
6446
|
+
style: {
|
6447
|
+
stroke: tick?.tickColor
|
6448
|
+
}
|
6449
|
+
},
|
6450
|
+
grid: {
|
6451
|
+
visible: grid?.visible,
|
6452
|
+
style: {
|
6453
|
+
lineWidth: grid?.gridWidth,
|
6454
|
+
stroke: grid?.gridColor
|
6455
|
+
}
|
6456
|
+
},
|
6457
|
+
domainLine: {
|
6458
|
+
visible: line?.visible,
|
6459
|
+
style: {
|
6460
|
+
lineWidth: line?.lineWidth,
|
6461
|
+
stroke: line?.lineColor
|
6462
|
+
}
|
6463
|
+
},
|
6464
|
+
innerOffset: {
|
6465
|
+
top: LINEAR_AXIS_INNER_OFFSET_TOP
|
6466
|
+
}
|
6467
|
+
};
|
6468
|
+
result.axes = [
|
6469
|
+
...result.axes,
|
6470
|
+
linearAxis
|
6471
|
+
];
|
6472
|
+
return result;
|
6473
|
+
};
|
6474
|
+
const dualAxis = [
|
6475
|
+
series([
|
6476
|
+
initDualAxisPrimary,
|
6477
|
+
dualChartTypePrimary,
|
6478
|
+
datasetPrimary,
|
6479
|
+
labelPrimary,
|
6480
|
+
tooltipPrimary,
|
6481
|
+
progressive,
|
6482
|
+
barStyle_barStyle,
|
6483
|
+
pointStyle_pointStyle,
|
6484
|
+
pointStateDimensionHover,
|
6485
|
+
lineStyle_lineStyle,
|
6486
|
+
areaStyle_areaStyle
|
6487
|
+
], [
|
6488
|
+
initDualAxisSecondary,
|
6489
|
+
dualChartTypeSecondary,
|
6490
|
+
datasetSecondary,
|
6491
|
+
labelSecondary,
|
6492
|
+
tooltipSecondary,
|
6493
|
+
progressive,
|
6494
|
+
barStyle_barStyle,
|
6495
|
+
pointStyle_pointStyle,
|
6496
|
+
pointStateDimensionHover,
|
6497
|
+
lineStyle_lineStyle,
|
6498
|
+
areaStyle_areaStyle
|
6499
|
+
]),
|
6500
|
+
xBand,
|
6501
|
+
yLinearPrimary,
|
6502
|
+
yLinearSecondary,
|
6503
|
+
color_color,
|
6504
|
+
background_backgroundColor,
|
6505
|
+
discreteLegend,
|
6506
|
+
verticalCrosshairRect,
|
6507
|
+
annotationPoint_annotationPoint,
|
6508
|
+
annotationVerticalLine_annotationVerticalLine,
|
6509
|
+
annotationHorizontalLine_annotationHorizontalLine,
|
6510
|
+
annotationArea_annotationArea
|
6511
|
+
];
|
6512
|
+
const pivotDualAxis = [
|
6513
|
+
initPivot,
|
6514
|
+
pivotGridStyle,
|
6515
|
+
pivotIndicators_pivotIndicatorsAsRow,
|
6516
|
+
datasetPivot,
|
6517
|
+
pivotIndicators_pivotIndicators([
|
6518
|
+
series([
|
6519
|
+
initDualAxisPrimary,
|
6520
|
+
dualChartTypePrimary,
|
6521
|
+
datasetPrimary,
|
6522
|
+
labelPrimary,
|
6523
|
+
tooltipPrimary,
|
6524
|
+
progressive,
|
6525
|
+
barStyle_barStyle,
|
6526
|
+
pointStyle_pointStyle,
|
6527
|
+
pointStateDimensionHover,
|
6528
|
+
lineStyle_lineStyle,
|
6529
|
+
areaStyle_areaStyle
|
6530
|
+
], [
|
6531
|
+
initDualAxisSecondary,
|
6532
|
+
dualChartTypeSecondary,
|
6533
|
+
datasetSecondary,
|
6534
|
+
labelSecondary,
|
6535
|
+
tooltipSecondary,
|
6536
|
+
progressive,
|
6537
|
+
barStyle_barStyle,
|
6538
|
+
pointStyle_pointStyle,
|
6539
|
+
pointStateDimensionHover,
|
6540
|
+
lineStyle_lineStyle,
|
6541
|
+
areaStyle_areaStyle
|
6542
|
+
]),
|
6543
|
+
xBand,
|
6544
|
+
yLinearPrimary,
|
6545
|
+
yLinearSecondary,
|
6546
|
+
color_color,
|
6547
|
+
background_backgroundColor,
|
6548
|
+
verticalCrosshairRect,
|
6549
|
+
annotationPoint_annotationPoint,
|
6550
|
+
annotationVerticalLine_annotationVerticalLine,
|
6551
|
+
annotationHorizontalLine_annotationHorizontalLine,
|
6552
|
+
annotationArea_annotationArea
|
6553
|
+
]),
|
6554
|
+
pivotRowDimensions,
|
6555
|
+
pivotColumnDimensions,
|
6556
|
+
pivotDiscreteLegend
|
6557
|
+
];
|
6558
|
+
const dualAxisSpecPipeline = [
|
6559
|
+
pivotAdapter_pivotAdapter(dualAxis, pivotDualAxis)
|
6560
|
+
];
|
6561
|
+
const registerDualAxis = ()=>{
|
6562
|
+
Builder._advancedPipelineMap.dualAxis = dualAxisAdvancedPipeline;
|
6563
|
+
Builder._specPipelineMap.dualAxis = dualAxisSpecPipeline;
|
6564
|
+
};
|
6565
|
+
const dataReshapeFor1D1M_emptyReshapeResult = {
|
6566
|
+
dataset: [],
|
6567
|
+
foldInfo: {
|
6568
|
+
foldMap: {},
|
6569
|
+
measureId: '',
|
6570
|
+
measureName: '',
|
6571
|
+
measureValue: ''
|
6572
|
+
},
|
6573
|
+
unfoldInfo: {
|
6574
|
+
groupName: '',
|
6575
|
+
groupId: '',
|
6576
|
+
colorItems: [],
|
6577
|
+
colorIdMap: {}
|
6578
|
+
}
|
6579
|
+
};
|
6580
|
+
const dataReshapeFor1D1M = (dataset, dimensions, measures, options)=>{
|
6581
|
+
const { foldMeasureId = FoldMeasureId, foldMeasureName = FoldMeasureName, foldMeasureValue = FoldMeasureValue, unfoldDimensionGroup = UnfoldDimensionGroup, unfoldDimensionGroupId = UnfoldDimensionGroupId } = options || {};
|
6582
|
+
if (0 === dimensions.length && 0 === measures.length) return dataReshapeFor1D1M_emptyReshapeResult;
|
6583
|
+
const { dataset: foldedDataset, foldInfo } = foldMeasures(dataset, measures, foldMeasureId, foldMeasureName, foldMeasureValue);
|
6584
|
+
if (0 === dimensions.length) {
|
6585
|
+
const { dataset: finalDataset, unfoldInfo } = unfoldDimensions(foldedDataset, [
|
6586
|
+
{
|
6587
|
+
id: foldMeasureName,
|
6588
|
+
alias: i18n`指标名称`,
|
6589
|
+
location: 'dimension'
|
6590
|
+
}
|
6591
|
+
], [
|
6592
|
+
{
|
6593
|
+
id: foldMeasureValue,
|
6594
|
+
alias: i18n`指标值`
|
6595
|
+
}
|
6596
|
+
], 0, unfoldDimensionGroup, unfoldDimensionGroupId, foldMeasureId);
|
6597
|
+
return {
|
6598
|
+
dataset: finalDataset,
|
6599
|
+
foldInfo,
|
6600
|
+
unfoldInfo
|
6601
|
+
};
|
6602
|
+
}
|
6603
|
+
{
|
6604
|
+
const dims = 1 === measures.length ? [
|
6605
|
+
...dimensions
|
6606
|
+
] : [
|
6607
|
+
...dimensions,
|
6608
|
+
{
|
6609
|
+
id: foldMeasureName,
|
6610
|
+
alias: i18n`指标名称`,
|
6611
|
+
location: 'dimension'
|
6612
|
+
}
|
6613
|
+
];
|
6614
|
+
const { dataset: finalDataset, unfoldInfo } = unfoldDimensions(foldedDataset, dims, [
|
6615
|
+
{
|
6616
|
+
id: foldMeasureValue,
|
6617
|
+
alias: i18n`指标值`
|
6618
|
+
}
|
6619
|
+
], 0, unfoldDimensionGroup, unfoldDimensionGroupId, foldMeasureId);
|
6620
|
+
return {
|
6621
|
+
dataset: finalDataset,
|
6622
|
+
foldInfo,
|
6623
|
+
unfoldInfo
|
6624
|
+
};
|
6625
|
+
}
|
6626
|
+
};
|
6627
|
+
const reshapeTo1D1M = (advancedVSeed, context)=>{
|
6628
|
+
const result = {
|
6629
|
+
...advancedVSeed
|
6630
|
+
};
|
6631
|
+
const { vseed } = context;
|
6632
|
+
const { dataset } = vseed;
|
6633
|
+
const { dimensions, measures } = advancedVSeed;
|
6634
|
+
if (!measures || !dimensions || !dataset) return result;
|
6635
|
+
if (0 === measures.length) throw new Error('measures can not be empty');
|
6636
|
+
const { dataset: newDatasets, foldInfo, unfoldInfo } = dataReshapeFor1D1M(dataset, dimensions, measures);
|
6637
|
+
return {
|
6638
|
+
...result,
|
6639
|
+
dataset: newDatasets,
|
6640
|
+
datasetReshapeInfo: [
|
6641
|
+
{
|
6642
|
+
id: '1D1M',
|
6643
|
+
index: 0,
|
6644
|
+
foldInfo,
|
6645
|
+
unfoldInfo
|
6646
|
+
}
|
6647
|
+
]
|
6648
|
+
};
|
6649
|
+
};
|
6650
|
+
const pivotReshapeTo1D1M = (advancedVSeed, context)=>{
|
6651
|
+
const result = {
|
6652
|
+
...advancedVSeed
|
6653
|
+
};
|
6654
|
+
const { vseed } = context;
|
6655
|
+
const { dataset } = vseed;
|
6656
|
+
const { measures } = advancedVSeed;
|
6657
|
+
const dimensions = advancedVSeed.dimensions;
|
6658
|
+
if (!measures || !dimensions) return result;
|
6659
|
+
const measureGroups = [];
|
6660
|
+
if (measures) measures.forEach((measure)=>{
|
6661
|
+
if (measure.children && measure.children.length > 0) measureGroups.push(measure);
|
6662
|
+
});
|
6663
|
+
const newDatasets = [];
|
6664
|
+
const datasetReshapeInfo = [];
|
6665
|
+
measureGroups.forEach((measureGroup, index)=>{
|
6666
|
+
const measures = measureGroup.children;
|
6667
|
+
if (!measures) return;
|
6668
|
+
const commonDimensions = dimensions.filter((dim)=>'dimension' === dim.location);
|
6669
|
+
const groupId = measureGroup.id;
|
6670
|
+
const { dataset: newSubDataset, foldInfo, unfoldInfo } = dataReshapeFor1D1M(dataset, commonDimensions, measures, {
|
6671
|
+
foldMeasureId: FoldMeasureId,
|
6672
|
+
foldMeasureName: FoldMeasureName,
|
6673
|
+
foldMeasureValue: FoldMeasureValue + groupId,
|
6674
|
+
unfoldDimensionGroup: UnfoldDimensionGroup
|
6675
|
+
});
|
6676
|
+
const reshapeInfo = {
|
6677
|
+
id: groupId,
|
6678
|
+
index,
|
6679
|
+
foldInfo,
|
6680
|
+
unfoldInfo
|
6681
|
+
};
|
6682
|
+
newDatasets.push(newSubDataset);
|
6683
|
+
datasetReshapeInfo.push(reshapeInfo);
|
6684
|
+
});
|
6685
|
+
return {
|
6686
|
+
...result,
|
6687
|
+
dataset: newDatasets,
|
6688
|
+
datasetReshapeInfo: datasetReshapeInfo
|
6689
|
+
};
|
6690
|
+
};
|
6691
|
+
const encodingPie = (advancedVSeed)=>{
|
6692
|
+
const result = {
|
6693
|
+
...advancedVSeed
|
6694
|
+
};
|
6695
|
+
const { datasetReshapeInfo } = advancedVSeed;
|
6696
|
+
if (!datasetReshapeInfo) return result;
|
6697
|
+
const encoding = datasetReshapeInfo.reduce((prev, cur)=>{
|
6698
|
+
const { foldInfo, unfoldInfo } = cur;
|
6699
|
+
const radius = [
|
6700
|
+
foldInfo.measureValue
|
6701
|
+
];
|
6702
|
+
const angle = [
|
6703
|
+
unfoldInfo.groupId
|
6704
|
+
];
|
6705
|
+
const group = [
|
6706
|
+
unfoldInfo.groupId
|
6707
|
+
];
|
6708
|
+
const color = [
|
6709
|
+
unfoldInfo.groupId
|
6710
|
+
];
|
6711
|
+
return [
|
6712
|
+
...prev,
|
6713
|
+
{
|
6714
|
+
angle,
|
6715
|
+
radius,
|
6716
|
+
group,
|
6717
|
+
color
|
6718
|
+
}
|
6719
|
+
];
|
6720
|
+
}, []);
|
6721
|
+
return {
|
6722
|
+
...result,
|
6723
|
+
encoding
|
6724
|
+
};
|
6725
|
+
};
|
6726
|
+
const pieAdvancedPipeline = [
|
6727
|
+
initAdvancedVSeed_initAdvancedVSeed,
|
6728
|
+
autoMeasures_autoMeasures,
|
6729
|
+
autoDimensions_autoDimensions,
|
6730
|
+
pivotAdapter([
|
6731
|
+
reshapeTo1D1M
|
6732
|
+
], [
|
6733
|
+
pivotReshapeTo1D1M
|
6734
|
+
]),
|
6735
|
+
encodingPie,
|
6736
|
+
pieConfig,
|
6737
|
+
theme_theme,
|
6738
|
+
annotation_annotation
|
6739
|
+
];
|
6740
|
+
const initPie = (spec, context)=>{
|
6741
|
+
const result = {
|
6742
|
+
...spec
|
6743
|
+
};
|
6744
|
+
const { advancedVSeed } = context;
|
6745
|
+
const { encoding, dataset } = advancedVSeed;
|
6746
|
+
if (!encoding[0].angle || !encoding[0].radius || !encoding[0].group) return result;
|
6747
|
+
const showStroke = dataset.length <= 30;
|
6748
|
+
result.type = 'pie';
|
6749
|
+
result.outerRadius = 0.8;
|
6750
|
+
result.innerRadius = 0;
|
6751
|
+
result.valueField = encoding[0].radius[0];
|
6752
|
+
result.categoryField = encoding[0].angle[0];
|
6753
|
+
result.seriesField = encoding[0].group[0];
|
6754
|
+
result.padding = 0;
|
6755
|
+
result.region = [
|
6756
|
+
{
|
6757
|
+
clip: true
|
6758
|
+
}
|
6759
|
+
];
|
6760
|
+
result.pie = {
|
6761
|
+
style: {
|
6762
|
+
stroke: '#ffffff',
|
6763
|
+
lineWidth: showStroke ? 1 : 0,
|
6764
|
+
centerOffset: 0
|
6765
|
+
},
|
6766
|
+
state: {
|
6767
|
+
hover: {
|
6768
|
+
outerRadius: 1.1 * result.outerRadius
|
6769
|
+
}
|
6770
|
+
}
|
6771
|
+
};
|
6772
|
+
result.animation = true;
|
6773
|
+
return result;
|
6774
|
+
};
|
6775
|
+
const pie = [
|
6776
|
+
initPie,
|
6777
|
+
color_color,
|
6778
|
+
background_backgroundColor,
|
6779
|
+
datasetXY,
|
6780
|
+
progressive,
|
6781
|
+
label_label,
|
5734
6782
|
tooltip_tooltip,
|
5735
6783
|
discreteLegend,
|
5736
6784
|
annotationPoint_annotationPoint,
|
@@ -6981,6 +8029,22 @@ const lightTheme = ()=>{
|
|
6981
8029
|
},
|
6982
8030
|
crosshairLine
|
6983
8031
|
},
|
8032
|
+
dualAxis: {
|
8033
|
+
...baseConfig,
|
8034
|
+
xAxis: bandAxis,
|
8035
|
+
primaryYAxis: linearAxis,
|
8036
|
+
secondaryYAxis: {
|
8037
|
+
...linearAxis,
|
8038
|
+
grid: {
|
8039
|
+
visible: false
|
8040
|
+
}
|
8041
|
+
},
|
8042
|
+
dualChartType: {
|
8043
|
+
primary: 'column',
|
8044
|
+
secondary: 'line'
|
8045
|
+
},
|
8046
|
+
crosshairRect
|
8047
|
+
},
|
6984
8048
|
pie: {
|
6985
8049
|
...baseConfig
|
6986
8050
|
},
|
@@ -7303,6 +8367,22 @@ const darkTheme = ()=>{
|
|
7303
8367
|
},
|
7304
8368
|
crosshairLine
|
7305
8369
|
},
|
8370
|
+
dualAxis: {
|
8371
|
+
...baseConfig,
|
8372
|
+
xAxis: bandAxis,
|
8373
|
+
primaryYAxis: linearAxis,
|
8374
|
+
secondaryYAxis: {
|
8375
|
+
...linearAxis,
|
8376
|
+
grid: {
|
8377
|
+
visible: false
|
8378
|
+
}
|
8379
|
+
},
|
8380
|
+
dualChartType: {
|
8381
|
+
primary: 'column',
|
8382
|
+
secondary: 'line'
|
8383
|
+
},
|
8384
|
+
crosshairRect
|
8385
|
+
},
|
7306
8386
|
pie: {
|
7307
8387
|
...baseConfig
|
7308
8388
|
},
|
@@ -7368,6 +8448,7 @@ const registerAll = ()=>{
|
|
7368
8448
|
registerAreaPercent();
|
7369
8449
|
registerAreaRange();
|
7370
8450
|
registerScatter();
|
8451
|
+
registerDualAxis();
|
7371
8452
|
registerPie();
|
7372
8453
|
registerDonut();
|
7373
8454
|
registerRose();
|
@@ -7408,6 +8489,22 @@ const zChartType = external_zod_namespaceObject.z["enum"]([
|
|
7408
8489
|
'funnel',
|
7409
8490
|
'heatmap'
|
7410
8491
|
]);
|
8492
|
+
const zDualChartType = external_zod_namespaceObject.z.object({
|
8493
|
+
primary: external_zod_namespaceObject.z["enum"]([
|
8494
|
+
'line',
|
8495
|
+
'column',
|
8496
|
+
'columnParallel',
|
8497
|
+
'area',
|
8498
|
+
'scatter'
|
8499
|
+
]).default('column'),
|
8500
|
+
secondary: external_zod_namespaceObject.z["enum"]([
|
8501
|
+
'line',
|
8502
|
+
'column',
|
8503
|
+
'columnParallel',
|
8504
|
+
'area',
|
8505
|
+
'scatter'
|
8506
|
+
]).default('line')
|
8507
|
+
});
|
7411
8508
|
const zDatum = external_zod_namespaceObject.z.record(external_zod_namespaceObject.z.string().or(external_zod_namespaceObject.z.number()), external_zod_namespaceObject.z.any());
|
7412
8509
|
const zDataset = external_zod_namespaceObject.z.array(zDatum);
|
7413
8510
|
const zDimension = external_zod_namespaceObject.z.object({
|
@@ -7473,6 +8570,14 @@ const zMeasureGroup = external_zod_namespaceObject.z.object({
|
|
7473
8570
|
});
|
7474
8571
|
const zMeasures = external_zod_namespaceObject.z.array(zMeasure);
|
7475
8572
|
const zMeasureTree = external_zod_namespaceObject.z.array(zMeasureGroup.or(zMeasure));
|
8573
|
+
const zDualMeasure = external_zod_namespaceObject.z.object({
|
8574
|
+
id: external_zod_namespaceObject.z.string(),
|
8575
|
+
primaryMeasures: external_zod_namespaceObject.z.array(zMeasure).or(zMeasure).optional(),
|
8576
|
+
primaryAlias: external_zod_namespaceObject.z.string().optional(),
|
8577
|
+
secondaryMeasures: external_zod_namespaceObject.z.array(zMeasure).or(zMeasure).optional(),
|
8578
|
+
secondaryAlias: external_zod_namespaceObject.z.string().optional()
|
8579
|
+
});
|
8580
|
+
const zDualMeasures = external_zod_namespaceObject.z.array(zDualMeasure);
|
7476
8581
|
const zFoldInfo = external_zod_namespaceObject.z.object({
|
7477
8582
|
foldMap: external_zod_namespaceObject.z.record(external_zod_namespaceObject.z.string(), external_zod_namespaceObject.z.string().or(external_zod_namespaceObject.z.undefined())),
|
7478
8583
|
measureId: external_zod_namespaceObject.z.string(),
|
@@ -7487,7 +8592,9 @@ const zUnfoldInfo = external_zod_namespaceObject.z.object({
|
|
7487
8592
|
});
|
7488
8593
|
const zDatasetReshapeInfo = external_zod_namespaceObject.z.array(external_zod_namespaceObject.z.object({
|
7489
8594
|
id: external_zod_namespaceObject.z.string(),
|
8595
|
+
index: external_zod_namespaceObject.z.number(),
|
7490
8596
|
foldInfo: zFoldInfo,
|
8597
|
+
foldInfoList: external_zod_namespaceObject.z.array(zFoldInfo).optional(),
|
7491
8598
|
unfoldInfo: zUnfoldInfo
|
7492
8599
|
}));
|
7493
8600
|
const zEncoding = external_zod_namespaceObject.z.array(external_zod_namespaceObject.z.object({
|
@@ -7767,7 +8874,12 @@ const zDualAxisConfig = external_zod_namespaceObject.z.object({
|
|
7767
8874
|
label: zLabel.optional(),
|
7768
8875
|
color: zColor.optional(),
|
7769
8876
|
tooltip: zTooltip.optional(),
|
7770
|
-
legend: zLegend.optional()
|
8877
|
+
legend: zLegend.optional(),
|
8878
|
+
dualChartType: external_zod_namespaceObject.z.array(zDualChartType).or(zDualChartType).optional(),
|
8879
|
+
primaryYAxis: external_zod_namespaceObject.z.array(zYLinearAxis).or(zYLinearAxis).optional(),
|
8880
|
+
secondaryYAxis: external_zod_namespaceObject.z.array(zYLinearAxis).or(zYLinearAxis).optional(),
|
8881
|
+
xAxis: zXBandAxis.optional(),
|
8882
|
+
crosshairRect: zCrosshairRect.optional()
|
7771
8883
|
});
|
7772
8884
|
const zScatterConfig = external_zod_namespaceObject.z.object({
|
7773
8885
|
backgroundColor: zBackgroundColor.optional(),
|
@@ -7811,8 +8923,8 @@ const zConfig = external_zod_namespaceObject.z.object({
|
|
7811
8923
|
area: zAreaConfig.optional(),
|
7812
8924
|
areaPercent: zAreaPercentConfig.optional(),
|
7813
8925
|
areaRange: zAreaRangeConfig.optional(),
|
7814
|
-
dualAxis: zDualAxisConfig.optional(),
|
7815
8926
|
scatter: zScatterConfig.optional(),
|
8927
|
+
dualAxis: zDualAxisConfig.optional(),
|
7816
8928
|
rose: zRoseConfig.optional(),
|
7817
8929
|
roseParallel: zRoseParallelConfig.optional(),
|
7818
8930
|
pie: zPieConfig.optional(),
|
@@ -8465,6 +9577,35 @@ const zScatter = external_zod_namespaceObject.z.object({
|
|
8465
9577
|
annotationArea: external_zod_namespaceObject.z.array(zAnnotationArea).or(zAnnotationArea).optional(),
|
8466
9578
|
locale: zLocale.optional()
|
8467
9579
|
});
|
9580
|
+
const zDualAxis = external_zod_namespaceObject.z.object({
|
9581
|
+
chartType: external_zod_namespaceObject.z.literal('dualAxis'),
|
9582
|
+
dataset: zDataset.optional(),
|
9583
|
+
dimensions: zDimensions.optional(),
|
9584
|
+
measures: zMeasureTree.optional(),
|
9585
|
+
dualMeasures: zDualMeasures.optional(),
|
9586
|
+
dualChartType: external_zod_namespaceObject.z.array(zDualChartType).or(zDualChartType).optional(),
|
9587
|
+
primaryYAxis: external_zod_namespaceObject.z.array(zYLinearAxis).or(zYLinearAxis).optional(),
|
9588
|
+
secondaryYAxis: external_zod_namespaceObject.z.array(zYLinearAxis).or(zYLinearAxis).optional(),
|
9589
|
+
xAxis: zXBandAxis.optional(),
|
9590
|
+
backgroundColor: zBackgroundColor.optional(),
|
9591
|
+
color: zColor.optional(),
|
9592
|
+
label: zLabel.optional(),
|
9593
|
+
legend: zLegend.optional(),
|
9594
|
+
tooltip: zTooltip.optional(),
|
9595
|
+
crosshairRect: zCrosshairRect.optional(),
|
9596
|
+
sort: zSort.optional(),
|
9597
|
+
sortLegend: zSortLegend.optional(),
|
9598
|
+
theme: zTheme.optional(),
|
9599
|
+
barStyle: external_zod_namespaceObject.z.array(zBarStyle).or(zBarStyle).optional(),
|
9600
|
+
pointStyle: external_zod_namespaceObject.z.array(zPointStyle).or(zPointStyle).optional(),
|
9601
|
+
lineStyle: external_zod_namespaceObject.z.array(zLineStyle).or(zLineStyle).optional(),
|
9602
|
+
areaStyle: external_zod_namespaceObject.z.array(zAreaStyle).or(zAreaStyle).optional(),
|
9603
|
+
annotationPoint: external_zod_namespaceObject.z.array(zAnnotationPoint).or(zAnnotationPoint).optional(),
|
9604
|
+
annotationVerticalLine: external_zod_namespaceObject.z.array(zAnnotationVerticalLine).or(zAnnotationVerticalLine).optional(),
|
9605
|
+
annotationHorizontalLine: external_zod_namespaceObject.z.array(zAnnotationHorizontalLine).or(zAnnotationHorizontalLine).optional(),
|
9606
|
+
annotationArea: external_zod_namespaceObject.z.array(zAnnotationArea).or(zAnnotationArea).optional(),
|
9607
|
+
locale: zLocale.optional()
|
9608
|
+
});
|
8468
9609
|
const zRose = external_zod_namespaceObject.z.object({
|
8469
9610
|
chartType: external_zod_namespaceObject.z.literal('rose'),
|
8470
9611
|
dataset: zDataset.optional(),
|
@@ -8570,6 +9711,7 @@ const zVSeed = external_zod_namespaceObject.z.discriminatedUnion('chartType', [
|
|
8570
9711
|
zAreaPercent,
|
8571
9712
|
zAreaRange,
|
8572
9713
|
zScatter,
|
9714
|
+
zDualAxis,
|
8573
9715
|
zPie,
|
8574
9716
|
zDonut,
|
8575
9717
|
zRose,
|
@@ -8597,6 +9739,8 @@ exports.Builder = __webpack_exports__.Builder;
|
|
8597
9739
|
exports.FoldMeasureId = __webpack_exports__.FoldMeasureId;
|
8598
9740
|
exports.FoldMeasureName = __webpack_exports__.FoldMeasureName;
|
8599
9741
|
exports.FoldMeasureValue = __webpack_exports__.FoldMeasureValue;
|
9742
|
+
exports.FoldPrimaryMeasureValue = __webpack_exports__.FoldPrimaryMeasureValue;
|
9743
|
+
exports.FoldSecondaryMeasureValue = __webpack_exports__.FoldSecondaryMeasureValue;
|
8600
9744
|
exports.ORIGINAL_DATA = __webpack_exports__.ORIGINAL_DATA;
|
8601
9745
|
exports.Separator = __webpack_exports__.Separator;
|
8602
9746
|
exports.UnfoldDimensionGroup = __webpack_exports__.UnfoldDimensionGroup;
|
@@ -8631,6 +9775,8 @@ exports.dataReshapeFor2D1M = __webpack_exports__.dataReshapeFor2D1M;
|
|
8631
9775
|
exports.dataReshapeFor2D1M0Name = __webpack_exports__.dataReshapeFor2D1M0Name;
|
8632
9776
|
exports.donutAdvancedPipeline = __webpack_exports__.donutAdvancedPipeline;
|
8633
9777
|
exports.donutSpecPipeline = __webpack_exports__.donutSpecPipeline;
|
9778
|
+
exports.dualAxisAdvancedPipeline = __webpack_exports__.dualAxisAdvancedPipeline;
|
9779
|
+
exports.dualAxisSpecPipeline = __webpack_exports__.dualAxisSpecPipeline;
|
8634
9780
|
exports.execPipeline = __webpack_exports__.execPipeline;
|
8635
9781
|
exports.findAllDimensions = __webpack_exports__.findAllDimensions;
|
8636
9782
|
exports.findAllMeasures = __webpack_exports__.findAllMeasures;
|
@@ -8657,6 +9803,7 @@ exports.isValueSelector = __webpack_exports__.isValueSelector;
|
|
8657
9803
|
exports.lightTheme = __webpack_exports__.lightTheme;
|
8658
9804
|
exports.lineAdvancedPipeline = __webpack_exports__.lineAdvancedPipeline;
|
8659
9805
|
exports.lineSpecPipeline = __webpack_exports__.lineSpecPipeline;
|
9806
|
+
exports.measureDepth = __webpack_exports__.measureDepth;
|
8660
9807
|
exports.pieAdvancedPipeline = __webpack_exports__.pieAdvancedPipeline;
|
8661
9808
|
exports.pieSpecPipeline = __webpack_exports__.pieSpecPipeline;
|
8662
9809
|
exports.pivotTableAdvancedPipeline = __webpack_exports__.pivotTableAdvancedPipeline;
|
@@ -8746,7 +9893,11 @@ exports.zDimensionTree = __webpack_exports__.zDimensionTree;
|
|
8746
9893
|
exports.zDimensions = __webpack_exports__.zDimensions;
|
8747
9894
|
exports.zDonut = __webpack_exports__.zDonut;
|
8748
9895
|
exports.zDonutConfig = __webpack_exports__.zDonutConfig;
|
9896
|
+
exports.zDualAxis = __webpack_exports__.zDualAxis;
|
8749
9897
|
exports.zDualAxisConfig = __webpack_exports__.zDualAxisConfig;
|
9898
|
+
exports.zDualChartType = __webpack_exports__.zDualChartType;
|
9899
|
+
exports.zDualMeasure = __webpack_exports__.zDualMeasure;
|
9900
|
+
exports.zDualMeasures = __webpack_exports__.zDualMeasures;
|
8750
9901
|
exports.zEncoding = __webpack_exports__.zEncoding;
|
8751
9902
|
exports.zFoldInfo = __webpack_exports__.zFoldInfo;
|
8752
9903
|
exports.zFunnel = __webpack_exports__.zFunnel;
|
@@ -8797,6 +9948,8 @@ for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
8797
9948
|
"FoldMeasureId",
|
8798
9949
|
"FoldMeasureName",
|
8799
9950
|
"FoldMeasureValue",
|
9951
|
+
"FoldPrimaryMeasureValue",
|
9952
|
+
"FoldSecondaryMeasureValue",
|
8800
9953
|
"ORIGINAL_DATA",
|
8801
9954
|
"Separator",
|
8802
9955
|
"UnfoldDimensionGroup",
|
@@ -8831,6 +9984,8 @@ for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
8831
9984
|
"dataReshapeFor2D1M0Name",
|
8832
9985
|
"donutAdvancedPipeline",
|
8833
9986
|
"donutSpecPipeline",
|
9987
|
+
"dualAxisAdvancedPipeline",
|
9988
|
+
"dualAxisSpecPipeline",
|
8834
9989
|
"execPipeline",
|
8835
9990
|
"findAllDimensions",
|
8836
9991
|
"findAllMeasures",
|
@@ -8857,6 +10012,7 @@ for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
8857
10012
|
"lightTheme",
|
8858
10013
|
"lineAdvancedPipeline",
|
8859
10014
|
"lineSpecPipeline",
|
10015
|
+
"measureDepth",
|
8860
10016
|
"pieAdvancedPipeline",
|
8861
10017
|
"pieSpecPipeline",
|
8862
10018
|
"pivotTableAdvancedPipeline",
|
@@ -8946,7 +10102,11 @@ for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
8946
10102
|
"zDimensions",
|
8947
10103
|
"zDonut",
|
8948
10104
|
"zDonutConfig",
|
10105
|
+
"zDualAxis",
|
8949
10106
|
"zDualAxisConfig",
|
10107
|
+
"zDualChartType",
|
10108
|
+
"zDualMeasure",
|
10109
|
+
"zDualMeasures",
|
8950
10110
|
"zEncoding",
|
8951
10111
|
"zFoldInfo",
|
8952
10112
|
"zFunnel",
|