@visactor/vseed 0.1.1 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/builder/builder/builder.d.ts +120 -28
- package/dist/dataReshape/constant.d.ts +0 -8
- package/dist/dataReshape/dataReshapeByEncoding.d.ts +1 -0
- package/dist/dataReshape/foldMeasures.d.ts +7 -24
- package/dist/index.cjs +820 -506
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +802 -464
- package/dist/index.js.map +1 -1
- package/dist/pipeline/advanced/chart/pipes/encoding/index.d.ts +1 -0
- package/dist/pipeline/advanced/chart/pipes/{init/autoDualMeasures.d.ts → encoding/line.d.ts} +1 -1
- package/dist/pipeline/advanced/chart/pipes/index.d.ts +1 -0
- package/dist/pipeline/advanced/chart/pipes/init/index.d.ts +0 -3
- package/dist/pipeline/advanced/chart/pipes/{init/autoMeasures.d.ts → measures/buildMeasures.d.ts} +1 -1
- package/dist/pipeline/advanced/chart/pipes/measures/buildMeasuresForDualAxis.d.ts +2 -0
- package/dist/pipeline/advanced/chart/pipes/measures/buildMeasuresForScatter.d.ts +2 -0
- package/dist/pipeline/advanced/chart/pipes/measures/index.d.ts +3 -0
- package/dist/pipeline/advanced/chart/pipes/measures/utils.d.ts +28 -0
- package/dist/pipeline/spec/chart/pipes/color/colorAdapter.d.ts +4 -0
- package/dist/pipeline/spec/chart/pipes/color/colorAreaStyleFill.d.ts +2 -0
- package/dist/pipeline/spec/chart/pipes/color/colorBarStyleFill.d.ts +2 -0
- package/dist/pipeline/spec/chart/pipes/color/colorLineStyleFill.d.ts +2 -0
- package/dist/pipeline/spec/chart/pipes/color/colorPointStyleFill.d.ts +2 -0
- package/dist/pipeline/spec/chart/pipes/color/index.d.ts +7 -0
- package/dist/pipeline/spec/chart/pipes/{tooltip/tooltipDisable.d.ts → color/linearColor.d.ts} +1 -1
- package/dist/pipeline/spec/chart/pipes/color/linearColorForDualAxis.d.ts +2 -0
- package/dist/pipeline/spec/chart/pipes/legend/colorLegend.d.ts +2 -0
- package/dist/pipeline/spec/chart/pipes/legend/index.d.ts +2 -0
- package/dist/pipeline/spec/chart/pipes/legend/pivotColorLegend.d.ts +2 -0
- package/dist/pipeline/spec/chart/pipes/tooltip/index.d.ts +0 -1
- package/dist/pipeline/utils/chatType.d.ts +1 -1
- package/dist/pipeline/utils/dimensions/find.d.ts +0 -2
- package/dist/pipeline/utils/dimensions/index.d.ts +0 -1
- package/dist/pipeline/utils/dimensions/typeGuard.d.ts +0 -4
- package/dist/types/advancedVSeed.d.ts +53 -14
- package/dist/types/chartType/area/zArea.d.ts +14 -0
- package/dist/types/chartType/areaPercent/zAreaPercent.d.ts +14 -0
- package/dist/types/chartType/bar/zBar.d.ts +14 -0
- package/dist/types/chartType/barParallel/zBarParallel.d.ts +14 -0
- package/dist/types/chartType/barPercent/zBarPercent.d.ts +14 -0
- package/dist/types/chartType/column/zColumn.d.ts +14 -0
- package/dist/types/chartType/columnParallel/zColumnParallel.d.ts +14 -0
- package/dist/types/chartType/columnPercent/zColumnPercent.d.ts +14 -0
- package/dist/types/chartType/donut/zDonut.d.ts +14 -0
- package/dist/types/chartType/dualAxis/zDualAxis.d.ts +66 -0
- package/dist/types/chartType/funnel/zFunnel.d.ts +15 -0
- package/dist/types/chartType/heatmap/zHeatmap.d.ts +15 -0
- package/dist/types/chartType/line/line.d.ts +0 -1
- package/dist/types/chartType/line/zLine.d.ts +14 -0
- package/dist/types/chartType/pie/zPie.d.ts +14 -0
- package/dist/types/chartType/pivotTable/zPivotTable.d.ts +13 -0
- package/dist/types/chartType/radar/zRadar.d.ts +14 -0
- package/dist/types/chartType/rose/zRose.d.ts +14 -0
- package/dist/types/chartType/roseParallel/zRoseParallel.d.ts +14 -0
- package/dist/types/chartType/scatter/zScatter.d.ts +66 -0
- package/dist/types/chartType/table/zTable.d.ts +13 -0
- package/dist/types/properties/config/color/color.d.ts +8 -2
- package/dist/types/properties/config/config.d.ts +36 -0
- package/dist/types/properties/config/legend/legend.d.ts +9 -5
- package/dist/types/properties/datasetReshapeInfo/datasetReshapeInfo.d.ts +2 -0
- package/dist/types/properties/datasetReshapeInfo/zDatasetReshapeInfo.d.ts +6 -0
- package/dist/types/properties/encoding/encoding.d.ts +0 -1
- package/dist/types/properties/encoding/index.d.ts +2 -2
- package/dist/types/properties/encoding/zEncoding.d.ts +0 -14
- package/dist/types/properties/measures/dualMeasures.d.ts +1 -0
- package/dist/types/properties/measures/measures.d.ts +19 -0
- package/dist/types/properties/measures/scatterMeasures.d.ts +1 -0
- package/dist/types/properties/measures/zDualMeasures.d.ts +104 -0
- package/dist/types/properties/measures/zMeasures.d.ts +39 -0
- package/dist/types/properties/measures/zScatterMeasures.d.ts +104 -0
- package/dist/types/properties/theme/customTheme.d.ts +36 -0
- package/dist/types/zVseed.d.ts +384 -0
- package/dist/umd/index.js +820 -490
- package/dist/umd/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/pipeline/advanced/chart/pipes/init/autoScatterMeasures.d.ts +0 -2
package/dist/umd/index.js
CHANGED
@@ -30,7 +30,6 @@
|
|
30
30
|
var __webpack_exports__ = {};
|
31
31
|
__webpack_require__.r(__webpack_exports__);
|
32
32
|
__webpack_require__.d(__webpack_exports__, {
|
33
|
-
zTooltip: ()=>zTooltip,
|
34
33
|
funnelAdvancedPipeline: ()=>funnelAdvancedPipeline,
|
35
34
|
zHeatmapConfig: ()=>zHeatmapConfig,
|
36
35
|
zBar: ()=>zBar,
|
@@ -80,12 +79,10 @@
|
|
80
79
|
zRoseParallel: ()=>zRoseParallel,
|
81
80
|
MeasureName: ()=>MeasureName,
|
82
81
|
zDataset: ()=>zDataset,
|
83
|
-
UnfoldDimensionGroupId: ()=>UnfoldDimensionGroupId,
|
84
82
|
zNumFormat: ()=>zNumFormat,
|
85
83
|
barPercentAdvancedPipeline: ()=>barPercentAdvancedPipeline,
|
86
84
|
findAllDimensions: ()=>findAllDimensions,
|
87
85
|
FoldYMeasureValue: ()=>FoldYMeasureValue,
|
88
|
-
findDimensionById: ()=>findDimensionById,
|
89
86
|
zPivotTableConfig: ()=>zPivotTableConfig,
|
90
87
|
zArea: ()=>zArea,
|
91
88
|
zColumnParallel: ()=>zColumnParallel,
|
@@ -111,31 +108,31 @@
|
|
111
108
|
registerLightTheme: ()=>registerLightTheme,
|
112
109
|
roseAdvancedPipeline: ()=>roseAdvancedPipeline,
|
113
110
|
zBarParallel: ()=>zBarParallel,
|
114
|
-
registerDarkTheme: ()=>registerDarkTheme,
|
115
|
-
registerPivotTable: ()=>registerPivotTable,
|
116
111
|
isPartialDatumSelector: ()=>isPartialDatumSelector,
|
117
|
-
|
118
|
-
isDimensionGroup: ()=>isDimensionGroup,
|
119
|
-
dualAxisSpecPipeline: ()=>dualAxisSpecPipeline,
|
112
|
+
registerPivotTable: ()=>registerPivotTable,
|
120
113
|
tableAdvancedPipeline: ()=>tableAdvancedPipeline,
|
121
|
-
|
114
|
+
registerDarkTheme: ()=>registerDarkTheme,
|
115
|
+
dualAxisSpecPipeline: ()=>dualAxisSpecPipeline,
|
116
|
+
pieSpecPipeline: ()=>pieSpecPipeline,
|
122
117
|
zAnnotationVerticalLine: ()=>zAnnotationVerticalLine,
|
123
|
-
|
118
|
+
barSpecPipeline: ()=>barSpecPipeline,
|
124
119
|
zChartType: ()=>zChartType,
|
120
|
+
registerRose: ()=>registerRose,
|
121
|
+
zMeasureTree: ()=>zMeasureTree,
|
125
122
|
unfoldDimensions: ()=>unfoldDimensions,
|
126
123
|
roseParallelAdvancedPipeline: ()=>roseParallelAdvancedPipeline,
|
127
124
|
registerTable: ()=>registerTable,
|
128
|
-
Builder: ()=>Builder,
|
129
125
|
isMeasureGroup: ()=>isMeasureGroup,
|
126
|
+
autoFormatter: ()=>autoFormatter,
|
130
127
|
YEncoding: ()=>YEncoding,
|
131
128
|
registerAll: ()=>registerAll,
|
132
129
|
registerBar: ()=>registerBar,
|
133
130
|
isVChart: ()=>isVChart,
|
134
131
|
radarSpecPipeline: ()=>radarSpecPipeline,
|
135
|
-
|
136
|
-
autoFormatter: ()=>autoFormatter,
|
137
|
-
zMeasureTree: ()=>zMeasureTree,
|
132
|
+
Builder: ()=>Builder,
|
138
133
|
zPieConfig: ()=>zPieConfig,
|
134
|
+
zPivotTable: ()=>zPivotTable,
|
135
|
+
zRadar: ()=>zRadar,
|
139
136
|
registerLine: ()=>registerLine,
|
140
137
|
registerCustomTheme: ()=>registerCustomTheme,
|
141
138
|
zColor: ()=>zColor,
|
@@ -155,21 +152,19 @@
|
|
155
152
|
zAxis: ()=>zAxis,
|
156
153
|
isVTable: ()=>isVTable,
|
157
154
|
zMeasures: ()=>zMeasures,
|
158
|
-
|
155
|
+
zRadarConfig: ()=>zRadarConfig,
|
159
156
|
zLine: ()=>zLine,
|
160
157
|
columnSpecPipeline: ()=>columnSpecPipeline,
|
161
|
-
UnfoldDimensionGroup: ()=>UnfoldDimensionGroup,
|
162
|
-
zDatasetReshapeInfo: ()=>zDatasetReshapeInfo,
|
163
158
|
zFoldInfo: ()=>zFoldInfo,
|
159
|
+
zDatasetReshapeInfo: ()=>zDatasetReshapeInfo,
|
164
160
|
zLinearColor: ()=>zLinearColor,
|
161
|
+
zStackCornerRadius: ()=>zStackCornerRadius,
|
165
162
|
zAreaStyle: ()=>zAreaStyle,
|
166
163
|
ORIGINAL_DATA: ()=>ORIGINAL_DATA,
|
167
|
-
|
164
|
+
zUnfoldInfo: ()=>zUnfoldInfo,
|
168
165
|
zAnnotationArea: ()=>zAnnotationArea,
|
169
|
-
zStackCornerRadius: ()=>zStackCornerRadius,
|
170
166
|
DetailEncoding: ()=>DetailEncoding,
|
171
167
|
zRose: ()=>zRose,
|
172
|
-
zUnfoldInfo: ()=>zUnfoldInfo,
|
173
168
|
columnParallelSpecPipeline: ()=>columnParallelSpecPipeline,
|
174
169
|
i18n: ()=>i18n,
|
175
170
|
zPointStyle: ()=>zPointStyle,
|
@@ -178,7 +173,6 @@
|
|
178
173
|
registerColumnParallel: ()=>registerColumnParallel,
|
179
174
|
updateAdvanced: ()=>updateAdvanced,
|
180
175
|
zDimension: ()=>zDimension,
|
181
|
-
zRadar: ()=>zRadar,
|
182
176
|
zTable: ()=>zTable,
|
183
177
|
isMeasure: ()=>isMeasure,
|
184
178
|
FoldSecondaryMeasureValue: ()=>FoldSecondaryMeasureValue,
|
@@ -201,10 +195,9 @@
|
|
201
195
|
zBackgroundColor: ()=>zBackgroundColor,
|
202
196
|
registerBarParallel: ()=>registerBarParallel,
|
203
197
|
registerRadar: ()=>registerRadar,
|
204
|
-
zEncodings: ()=>zEncodings,
|
205
|
-
isDimension: ()=>isDimension,
|
206
|
-
pivotTableSpecPipeline: ()=>pivotTableSpecPipeline,
|
207
198
|
zLocale: ()=>zLocale,
|
199
|
+
pivotTableSpecPipeline: ()=>pivotTableSpecPipeline,
|
200
|
+
zMeasure: ()=>zMeasure,
|
208
201
|
FoldXMeasureValue: ()=>FoldXMeasureValue,
|
209
202
|
dualAxisAdvancedPipeline: ()=>dualAxisAdvancedPipeline,
|
210
203
|
registerScatter: ()=>registerScatter,
|
@@ -216,10 +209,9 @@
|
|
216
209
|
zAdvancedVSeed: ()=>zAdvancedVSeed,
|
217
210
|
zConfig: ()=>zConfig,
|
218
211
|
zBarStyle: ()=>zBarStyle,
|
219
|
-
zMeasure: ()=>zMeasure,
|
220
212
|
zRoseParallelConfig: ()=>zRoseParallelConfig,
|
221
|
-
zAreaPercent: ()=>zAreaPercent,
|
222
213
|
zXLinearAxis: ()=>zXLinearAxis,
|
214
|
+
zAreaPercent: ()=>zAreaPercent,
|
223
215
|
columnParallelAdvancedPipeline: ()=>columnParallelAdvancedPipeline,
|
224
216
|
isValueSelector: ()=>isValueSelector,
|
225
217
|
donutAdvancedPipeline: ()=>donutAdvancedPipeline,
|
@@ -237,8 +229,8 @@
|
|
237
229
|
lineAdvancedPipeline: ()=>lineAdvancedPipeline,
|
238
230
|
dataReshapeByEncoding: ()=>dataReshapeByEncoding,
|
239
231
|
lineSpecPipeline: ()=>lineSpecPipeline,
|
240
|
-
isDimensions: ()=>isDimensions,
|
241
232
|
zBarPercentConfig: ()=>zBarPercentConfig,
|
233
|
+
zTooltip: ()=>zTooltip,
|
242
234
|
createFormatter: ()=>createFormatter,
|
243
235
|
zDimensionGroup: ()=>zDimensionGroup,
|
244
236
|
isMeasureSelector: ()=>isMeasureSelector,
|
@@ -1130,32 +1122,6 @@
|
|
1130
1122
|
}));
|
1131
1123
|
return result;
|
1132
1124
|
};
|
1133
|
-
const findDimensionById = (dimensions = [], id)=>{
|
1134
|
-
if (!dimensions) return;
|
1135
|
-
let result;
|
1136
|
-
preorderTraverse(dimensions, (node)=>{
|
1137
|
-
if (!('children' in node)) {
|
1138
|
-
if (node.id === id) {
|
1139
|
-
result = node;
|
1140
|
-
return true;
|
1141
|
-
}
|
1142
|
-
}
|
1143
|
-
return false;
|
1144
|
-
});
|
1145
|
-
return result;
|
1146
|
-
};
|
1147
|
-
const findFirstDimension = (dimensions = [])=>{
|
1148
|
-
if (!dimensions) return;
|
1149
|
-
let result;
|
1150
|
-
preorderTraverse(dimensions, (node)=>{
|
1151
|
-
if (!('children' in node)) {
|
1152
|
-
result = node;
|
1153
|
-
return true;
|
1154
|
-
}
|
1155
|
-
return false;
|
1156
|
-
});
|
1157
|
-
return result;
|
1158
|
-
};
|
1159
1125
|
const findAllDimensions = (dimensions = [])=>{
|
1160
1126
|
if (!dimensions) return [];
|
1161
1127
|
const result = [];
|
@@ -1479,6 +1445,39 @@
|
|
1479
1445
|
locale: locale || 'zh-CN'
|
1480
1446
|
};
|
1481
1447
|
};
|
1448
|
+
const getBasicMeasures = (vseed)=>{
|
1449
|
+
const { dataset, measures } = vseed;
|
1450
|
+
if (!measures || 0 === measures.length) return generateMeasuresByDataset(dataset);
|
1451
|
+
return measures;
|
1452
|
+
};
|
1453
|
+
const generateMeasuresByDataset = (dataset)=>{
|
1454
|
+
if (!dataset) throw new Error('dataset is required');
|
1455
|
+
if (0 === dataset.length) return [];
|
1456
|
+
const top100dataset = dataset.slice(0, 100);
|
1457
|
+
const sample = top100dataset.reduce((prev, cur)=>({
|
1458
|
+
...prev,
|
1459
|
+
...cur
|
1460
|
+
}), {});
|
1461
|
+
const basicMeasures = Object.keys(sample).filter((key)=>top100dataset.some((item)=>'number' == typeof item[key]) && ![
|
1462
|
+
'',
|
1463
|
+
null,
|
1464
|
+
void 0
|
1465
|
+
].includes(key)).map((measure)=>({
|
1466
|
+
id: measure,
|
1467
|
+
alias: measure
|
1468
|
+
}));
|
1469
|
+
return basicMeasures;
|
1470
|
+
};
|
1471
|
+
const isMeasureTreeWithChildren = (vseed)=>{
|
1472
|
+
const { measures } = vseed;
|
1473
|
+
if (!measures) return false;
|
1474
|
+
return measures.some((measure)=>'children' in measure);
|
1475
|
+
};
|
1476
|
+
const isMeasureTreeWithParentId = (vseed)=>{
|
1477
|
+
const { measures } = vseed;
|
1478
|
+
if (!measures) return false;
|
1479
|
+
return measures.some((measure)=>'parentId' in measure);
|
1480
|
+
};
|
1482
1481
|
const measureDepth = (measures = [])=>{
|
1483
1482
|
if (!measures) return 0;
|
1484
1483
|
let depth = 1;
|
@@ -1497,23 +1496,26 @@
|
|
1497
1496
|
const isVChart = (vseed)=>!isVTable(vseed);
|
1498
1497
|
const isPivotChart = (vseed)=>{
|
1499
1498
|
if (isVTable(vseed)) return false;
|
1499
|
+
if (isMeasureTreeWithParentId(vseed)) {
|
1500
|
+
const parentIds = vseed.measures?.map((measure)=>measure.parentId);
|
1501
|
+
return parentIds && parentIds.length > 1;
|
1502
|
+
}
|
1500
1503
|
if ('dualAxis' === vseed.chartType || 'scatter' === vseed.chartType) {
|
1501
1504
|
const { dimensions = [] } = vseed;
|
1502
1505
|
const hasRowOrColumnDimension = dimensions && dimensions.some((dimension)=>'rowDimension' === dimension.location || 'columnDimension' === dimension.location);
|
1503
1506
|
if (hasRowOrColumnDimension) return true;
|
1504
1507
|
if ('scatter' === vseed.chartType) {
|
1505
|
-
if (vseed
|
1508
|
+
if (isMeasureTreeWithChildren(vseed)) {
|
1506
1509
|
const depth = measureDepth(vseed.measures);
|
1507
|
-
|
1508
|
-
return false;
|
1510
|
+
return 3 === depth;
|
1509
1511
|
}
|
1510
1512
|
if (vseed.scatterMeasures && vseed.scatterMeasures.length > 1) return true;
|
1513
|
+
return false;
|
1511
1514
|
}
|
1512
1515
|
if ('dualAxis' === vseed.chartType) {
|
1513
|
-
if (vseed
|
1516
|
+
if (isMeasureTreeWithChildren(vseed)) {
|
1514
1517
|
const depth = measureDepth(vseed.measures);
|
1515
|
-
|
1516
|
-
return false;
|
1518
|
+
return 3 === depth;
|
1517
1519
|
}
|
1518
1520
|
if (vseed.dualMeasures && vseed.dualMeasures.length > 1) return true;
|
1519
1521
|
}
|
@@ -1524,77 +1526,49 @@
|
|
1524
1526
|
const hasMeasureGroup = measures && measures.some((measure)=>measure && measure.children);
|
1525
1527
|
return hasRowOrColumnDimension || hasMeasureGroup;
|
1526
1528
|
};
|
1527
|
-
const
|
1528
|
-
const result = {
|
1529
|
-
...advancedVSeed
|
1530
|
-
};
|
1531
|
-
const { vseed } = context;
|
1532
|
-
const { measures, dataset } = vseed;
|
1533
|
-
if (!dataset) throw new Error('dataset is required');
|
1534
|
-
if (0 === dataset.length) return result;
|
1535
|
-
if (isPivotChart(vseed)) return autoMeasureGroup(advancedVSeed, context);
|
1536
|
-
if (measures) {
|
1537
|
-
result.measures = measures;
|
1538
|
-
return result;
|
1539
|
-
}
|
1540
|
-
const top100dataset = dataset.slice(0, 100);
|
1541
|
-
const sample = top100dataset.reduce((prev, cur)=>({
|
1542
|
-
...prev,
|
1543
|
-
...cur
|
1544
|
-
}), {});
|
1545
|
-
result.measures = Object.keys(sample).filter((key)=>top100dataset.some((item)=>'number' == typeof item[key]) && ![
|
1546
|
-
'',
|
1547
|
-
null,
|
1548
|
-
void 0
|
1549
|
-
].includes(key)).map((measure)=>({
|
1550
|
-
id: measure,
|
1551
|
-
alias: measure
|
1552
|
-
}));
|
1553
|
-
return result;
|
1554
|
-
};
|
1555
|
-
const autoMeasureGroup = (advancedVSeed, context)=>{
|
1529
|
+
const buildMeasures = (advancedVSeed, context)=>{
|
1556
1530
|
const { vseed } = context;
|
1557
|
-
|
1558
|
-
|
1559
|
-
|
1560
|
-
if (!hasMeasureGroup) {
|
1561
|
-
const newMeasures = [
|
1562
|
-
{
|
1563
|
-
id: 'measureGroup',
|
1564
|
-
alias: 'measureGroup',
|
1565
|
-
children: measures
|
1566
|
-
}
|
1567
|
-
];
|
1568
|
-
return {
|
1569
|
-
...advancedVSeed,
|
1570
|
-
measures: newMeasures
|
1571
|
-
};
|
1531
|
+
if (isMeasureTreeWithChildren(vseed)) {
|
1532
|
+
advancedVSeed.measures = vseed.measures;
|
1533
|
+
return advancedVSeed;
|
1572
1534
|
}
|
1573
|
-
|
1574
|
-
|
1575
|
-
|
1576
|
-
if (currentGroup.children?.length) {
|
1577
|
-
currentGroup.alias = currentGroup.children.map((item)=>item.alias).join('-');
|
1578
|
-
currentGroup.id = currentGroup.alias + currentGroup.children.map((item)=>item.id).join('-');
|
1579
|
-
measureGroups.push(currentGroup);
|
1580
|
-
currentGroup = createEmptyMeasureGroup();
|
1581
|
-
}
|
1582
|
-
measureGroups.push(measure);
|
1583
|
-
} else currentGroup.children?.push(measure);
|
1584
|
-
if (currentGroup.children?.length) {
|
1585
|
-
currentGroup.alias = currentGroup.children.map((item)=>item.alias).join('-');
|
1586
|
-
currentGroup.id = currentGroup.alias + currentGroup.children.map((item)=>item.id).join('-');
|
1587
|
-
measureGroups.push(currentGroup);
|
1588
|
-
currentGroup = createEmptyMeasureGroup();
|
1535
|
+
if (isMeasureTreeWithParentId(vseed)) {
|
1536
|
+
advancedVSeed.measures = generateMeasuresByParentId(vseed.measures);
|
1537
|
+
return advancedVSeed;
|
1589
1538
|
}
|
1590
|
-
|
1539
|
+
const basicMeasures = getBasicMeasures(vseed);
|
1540
|
+
if (isPivotChart(vseed)) advancedVSeed.measures = basicMeasuresToMeasureTree(basicMeasures);
|
1541
|
+
else advancedVSeed.measures = basicMeasures;
|
1591
1542
|
return advancedVSeed;
|
1592
1543
|
};
|
1593
|
-
const
|
1594
|
-
|
1595
|
-
|
1596
|
-
|
1544
|
+
const generateMeasuresByParentId = (measures)=>{
|
1545
|
+
const measureTree = [];
|
1546
|
+
measures.forEach((measure)=>{
|
1547
|
+
if (!measure.parentId) return;
|
1548
|
+
const parent = measureTree.find((item)=>item.id === measure.parentId);
|
1549
|
+
if (parent && 'children' in parent) {
|
1550
|
+
parent.children = parent.children || [];
|
1551
|
+
parent.children.push(measure);
|
1552
|
+
} else measureTree.push({
|
1553
|
+
id: measure.parentId,
|
1554
|
+
children: [
|
1555
|
+
measure
|
1556
|
+
]
|
1557
|
+
});
|
1597
1558
|
});
|
1559
|
+
return measureTree;
|
1560
|
+
};
|
1561
|
+
const basicMeasuresToMeasureTree = (measures)=>{
|
1562
|
+
const id = measures.map((item)=>item.id).join('-');
|
1563
|
+
const alias = measures.map((item)=>item.alias || item.id).join('-');
|
1564
|
+
return [
|
1565
|
+
{
|
1566
|
+
id,
|
1567
|
+
alias,
|
1568
|
+
children: measures
|
1569
|
+
}
|
1570
|
+
];
|
1571
|
+
};
|
1598
1572
|
const ORIGINAL_DATA = '__OriginalData__';
|
1599
1573
|
const Separator = '-';
|
1600
1574
|
const FoldMeasureName = '__MeaName__';
|
@@ -1611,8 +1585,6 @@
|
|
1611
1585
|
const DetailEncoding = '__Dim_Detail__';
|
1612
1586
|
const ColorEncoding = '__Dim_Color__';
|
1613
1587
|
const ColorIdEncoding = '__Dim_ColorId__';
|
1614
|
-
const UnfoldDimensionGroup = '__DimGroup__';
|
1615
|
-
const UnfoldDimensionGroupId = '__DimGroupID__';
|
1616
1588
|
const autoDimensions_autoDimensions = (advancedVSeed, context)=>{
|
1617
1589
|
const result = {
|
1618
1590
|
...advancedVSeed
|
@@ -1652,7 +1624,7 @@
|
|
1652
1624
|
result.dimensions.push(MeaName);
|
1653
1625
|
return result;
|
1654
1626
|
};
|
1655
|
-
const
|
1627
|
+
const encodingForLine = (advancedVSeed, context)=>{
|
1656
1628
|
const { vseed } = context;
|
1657
1629
|
const { dimensions } = advancedVSeed;
|
1658
1630
|
if (!dimensions) return advancedVSeed;
|
@@ -1665,10 +1637,7 @@
|
|
1665
1637
|
(dimensions[1] || dimensions[0]).id
|
1666
1638
|
];
|
1667
1639
|
const detail = encoding.detail || [];
|
1668
|
-
const mergedDetail =
|
1669
|
-
...color,
|
1670
|
-
...detail
|
1671
|
-
]);
|
1640
|
+
const mergedDetail = 0 === detail.length ? dimensions.map((d)=>d.id).filter((id)=>!x.includes(id)) : encoding.detail;
|
1672
1641
|
return {
|
1673
1642
|
...advancedVSeed,
|
1674
1643
|
encoding: {
|
@@ -1721,11 +1690,20 @@
|
|
1721
1690
|
for (let r of e)delete o[r];
|
1722
1691
|
return o;
|
1723
1692
|
}
|
1724
|
-
const foldMeasures = (dataset, measures,
|
1693
|
+
const foldMeasures = (dataset, measures, encoding, options)=>{
|
1694
|
+
const { measureId, measureName, measureValue, colorMeasureId } = options || {};
|
1725
1695
|
const foldInfo = {
|
1726
1696
|
measureId,
|
1727
1697
|
measureName,
|
1728
1698
|
measureValue,
|
1699
|
+
colorRange: [
|
1700
|
+
0,
|
1701
|
+
1
|
1702
|
+
],
|
1703
|
+
measureRange: [
|
1704
|
+
0,
|
1705
|
+
1
|
1706
|
+
],
|
1729
1707
|
foldMap: {}
|
1730
1708
|
};
|
1731
1709
|
const result = new Array(dataset.length * measures.length);
|
@@ -1742,6 +1720,19 @@
|
|
1742
1720
|
datum[measureId] = id;
|
1743
1721
|
datum[measureName] = alias || id;
|
1744
1722
|
datum[measureValue] = dataset[i][id];
|
1723
|
+
if (colorMeasureId) {
|
1724
|
+
const value = datum[ORIGINAL_DATA][colorMeasureId];
|
1725
|
+
datum[ColorEncoding] = value;
|
1726
|
+
datum[ColorIdEncoding] = colorMeasureId;
|
1727
|
+
foldInfo.colorRange = [
|
1728
|
+
Math.min(foldInfo.colorRange[0] || 1 / 0, Number(value)),
|
1729
|
+
Math.max(foldInfo.colorRange[1] || -1 / 0, Number(value))
|
1730
|
+
];
|
1731
|
+
}
|
1732
|
+
foldInfo.measureRange = [
|
1733
|
+
Math.min(foldInfo.measureRange[0] || 1 / 0, Number(datum[id])),
|
1734
|
+
Math.max(foldInfo.measureRange[1] || -1 / 0, Number(datum[id]))
|
1735
|
+
];
|
1745
1736
|
foldInfo.foldMap[id] = alias;
|
1746
1737
|
result[index++] = datum;
|
1747
1738
|
}
|
@@ -1777,7 +1768,7 @@
|
|
1777
1768
|
applyEncoding(YEncoding, yDimensions, datum, separator);
|
1778
1769
|
applyEncoding(ColorEncoding, colorDimensions, datum, separator);
|
1779
1770
|
applyEncoding(DetailEncoding, detailDimensions, datum, separator);
|
1780
|
-
if (!datum[ColorEncoding]) continue;
|
1771
|
+
if (!colorDimensions.length || !datum[ColorEncoding]) continue;
|
1781
1772
|
const measureId = String(datum[foldMeasureId]);
|
1782
1773
|
const colorItem = String(datum[ColorEncoding]);
|
1783
1774
|
const colorId = colorItemAsId ? colorItem : measureId ? [
|
@@ -1798,29 +1789,14 @@
|
|
1798
1789
|
const applyEncoding = (encoding, dimensions, datum, separator)=>{
|
1799
1790
|
if (encoding && dimensions.length) datum[encoding] = dimensions.map((dim)=>String(datum[dim.id])).join(separator);
|
1800
1791
|
};
|
1801
|
-
const emptyReshapeResult = {
|
1802
|
-
dataset: [],
|
1803
|
-
foldInfo: {
|
1804
|
-
foldMap: {},
|
1805
|
-
measureId: '',
|
1806
|
-
measureName: '',
|
1807
|
-
measureValue: ''
|
1808
|
-
},
|
1809
|
-
unfoldInfo: {
|
1810
|
-
encodingAngle: AngleEncoding,
|
1811
|
-
encodingX: XEncoding,
|
1812
|
-
encodingY: YEncoding,
|
1813
|
-
encodingDetail: DetailEncoding,
|
1814
|
-
encodingColor: ColorEncoding,
|
1815
|
-
encodingColorId: ColorIdEncoding,
|
1816
|
-
colorItems: [],
|
1817
|
-
colorIdMap: {}
|
1818
|
-
}
|
1819
|
-
};
|
1820
1792
|
const dataReshapeByEncoding = (dataset, dimensions, measures, encoding, options)=>{
|
1821
|
-
const { foldMeasureId = FoldMeasureId, foldMeasureName = FoldMeasureName, foldMeasureValue = FoldMeasureValue, colorItemAsId = false } = options || {};
|
1822
|
-
|
1823
|
-
|
1793
|
+
const { foldMeasureId = FoldMeasureId, foldMeasureName = FoldMeasureName, foldMeasureValue = FoldMeasureValue, colorItemAsId = false, colorMeasureId } = options || {};
|
1794
|
+
const { dataset: foldedDataset, foldInfo } = foldMeasures(dataset, measures, encoding, {
|
1795
|
+
measureId: foldMeasureId,
|
1796
|
+
measureName: foldMeasureName,
|
1797
|
+
measureValue: foldMeasureValue,
|
1798
|
+
colorMeasureId
|
1799
|
+
});
|
1824
1800
|
const { dataset: finalDataset, unfoldInfo } = unfoldDimensions(foldedDataset, dimensions, encoding, {
|
1825
1801
|
foldMeasureId,
|
1826
1802
|
separator: Separator,
|
@@ -1832,6 +1808,24 @@
|
|
1832
1808
|
unfoldInfo
|
1833
1809
|
};
|
1834
1810
|
};
|
1811
|
+
const colorAdapter = (ordinalPipe, linearPipe)=>(spec, context)=>{
|
1812
|
+
const { advancedVSeed } = context;
|
1813
|
+
if (isLinearColor(advancedVSeed)) return linearPipe(spec, context);
|
1814
|
+
return ordinalPipe(spec, context);
|
1815
|
+
};
|
1816
|
+
const isLinearColor = (advancedVSeed)=>{
|
1817
|
+
const { encoding, measures } = advancedVSeed;
|
1818
|
+
const measureIdList = findAllMeasures(measures).map((measure)=>measure.id);
|
1819
|
+
const { color } = encoding;
|
1820
|
+
return color?.length === 1 && measureIdList.includes(color[0]);
|
1821
|
+
};
|
1822
|
+
const getColorMeasureId = (advancedVSeed)=>{
|
1823
|
+
if (isLinearColor(advancedVSeed)) {
|
1824
|
+
const { encoding } = advancedVSeed;
|
1825
|
+
const { color } = encoding;
|
1826
|
+
return color?.[0];
|
1827
|
+
}
|
1828
|
+
};
|
1835
1829
|
const reshapeWithEncoding = (advancedVSeed, context)=>{
|
1836
1830
|
const result = {
|
1837
1831
|
...advancedVSeed
|
@@ -1841,7 +1835,9 @@
|
|
1841
1835
|
const { dimensions, measures, encoding } = advancedVSeed;
|
1842
1836
|
if (!measures || !dimensions || !dataset || !encoding) return result;
|
1843
1837
|
if (0 === measures.length) throw new Error('measures can not be empty');
|
1844
|
-
const { dataset: newDatasets, foldInfo, unfoldInfo } = dataReshapeByEncoding(dataset, dimensions, measures, encoding
|
1838
|
+
const { dataset: newDatasets, foldInfo, unfoldInfo } = dataReshapeByEncoding(dataset, dimensions, measures, encoding, {
|
1839
|
+
colorMeasureId: getColorMeasureId(advancedVSeed)
|
1840
|
+
});
|
1845
1841
|
return {
|
1846
1842
|
...result,
|
1847
1843
|
dataset: newDatasets,
|
@@ -1877,7 +1873,8 @@
|
|
1877
1873
|
if (!measures) return;
|
1878
1874
|
const groupId = measureGroup.id;
|
1879
1875
|
const { dataset: newSubDataset, foldInfo, unfoldInfo } = dataReshapeByEncoding(dataset, dimensions, measures, encoding, {
|
1880
|
-
foldMeasureValue: `${FoldMeasureValue}${groupId}
|
1876
|
+
foldMeasureValue: `${FoldMeasureValue}${groupId}`,
|
1877
|
+
colorMeasureId: getColorMeasureId(advancedVSeed)
|
1881
1878
|
});
|
1882
1879
|
const reshapeInfo = {
|
1883
1880
|
id: groupId,
|
@@ -2093,9 +2090,9 @@
|
|
2093
2090
|
};
|
2094
2091
|
const lineAdvancedPipeline = [
|
2095
2092
|
initAdvancedVSeed_initAdvancedVSeed,
|
2096
|
-
|
2093
|
+
buildMeasures,
|
2097
2094
|
autoDimensions_autoDimensions,
|
2098
|
-
|
2095
|
+
encodingForLine,
|
2099
2096
|
pivotAdapter([
|
2100
2097
|
reshapeWithEncoding
|
2101
2098
|
], [
|
@@ -2119,7 +2116,7 @@
|
|
2119
2116
|
result.direction = 'vertical';
|
2120
2117
|
result.xField = unfoldInfo.encodingX;
|
2121
2118
|
result.yField = foldInfo.measureValue;
|
2122
|
-
result.seriesField = unfoldInfo.encodingColorId;
|
2119
|
+
result.seriesField = isLinearColor(advancedVSeed) ? unfoldInfo.encodingDetail : unfoldInfo.encodingColorId;
|
2123
2120
|
result.padding = 0;
|
2124
2121
|
result.region = [
|
2125
2122
|
{
|
@@ -2180,6 +2177,31 @@
|
|
2180
2177
|
...accurateMap
|
2181
2178
|
};
|
2182
2179
|
};
|
2180
|
+
const linearColor = (spec, context)=>{
|
2181
|
+
const result = {
|
2182
|
+
...spec
|
2183
|
+
};
|
2184
|
+
const { advancedVSeed } = context;
|
2185
|
+
const { datasetReshapeInfo, chartType } = advancedVSeed;
|
2186
|
+
const { unfoldInfo, id } = datasetReshapeInfo[0];
|
2187
|
+
const baseConfig = advancedVSeed.config[chartType];
|
2188
|
+
if (!baseConfig || !baseConfig.color) return result;
|
2189
|
+
const { color } = baseConfig;
|
2190
|
+
const { colorScheme, linearColorScheme } = color;
|
2191
|
+
result.color = {
|
2192
|
+
type: 'linear',
|
2193
|
+
range: linearColorScheme || colorScheme || [],
|
2194
|
+
domain: [
|
2195
|
+
{
|
2196
|
+
dataId: id,
|
2197
|
+
fields: [
|
2198
|
+
unfoldInfo.encodingColor
|
2199
|
+
]
|
2200
|
+
}
|
2201
|
+
]
|
2202
|
+
};
|
2203
|
+
return result;
|
2204
|
+
};
|
2183
2205
|
const background_backgroundColor = (spec, context)=>{
|
2184
2206
|
const result = {
|
2185
2207
|
...spec
|
@@ -2687,6 +2709,95 @@
|
|
2687
2709
|
};
|
2688
2710
|
return result;
|
2689
2711
|
};
|
2712
|
+
const colorLegend = (spec, context)=>{
|
2713
|
+
const result = {
|
2714
|
+
...spec
|
2715
|
+
};
|
2716
|
+
const { advancedVSeed } = context;
|
2717
|
+
const { datasetReshapeInfo, chartType } = advancedVSeed;
|
2718
|
+
const { unfoldInfo } = datasetReshapeInfo[0];
|
2719
|
+
const baseConfig = advancedVSeed.config[chartType];
|
2720
|
+
if (!baseConfig || !baseConfig.legend) return result;
|
2721
|
+
const { legend } = baseConfig;
|
2722
|
+
const { enable, position = 'bottom', labelFontColor, labelFontSize = 12, labelFontWeight } = legend || {};
|
2723
|
+
const orient = [
|
2724
|
+
'bottom',
|
2725
|
+
'bottomLeft',
|
2726
|
+
'bottomRight',
|
2727
|
+
'bl',
|
2728
|
+
'br'
|
2729
|
+
].includes(position) ? 'bottom' : [
|
2730
|
+
'top',
|
2731
|
+
'topLeft',
|
2732
|
+
'topRight',
|
2733
|
+
'tl',
|
2734
|
+
'tr'
|
2735
|
+
].includes(position) ? 'top' : [
|
2736
|
+
'left',
|
2737
|
+
'leftTop',
|
2738
|
+
'leftBottom',
|
2739
|
+
'lt',
|
2740
|
+
'lb'
|
2741
|
+
].includes(position) ? 'left' : 'right';
|
2742
|
+
const legendPosition = [
|
2743
|
+
'topLeft',
|
2744
|
+
'bottomLeft',
|
2745
|
+
'leftTop',
|
2746
|
+
'rightTop',
|
2747
|
+
'lt',
|
2748
|
+
'rt',
|
2749
|
+
'tl',
|
2750
|
+
'bl'
|
2751
|
+
].includes(position) ? 'start' : [
|
2752
|
+
'topRight',
|
2753
|
+
'bottomRight',
|
2754
|
+
'leftBottom',
|
2755
|
+
'rightBottom',
|
2756
|
+
'lb',
|
2757
|
+
'rb',
|
2758
|
+
'rt',
|
2759
|
+
'br'
|
2760
|
+
].includes(position) ? 'end' : 'middle';
|
2761
|
+
result.legends = {
|
2762
|
+
type: 'color',
|
2763
|
+
visible: enable,
|
2764
|
+
orient,
|
2765
|
+
position: legendPosition,
|
2766
|
+
padding: 0,
|
2767
|
+
field: unfoldInfo.encodingColor,
|
2768
|
+
maxWidth: '30%',
|
2769
|
+
startText: {
|
2770
|
+
visible: true,
|
2771
|
+
style: {
|
2772
|
+
fill: labelFontColor,
|
2773
|
+
fontSize: labelFontSize,
|
2774
|
+
fontWeight: labelFontWeight
|
2775
|
+
}
|
2776
|
+
},
|
2777
|
+
endText: {
|
2778
|
+
visible: true,
|
2779
|
+
style: {
|
2780
|
+
fill: labelFontColor,
|
2781
|
+
fontSize: labelFontSize,
|
2782
|
+
fontWeight: labelFontWeight
|
2783
|
+
}
|
2784
|
+
}
|
2785
|
+
};
|
2786
|
+
return result;
|
2787
|
+
};
|
2788
|
+
const colorPointStyleFill = (stylePipe)=>(spec, context)=>{
|
2789
|
+
const result = stylePipe(spec, context);
|
2790
|
+
const { advancedVSeed } = context;
|
2791
|
+
const { datasetReshapeInfo } = advancedVSeed;
|
2792
|
+
const { unfoldInfo } = datasetReshapeInfo[0];
|
2793
|
+
if (isLinearColor(advancedVSeed)) {
|
2794
|
+
if (result?.point?.style) result.point.style.fill = {
|
2795
|
+
field: unfoldInfo.encodingColor,
|
2796
|
+
scale: 'color'
|
2797
|
+
};
|
2798
|
+
}
|
2799
|
+
return result;
|
2800
|
+
};
|
2690
2801
|
const selector_selector = (vchartDatum, selector)=>{
|
2691
2802
|
if (!selector) return true;
|
2692
2803
|
const selectorMode = 'And';
|
@@ -2783,7 +2894,10 @@
|
|
2783
2894
|
const { markStyle } = advancedVSeed;
|
2784
2895
|
const { pointStyle } = markStyle;
|
2785
2896
|
const result = {
|
2786
|
-
...spec
|
2897
|
+
...spec,
|
2898
|
+
point: {
|
2899
|
+
style: {}
|
2900
|
+
}
|
2787
2901
|
};
|
2788
2902
|
if (!pointStyle) return result;
|
2789
2903
|
const pointStyles = Array.isArray(pointStyle) ? pointStyle : [
|
@@ -2827,6 +2941,7 @@
|
|
2827
2941
|
return {
|
2828
2942
|
...result,
|
2829
2943
|
point: {
|
2944
|
+
...result.point,
|
2830
2945
|
state: {
|
2831
2946
|
...customMap
|
2832
2947
|
}
|
@@ -2882,6 +2997,19 @@
|
|
2882
2997
|
};
|
2883
2998
|
return result;
|
2884
2999
|
};
|
3000
|
+
const colorLineStyleFill = (stylePipe)=>(spec, context)=>{
|
3001
|
+
const result = stylePipe(spec, context);
|
3002
|
+
const { advancedVSeed } = context;
|
3003
|
+
const { datasetReshapeInfo } = advancedVSeed;
|
3004
|
+
const { unfoldInfo } = datasetReshapeInfo[0];
|
3005
|
+
if (isLinearColor(advancedVSeed)) {
|
3006
|
+
if (result?.line?.style) result.line.style.stroke = {
|
3007
|
+
field: unfoldInfo.encodingColor,
|
3008
|
+
scale: 'color'
|
3009
|
+
};
|
3010
|
+
}
|
3011
|
+
return result;
|
3012
|
+
};
|
2885
3013
|
function chunk_HVPVHFDT_i(...e) {
|
2886
3014
|
return chunk_WIMGWYZL_u(chunk_HVPVHFDT_p, e);
|
2887
3015
|
}
|
@@ -2903,10 +3031,13 @@
|
|
2903
3031
|
const { markStyle, datasetReshapeInfo, dataset } = advancedVSeed;
|
2904
3032
|
const { unfoldInfo } = datasetReshapeInfo[0];
|
2905
3033
|
const { lineStyle } = markStyle;
|
2906
|
-
if (!lineStyle) return spec;
|
2907
3034
|
const result = {
|
2908
|
-
...spec
|
3035
|
+
...spec,
|
3036
|
+
line: {
|
3037
|
+
style: {}
|
3038
|
+
}
|
2909
3039
|
};
|
3040
|
+
if (!lineStyle) return result;
|
2910
3041
|
const lineStyles = Array.isArray(lineStyle) ? lineStyle : [
|
2911
3042
|
lineStyle
|
2912
3043
|
];
|
@@ -2950,6 +3081,7 @@
|
|
2950
3081
|
return {
|
2951
3082
|
...result,
|
2952
3083
|
line: {
|
3084
|
+
...result.line,
|
2953
3085
|
state: {
|
2954
3086
|
...customMap
|
2955
3087
|
}
|
@@ -3725,7 +3857,7 @@
|
|
3725
3857
|
};
|
3726
3858
|
const line_line = [
|
3727
3859
|
initLine,
|
3728
|
-
color_color,
|
3860
|
+
colorAdapter(color_color, linearColor),
|
3729
3861
|
background_backgroundColor,
|
3730
3862
|
datasetXY,
|
3731
3863
|
progressive,
|
@@ -3734,10 +3866,10 @@
|
|
3734
3866
|
label_label,
|
3735
3867
|
tooltip_tooltip,
|
3736
3868
|
verticalCrosshairLine,
|
3737
|
-
discreteLegend,
|
3738
|
-
pointStyle_pointStyle,
|
3869
|
+
colorAdapter(discreteLegend, colorLegend),
|
3870
|
+
colorPointStyleFill(pointStyle_pointStyle),
|
3739
3871
|
pointStateDimensionHover,
|
3740
|
-
lineStyle_lineStyle,
|
3872
|
+
colorLineStyleFill(lineStyle_lineStyle),
|
3741
3873
|
annotationPoint_annotationPoint,
|
3742
3874
|
annotationVerticalLine_annotationVerticalLine,
|
3743
3875
|
annotationHorizontalLine_annotationHorizontalLine,
|
@@ -3778,9 +3910,51 @@
|
|
3778
3910
|
Builder._advancedPipelineMap.line = lineAdvancedPipeline;
|
3779
3911
|
Builder._specPipelineMap.line = lineSpecPipeline;
|
3780
3912
|
};
|
3913
|
+
const encodingForColumn = (advancedVSeed, context)=>{
|
3914
|
+
const { vseed } = context;
|
3915
|
+
const { dimensions } = advancedVSeed;
|
3916
|
+
if (!dimensions) return advancedVSeed;
|
3917
|
+
const encoding = vseed.encoding;
|
3918
|
+
if (encoding) {
|
3919
|
+
const x = encoding.x || [
|
3920
|
+
dimensions[0].id
|
3921
|
+
];
|
3922
|
+
const color = encoding.color || [
|
3923
|
+
(dimensions[1] || dimensions[0]).id
|
3924
|
+
];
|
3925
|
+
const detail = encoding.detail || [];
|
3926
|
+
const mergedDetail = 0 === detail.length ? chunk_QJLMYOTX_i([
|
3927
|
+
...color,
|
3928
|
+
...detail
|
3929
|
+
]) : detail;
|
3930
|
+
return {
|
3931
|
+
...advancedVSeed,
|
3932
|
+
encoding: {
|
3933
|
+
...encoding,
|
3934
|
+
x,
|
3935
|
+
color,
|
3936
|
+
detail: mergedDetail
|
3937
|
+
}
|
3938
|
+
};
|
3939
|
+
}
|
3940
|
+
const onlyMeasureName = 1 === dimensions.length && dimensions.find((item)=>item.id === MeasureName);
|
3941
|
+
const mergedEncoding = {
|
3942
|
+
x: dimensions.slice(0, 1).map((item)=>item.id),
|
3943
|
+
color: dimensions.slice(onlyMeasureName ? 0 : 1).map((item)=>item.id),
|
3944
|
+
detail: dimensions.slice(onlyMeasureName ? 0 : 1).map((item)=>item.id),
|
3945
|
+
tooltip: dimensions.map((item)=>item.id),
|
3946
|
+
label: [],
|
3947
|
+
row: [],
|
3948
|
+
column: []
|
3949
|
+
};
|
3950
|
+
return {
|
3951
|
+
...advancedVSeed,
|
3952
|
+
encoding: mergedEncoding
|
3953
|
+
};
|
3954
|
+
};
|
3781
3955
|
const columnAdvancedPipeline = [
|
3782
3956
|
initAdvancedVSeed_initAdvancedVSeed,
|
3783
|
-
|
3957
|
+
buildMeasures,
|
3784
3958
|
autoDimensions_autoDimensions,
|
3785
3959
|
encodingForColumn,
|
3786
3960
|
pivotAdapter([
|
@@ -3820,9 +3994,14 @@
|
|
3820
3994
|
const { advancedVSeed, vseed } = context;
|
3821
3995
|
const { chartType } = vseed;
|
3822
3996
|
const stackCornerRadius = advancedVSeed.config?.[chartType]?.stackCornerRadius;
|
3997
|
+
const { datasetReshapeInfo } = advancedVSeed;
|
3998
|
+
const { foldInfo } = datasetReshapeInfo[0];
|
3823
3999
|
return {
|
3824
4000
|
...spec,
|
3825
|
-
stackCornerRadius
|
4001
|
+
stackCornerRadius: (_, datum)=>{
|
4002
|
+
if (datum[foldInfo.measureValue] > 0) return stackCornerRadius;
|
4003
|
+
return 0;
|
4004
|
+
}
|
3826
4005
|
};
|
3827
4006
|
};
|
3828
4007
|
const stackInverse = (spec)=>{
|
@@ -3872,6 +4051,19 @@
|
|
3872
4051
|
};
|
3873
4052
|
return result;
|
3874
4053
|
};
|
4054
|
+
const colorBarStyleFill = (stylePipe)=>(spec, context)=>{
|
4055
|
+
const result = stylePipe(spec, context);
|
4056
|
+
const { advancedVSeed } = context;
|
4057
|
+
const { datasetReshapeInfo } = advancedVSeed;
|
4058
|
+
const { unfoldInfo } = datasetReshapeInfo[0];
|
4059
|
+
if (isLinearColor(advancedVSeed)) {
|
4060
|
+
if (result?.bar?.style) result.bar.style.fill = {
|
4061
|
+
field: unfoldInfo.encodingColor,
|
4062
|
+
scale: 'color'
|
4063
|
+
};
|
4064
|
+
}
|
4065
|
+
return result;
|
4066
|
+
};
|
3875
4067
|
const barStyle_barStyle = (spec, context)=>{
|
3876
4068
|
const { advancedVSeed } = context;
|
3877
4069
|
const { markStyle, dataset = [] } = advancedVSeed;
|
@@ -4060,18 +4252,105 @@
|
|
4060
4252
|
cornerRadius: areaBorderRadius
|
4061
4253
|
}
|
4062
4254
|
}
|
4063
|
-
};
|
4064
|
-
});
|
4255
|
+
};
|
4256
|
+
});
|
4257
|
+
return {
|
4258
|
+
...spec,
|
4259
|
+
markArea: markArea
|
4260
|
+
};
|
4261
|
+
};
|
4262
|
+
const pivotColorLegend = (spec, context)=>{
|
4263
|
+
const result = {
|
4264
|
+
...spec
|
4265
|
+
};
|
4266
|
+
const { advancedVSeed } = context;
|
4267
|
+
const { chartType } = advancedVSeed;
|
4268
|
+
const baseConfig = advancedVSeed.config[chartType];
|
4269
|
+
if (!baseConfig || !baseConfig.legend) return result;
|
4270
|
+
const { datasetReshapeInfo } = advancedVSeed;
|
4271
|
+
const max = Math.max(...datasetReshapeInfo.map((d)=>d.foldInfo.colorRange[1]));
|
4272
|
+
const min = Math.min(...datasetReshapeInfo.map((d)=>d.foldInfo.colorRange[0]));
|
4273
|
+
const { legend, color } = baseConfig;
|
4274
|
+
const { colorScheme, linearColorScheme } = color;
|
4275
|
+
const { enable, position = 'bottom', labelFontColor, labelFontSize = 12, labelFontWeight = 400 } = legend || {};
|
4276
|
+
const orient = [
|
4277
|
+
'bottom',
|
4278
|
+
'bottomLeft',
|
4279
|
+
'bottomRight',
|
4280
|
+
'bl',
|
4281
|
+
'br'
|
4282
|
+
].includes(position) ? 'bottom' : [
|
4283
|
+
'top',
|
4284
|
+
'topLeft',
|
4285
|
+
'topRight',
|
4286
|
+
'tl',
|
4287
|
+
'tr'
|
4288
|
+
].includes(position) ? 'top' : [
|
4289
|
+
'left',
|
4290
|
+
'leftTop',
|
4291
|
+
'leftBottom',
|
4292
|
+
'lt',
|
4293
|
+
'lb'
|
4294
|
+
].includes(position) ? 'left' : 'right';
|
4295
|
+
const legendPosition = [
|
4296
|
+
'topLeft',
|
4297
|
+
'bottomLeft',
|
4298
|
+
'leftTop',
|
4299
|
+
'rightTop',
|
4300
|
+
'lt',
|
4301
|
+
'rt',
|
4302
|
+
'tl',
|
4303
|
+
'bl'
|
4304
|
+
].includes(position) ? 'start' : [
|
4305
|
+
'topRight',
|
4306
|
+
'bottomRight',
|
4307
|
+
'leftBottom',
|
4308
|
+
'rightBottom',
|
4309
|
+
'lb',
|
4310
|
+
'rb',
|
4311
|
+
'rt',
|
4312
|
+
'br'
|
4313
|
+
].includes(position) ? 'end' : 'middle';
|
4314
|
+
const legends = {
|
4315
|
+
visible: enable,
|
4316
|
+
type: 'color',
|
4317
|
+
orient,
|
4318
|
+
position: legendPosition,
|
4319
|
+
colors: linearColorScheme || colorScheme || [],
|
4320
|
+
value: [
|
4321
|
+
min,
|
4322
|
+
max
|
4323
|
+
],
|
4324
|
+
min: min,
|
4325
|
+
max: max,
|
4326
|
+
maxWidth: '30%',
|
4327
|
+
startText: {
|
4328
|
+
visible: true,
|
4329
|
+
style: {
|
4330
|
+
fill: labelFontColor,
|
4331
|
+
fontSize: labelFontSize,
|
4332
|
+
fontWeight: labelFontWeight
|
4333
|
+
}
|
4334
|
+
},
|
4335
|
+
endText: {
|
4336
|
+
visible: true,
|
4337
|
+
style: {
|
4338
|
+
fill: labelFontColor,
|
4339
|
+
fontSize: labelFontSize,
|
4340
|
+
fontWeight: labelFontWeight
|
4341
|
+
}
|
4342
|
+
}
|
4343
|
+
};
|
4065
4344
|
return {
|
4066
|
-
...
|
4067
|
-
|
4345
|
+
...result,
|
4346
|
+
legends
|
4068
4347
|
};
|
4069
4348
|
};
|
4070
4349
|
const column = [
|
4071
4350
|
initColumn,
|
4072
4351
|
stackCornerRadius_stackCornerRadius,
|
4073
4352
|
stackInverse,
|
4074
|
-
color_color,
|
4353
|
+
colorAdapter(color_color, linearColor),
|
4075
4354
|
background_backgroundColor,
|
4076
4355
|
datasetXY,
|
4077
4356
|
progressive,
|
@@ -4080,8 +4359,8 @@
|
|
4080
4359
|
label_label,
|
4081
4360
|
tooltip_tooltip,
|
4082
4361
|
verticalCrosshairRect,
|
4083
|
-
discreteLegend,
|
4084
|
-
barStyle_barStyle,
|
4362
|
+
colorAdapter(discreteLegend, colorLegend),
|
4363
|
+
colorBarStyleFill(barStyle_barStyle),
|
4085
4364
|
annotationPoint_annotationPoint,
|
4086
4365
|
annotationVerticalLine_annotationVerticalLine,
|
4087
4366
|
annotationHorizontalLine_annotationHorizontalLine,
|
@@ -4096,7 +4375,7 @@
|
|
4096
4375
|
initColumn,
|
4097
4376
|
stackCornerRadius_stackCornerRadius,
|
4098
4377
|
stackInverse,
|
4099
|
-
color_color,
|
4378
|
+
colorAdapter(color_color, linearColor),
|
4100
4379
|
background_backgroundColor,
|
4101
4380
|
datasetXY,
|
4102
4381
|
progressive,
|
@@ -4105,7 +4384,7 @@
|
|
4105
4384
|
label_label,
|
4106
4385
|
tooltip_tooltip,
|
4107
4386
|
verticalCrosshairRect,
|
4108
|
-
barStyle_barStyle,
|
4387
|
+
colorBarStyleFill(barStyle_barStyle),
|
4109
4388
|
annotationPoint_annotationPoint,
|
4110
4389
|
annotationVerticalLine_annotationVerticalLine,
|
4111
4390
|
annotationHorizontalLine_annotationHorizontalLine,
|
@@ -4113,7 +4392,7 @@
|
|
4113
4392
|
]),
|
4114
4393
|
pivotRowDimensions,
|
4115
4394
|
pivotColumnDimensions,
|
4116
|
-
pivotDiscreteLegend
|
4395
|
+
colorAdapter(pivotDiscreteLegend, pivotColorLegend)
|
4117
4396
|
];
|
4118
4397
|
const columnSpecPipeline = [
|
4119
4398
|
pivotAdapter_pivotAdapter(column, pivotColumn)
|
@@ -4124,7 +4403,7 @@
|
|
4124
4403
|
};
|
4125
4404
|
const columnParallelAdvancedPipeline = [
|
4126
4405
|
initAdvancedVSeed_initAdvancedVSeed,
|
4127
|
-
|
4406
|
+
buildMeasures,
|
4128
4407
|
autoDimensions_autoDimensions,
|
4129
4408
|
encodingForColumn,
|
4130
4409
|
pivotAdapter([
|
@@ -4169,7 +4448,7 @@
|
|
4169
4448
|
const columnParallel = [
|
4170
4449
|
initColumnParallel,
|
4171
4450
|
stackCornerRadius_stackCornerRadius,
|
4172
|
-
color_color,
|
4451
|
+
colorAdapter(color_color, linearColor),
|
4173
4452
|
background_backgroundColor,
|
4174
4453
|
datasetXY,
|
4175
4454
|
progressive,
|
@@ -4177,9 +4456,9 @@
|
|
4177
4456
|
yLinear,
|
4178
4457
|
label_label,
|
4179
4458
|
tooltip_tooltip,
|
4180
|
-
discreteLegend,
|
4459
|
+
colorAdapter(discreteLegend, colorLegend),
|
4181
4460
|
verticalCrosshairRect,
|
4182
|
-
barStyle_barStyle,
|
4461
|
+
colorBarStyleFill(barStyle_barStyle),
|
4183
4462
|
annotationPoint_annotationPoint,
|
4184
4463
|
annotationVerticalLine_annotationVerticalLine,
|
4185
4464
|
annotationHorizontalLine_annotationHorizontalLine,
|
@@ -4193,7 +4472,7 @@
|
|
4193
4472
|
pivotIndicators_pivotIndicators([
|
4194
4473
|
initColumnParallel,
|
4195
4474
|
stackCornerRadius_stackCornerRadius,
|
4196
|
-
color_color,
|
4475
|
+
colorAdapter(color_color, linearColor),
|
4197
4476
|
background_backgroundColor,
|
4198
4477
|
datasetXY,
|
4199
4478
|
progressive,
|
@@ -4202,7 +4481,7 @@
|
|
4202
4481
|
label_label,
|
4203
4482
|
tooltip_tooltip,
|
4204
4483
|
verticalCrosshairRect,
|
4205
|
-
barStyle_barStyle,
|
4484
|
+
colorBarStyleFill(barStyle_barStyle),
|
4206
4485
|
annotationPoint_annotationPoint,
|
4207
4486
|
annotationVerticalLine_annotationVerticalLine,
|
4208
4487
|
annotationHorizontalLine_annotationHorizontalLine,
|
@@ -4210,7 +4489,7 @@
|
|
4210
4489
|
]),
|
4211
4490
|
pivotRowDimensions,
|
4212
4491
|
pivotColumnDimensions,
|
4213
|
-
pivotDiscreteLegend
|
4492
|
+
colorAdapter(pivotDiscreteLegend, pivotColorLegend)
|
4214
4493
|
];
|
4215
4494
|
const columnParallelSpecPipeline = [
|
4216
4495
|
pivotAdapter_pivotAdapter(columnParallel, pivotColumnParallel)
|
@@ -4221,7 +4500,7 @@
|
|
4221
4500
|
};
|
4222
4501
|
const columnPercentAdvancedPipeline = [
|
4223
4502
|
initAdvancedVSeed_initAdvancedVSeed,
|
4224
|
-
|
4503
|
+
buildMeasures,
|
4225
4504
|
autoDimensions_autoDimensions,
|
4226
4505
|
encodingForColumn,
|
4227
4506
|
pivotAdapter([
|
@@ -4247,7 +4526,7 @@
|
|
4247
4526
|
initColumn,
|
4248
4527
|
stackCornerRadius_stackCornerRadius,
|
4249
4528
|
stackInverse,
|
4250
|
-
color_color,
|
4529
|
+
colorAdapter(color_color, linearColor),
|
4251
4530
|
background_backgroundColor,
|
4252
4531
|
percent,
|
4253
4532
|
datasetXY,
|
@@ -4256,9 +4535,9 @@
|
|
4256
4535
|
yLinear,
|
4257
4536
|
label_label,
|
4258
4537
|
tooltip_tooltip,
|
4538
|
+
colorAdapter(discreteLegend, colorLegend),
|
4259
4539
|
verticalCrosshairRect,
|
4260
|
-
|
4261
|
-
barStyle_barStyle,
|
4540
|
+
colorBarStyleFill(barStyle_barStyle),
|
4262
4541
|
annotationPoint_annotationPoint,
|
4263
4542
|
annotationVerticalLine_annotationVerticalLine,
|
4264
4543
|
annotationHorizontalLine_annotationHorizontalLine,
|
@@ -4273,7 +4552,7 @@
|
|
4273
4552
|
initColumn,
|
4274
4553
|
stackCornerRadius_stackCornerRadius,
|
4275
4554
|
stackInverse,
|
4276
|
-
color_color,
|
4555
|
+
colorAdapter(color_color, linearColor),
|
4277
4556
|
percent,
|
4278
4557
|
background_backgroundColor,
|
4279
4558
|
datasetXY,
|
@@ -4283,7 +4562,7 @@
|
|
4283
4562
|
label_label,
|
4284
4563
|
tooltip_tooltip,
|
4285
4564
|
verticalCrosshairRect,
|
4286
|
-
barStyle_barStyle,
|
4565
|
+
colorBarStyleFill(barStyle_barStyle),
|
4287
4566
|
annotationPoint_annotationPoint,
|
4288
4567
|
annotationVerticalLine_annotationVerticalLine,
|
4289
4568
|
annotationHorizontalLine_annotationHorizontalLine,
|
@@ -4291,7 +4570,7 @@
|
|
4291
4570
|
]),
|
4292
4571
|
pivotRowDimensions,
|
4293
4572
|
pivotColumnDimensions,
|
4294
|
-
pivotDiscreteLegend
|
4573
|
+
colorAdapter(pivotDiscreteLegend, pivotColorLegend)
|
4295
4574
|
];
|
4296
4575
|
const columnPercentSpecPipeline = [
|
4297
4576
|
pivotAdapter_pivotAdapter(columnPercent, pivotColumnPercent)
|
@@ -4313,10 +4592,10 @@
|
|
4313
4592
|
(dimensions[1] || dimensions[0]).id
|
4314
4593
|
];
|
4315
4594
|
const detail = encoding.detail || [];
|
4316
|
-
const mergedDetail = chunk_QJLMYOTX_i([
|
4595
|
+
const mergedDetail = 0 === detail.length ? chunk_QJLMYOTX_i([
|
4317
4596
|
...color,
|
4318
4597
|
...detail
|
4319
|
-
]);
|
4598
|
+
]) : detail;
|
4320
4599
|
return {
|
4321
4600
|
...advancedVSeed,
|
4322
4601
|
encoding: {
|
@@ -4360,7 +4639,7 @@
|
|
4360
4639
|
};
|
4361
4640
|
const barAdvancedPipeline = [
|
4362
4641
|
initAdvancedVSeed_initAdvancedVSeed,
|
4363
|
-
|
4642
|
+
buildMeasures,
|
4364
4643
|
autoDimensions_autoDimensions,
|
4365
4644
|
encodingForBar,
|
4366
4645
|
pivotAdapter([
|
@@ -4660,7 +4939,7 @@
|
|
4660
4939
|
const bar = [
|
4661
4940
|
initBar,
|
4662
4941
|
stackCornerRadius_stackCornerRadius,
|
4663
|
-
color_color,
|
4942
|
+
colorAdapter(color_color, linearColor),
|
4664
4943
|
background_backgroundColor,
|
4665
4944
|
datasetYX,
|
4666
4945
|
progressive,
|
@@ -4668,9 +4947,9 @@
|
|
4668
4947
|
yBand,
|
4669
4948
|
label_label,
|
4670
4949
|
tooltip_tooltip,
|
4950
|
+
colorAdapter(discreteLegend, colorLegend),
|
4671
4951
|
horizontalCrosshairRect,
|
4672
|
-
|
4673
|
-
barStyle_barStyle,
|
4952
|
+
colorBarStyleFill(barStyle_barStyle),
|
4674
4953
|
annotationPoint_annotationPoint,
|
4675
4954
|
annotationVerticalLine_annotationVerticalLine,
|
4676
4955
|
annotationHorizontalLine_annotationHorizontalLine,
|
@@ -4684,7 +4963,7 @@
|
|
4684
4963
|
pivotIndicators_pivotIndicators([
|
4685
4964
|
initBar,
|
4686
4965
|
stackCornerRadius_stackCornerRadius,
|
4687
|
-
color_color,
|
4966
|
+
colorAdapter(color_color, linearColor),
|
4688
4967
|
background_backgroundColor,
|
4689
4968
|
datasetYX,
|
4690
4969
|
progressive,
|
@@ -4693,8 +4972,8 @@
|
|
4693
4972
|
label_label,
|
4694
4973
|
label_label,
|
4695
4974
|
tooltip_tooltip,
|
4975
|
+
colorBarStyleFill(barStyle_barStyle),
|
4696
4976
|
horizontalCrosshairRect,
|
4697
|
-
barStyle_barStyle,
|
4698
4977
|
annotationPoint_annotationPoint,
|
4699
4978
|
annotationVerticalLine_annotationVerticalLine,
|
4700
4979
|
annotationHorizontalLine_annotationHorizontalLine,
|
@@ -4702,7 +4981,7 @@
|
|
4702
4981
|
]),
|
4703
4982
|
pivotRowDimensions,
|
4704
4983
|
pivotColumnDimensions,
|
4705
|
-
pivotDiscreteLegend
|
4984
|
+
colorAdapter(pivotDiscreteLegend, pivotColorLegend)
|
4706
4985
|
];
|
4707
4986
|
const barSpecPipeline = [
|
4708
4987
|
pivotAdapter_pivotAdapter(bar, pivotBar)
|
@@ -4713,7 +4992,7 @@
|
|
4713
4992
|
};
|
4714
4993
|
const barParallelAdvancedPipeline = [
|
4715
4994
|
initAdvancedVSeed_initAdvancedVSeed,
|
4716
|
-
|
4995
|
+
buildMeasures,
|
4717
4996
|
autoDimensions_autoDimensions,
|
4718
4997
|
encodingForBar,
|
4719
4998
|
pivotAdapter([
|
@@ -4758,7 +5037,7 @@
|
|
4758
5037
|
const barParallel = [
|
4759
5038
|
initBarParallel,
|
4760
5039
|
stackCornerRadius_stackCornerRadius,
|
4761
|
-
color_color,
|
5040
|
+
colorAdapter(color_color, linearColor),
|
4762
5041
|
background_backgroundColor,
|
4763
5042
|
datasetYX,
|
4764
5043
|
progressive,
|
@@ -4766,9 +5045,9 @@
|
|
4766
5045
|
yBand,
|
4767
5046
|
label_label,
|
4768
5047
|
tooltip_tooltip,
|
5048
|
+
colorAdapter(discreteLegend, colorLegend),
|
4769
5049
|
horizontalCrosshairRect,
|
4770
|
-
|
4771
|
-
barStyle_barStyle,
|
5050
|
+
colorBarStyleFill(barStyle_barStyle),
|
4772
5051
|
annotationPoint_annotationPoint,
|
4773
5052
|
annotationVerticalLine_annotationVerticalLine,
|
4774
5053
|
annotationHorizontalLine_annotationHorizontalLine,
|
@@ -4782,15 +5061,15 @@
|
|
4782
5061
|
pivotIndicators_pivotIndicators([
|
4783
5062
|
initBarParallel,
|
4784
5063
|
stackCornerRadius_stackCornerRadius,
|
4785
|
-
color_color,
|
5064
|
+
colorAdapter(color_color, linearColor),
|
4786
5065
|
background_backgroundColor,
|
4787
5066
|
datasetYX,
|
4788
5067
|
xLinear,
|
4789
5068
|
yBand,
|
4790
5069
|
label_label,
|
4791
5070
|
tooltip_tooltip,
|
5071
|
+
colorBarStyleFill(barStyle_barStyle),
|
4792
5072
|
horizontalCrosshairRect,
|
4793
|
-
barStyle_barStyle,
|
4794
5073
|
annotationPoint_annotationPoint,
|
4795
5074
|
annotationVerticalLine_annotationVerticalLine,
|
4796
5075
|
annotationHorizontalLine_annotationHorizontalLine,
|
@@ -4798,7 +5077,7 @@
|
|
4798
5077
|
]),
|
4799
5078
|
pivotRowDimensions,
|
4800
5079
|
pivotColumnDimensions,
|
4801
|
-
pivotDiscreteLegend
|
5080
|
+
colorAdapter(pivotDiscreteLegend, pivotColorLegend)
|
4802
5081
|
];
|
4803
5082
|
const barParallelSpecPipeline = [
|
4804
5083
|
pivotAdapter_pivotAdapter(barParallel, pivotBarParallel)
|
@@ -4809,7 +5088,7 @@
|
|
4809
5088
|
};
|
4810
5089
|
const barPercentAdvancedPipeline = [
|
4811
5090
|
initAdvancedVSeed_initAdvancedVSeed,
|
4812
|
-
|
5091
|
+
buildMeasures,
|
4813
5092
|
autoDimensions_autoDimensions,
|
4814
5093
|
encodingForBar,
|
4815
5094
|
pivotAdapter([
|
@@ -4827,7 +5106,7 @@
|
|
4827
5106
|
const barPercent = [
|
4828
5107
|
initBar,
|
4829
5108
|
stackCornerRadius_stackCornerRadius,
|
4830
|
-
color_color,
|
5109
|
+
colorAdapter(color_color, linearColor),
|
4831
5110
|
background_backgroundColor,
|
4832
5111
|
percent,
|
4833
5112
|
datasetYX,
|
@@ -4836,9 +5115,9 @@
|
|
4836
5115
|
yBand,
|
4837
5116
|
label_label,
|
4838
5117
|
tooltip_tooltip,
|
5118
|
+
colorAdapter(discreteLegend, colorLegend),
|
4839
5119
|
horizontalCrosshairRect,
|
4840
|
-
|
4841
|
-
barStyle_barStyle,
|
5120
|
+
colorBarStyleFill(barStyle_barStyle),
|
4842
5121
|
annotationPoint_annotationPoint,
|
4843
5122
|
annotationVerticalLine_annotationVerticalLine,
|
4844
5123
|
annotationHorizontalLine_annotationHorizontalLine,
|
@@ -4852,7 +5131,7 @@
|
|
4852
5131
|
pivotIndicators_pivotIndicators([
|
4853
5132
|
initBar,
|
4854
5133
|
stackCornerRadius_stackCornerRadius,
|
4855
|
-
color_color,
|
5134
|
+
colorAdapter(color_color, linearColor),
|
4856
5135
|
background_backgroundColor,
|
4857
5136
|
percent,
|
4858
5137
|
datasetYX,
|
@@ -4860,8 +5139,8 @@
|
|
4860
5139
|
xLinear,
|
4861
5140
|
label_label,
|
4862
5141
|
tooltip_tooltip,
|
5142
|
+
colorBarStyleFill(barStyle_barStyle),
|
4863
5143
|
horizontalCrosshairRect,
|
4864
|
-
barStyle_barStyle,
|
4865
5144
|
annotationPoint_annotationPoint,
|
4866
5145
|
annotationVerticalLine_annotationVerticalLine,
|
4867
5146
|
annotationHorizontalLine_annotationHorizontalLine,
|
@@ -4869,7 +5148,7 @@
|
|
4869
5148
|
]),
|
4870
5149
|
pivotRowDimensions,
|
4871
5150
|
pivotColumnDimensions,
|
4872
|
-
pivotDiscreteLegend
|
5151
|
+
colorAdapter(pivotDiscreteLegend, pivotColorLegend)
|
4873
5152
|
];
|
4874
5153
|
const barPercentSpecPipeline = [
|
4875
5154
|
pivotAdapter_pivotAdapter(barPercent, pivotBarPercent)
|
@@ -4880,7 +5159,7 @@
|
|
4880
5159
|
};
|
4881
5160
|
const areaAdvancedPipeline = [
|
4882
5161
|
initAdvancedVSeed_initAdvancedVSeed,
|
4883
|
-
|
5162
|
+
buildMeasures,
|
4884
5163
|
autoDimensions_autoDimensions,
|
4885
5164
|
encodingForColumn,
|
4886
5165
|
pivotAdapter([
|
@@ -4906,7 +5185,7 @@
|
|
4906
5185
|
result.direction = 'vertical';
|
4907
5186
|
result.yField = foldInfo.measureValue;
|
4908
5187
|
result.xField = unfoldInfo.encodingX;
|
4909
|
-
result.seriesField = unfoldInfo.encodingColorId;
|
5188
|
+
result.seriesField = isLinearColor(advancedVSeed) ? unfoldInfo.encodingDetail : unfoldInfo.encodingColorId;
|
4910
5189
|
result.padding = 0;
|
4911
5190
|
result.region = [
|
4912
5191
|
{
|
@@ -4916,20 +5195,32 @@
|
|
4916
5195
|
result.animation = true;
|
4917
5196
|
return result;
|
4918
5197
|
};
|
5198
|
+
const colorAreaStyleFill = (stylePipe)=>(spec, context)=>{
|
5199
|
+
const result = stylePipe(spec, context);
|
5200
|
+
const { advancedVSeed } = context;
|
5201
|
+
const { datasetReshapeInfo } = advancedVSeed;
|
5202
|
+
const { unfoldInfo } = datasetReshapeInfo[0];
|
5203
|
+
if (isLinearColor(advancedVSeed)) {
|
5204
|
+
if (result?.area?.style) result.area.style.fill = {
|
5205
|
+
field: unfoldInfo.encodingColor,
|
5206
|
+
scale: 'color'
|
5207
|
+
};
|
5208
|
+
}
|
5209
|
+
return result;
|
5210
|
+
};
|
4919
5211
|
const areaStyle_areaStyle = (spec, context)=>{
|
4920
5212
|
const { advancedVSeed } = context;
|
4921
5213
|
const { markStyle, datasetReshapeInfo, dataset } = advancedVSeed;
|
4922
5214
|
const { areaStyle } = markStyle;
|
4923
5215
|
const { unfoldInfo } = datasetReshapeInfo[0];
|
4924
|
-
|
5216
|
+
const result = {
|
4925
5217
|
...spec,
|
4926
5218
|
area: {
|
4927
|
-
visible: true
|
5219
|
+
visible: true,
|
5220
|
+
style: {}
|
4928
5221
|
}
|
4929
5222
|
};
|
4930
|
-
|
4931
|
-
...spec
|
4932
|
-
};
|
5223
|
+
if (!areaStyle) return result;
|
4933
5224
|
const areaStyles = Array.isArray(areaStyle) ? areaStyle : [
|
4934
5225
|
areaStyle
|
4935
5226
|
];
|
@@ -4957,6 +5248,7 @@
|
|
4957
5248
|
return {
|
4958
5249
|
...result,
|
4959
5250
|
area: {
|
5251
|
+
...result.area,
|
4960
5252
|
visible: true,
|
4961
5253
|
state: {
|
4962
5254
|
...customMap
|
@@ -4967,7 +5259,7 @@
|
|
4967
5259
|
const area_area = [
|
4968
5260
|
initArea,
|
4969
5261
|
stackInverse,
|
4970
|
-
color_color,
|
5262
|
+
colorAdapter(color_color, linearColor),
|
4971
5263
|
background_backgroundColor,
|
4972
5264
|
datasetXY,
|
4973
5265
|
progressive,
|
@@ -4975,12 +5267,12 @@
|
|
4975
5267
|
yLinear,
|
4976
5268
|
label_label,
|
4977
5269
|
tooltip_tooltip,
|
5270
|
+
colorAdapter(discreteLegend, colorLegend),
|
4978
5271
|
verticalCrosshairLine,
|
4979
|
-
|
4980
|
-
pointStyle_pointStyle,
|
5272
|
+
colorPointStyleFill(pointStyle_pointStyle),
|
4981
5273
|
pointStateDimensionHover,
|
4982
|
-
lineStyle_lineStyle,
|
4983
|
-
areaStyle_areaStyle,
|
5274
|
+
colorLineStyleFill(lineStyle_lineStyle),
|
5275
|
+
colorAreaStyleFill(areaStyle_areaStyle),
|
4984
5276
|
annotationPoint_annotationPoint,
|
4985
5277
|
annotationVerticalLine_annotationVerticalLine,
|
4986
5278
|
annotationHorizontalLine_annotationHorizontalLine,
|
@@ -4993,7 +5285,7 @@
|
|
4993
5285
|
datasetPivot,
|
4994
5286
|
pivotIndicators_pivotIndicators([
|
4995
5287
|
initArea,
|
4996
|
-
color_color,
|
5288
|
+
colorAdapter(color_color, linearColor),
|
4997
5289
|
background_backgroundColor,
|
4998
5290
|
stackInverse,
|
4999
5291
|
datasetXY,
|
@@ -5003,10 +5295,10 @@
|
|
5003
5295
|
label_label,
|
5004
5296
|
tooltip_tooltip,
|
5005
5297
|
verticalCrosshairLine,
|
5006
|
-
pointStyle_pointStyle,
|
5298
|
+
colorPointStyleFill(pointStyle_pointStyle),
|
5007
5299
|
pointStateDimensionHover,
|
5008
|
-
lineStyle_lineStyle,
|
5009
|
-
areaStyle_areaStyle,
|
5300
|
+
colorLineStyleFill(lineStyle_lineStyle),
|
5301
|
+
colorAreaStyleFill(areaStyle_areaStyle),
|
5010
5302
|
annotationPoint_annotationPoint,
|
5011
5303
|
annotationVerticalLine_annotationVerticalLine,
|
5012
5304
|
annotationHorizontalLine_annotationHorizontalLine,
|
@@ -5014,7 +5306,7 @@
|
|
5014
5306
|
]),
|
5015
5307
|
pivotRowDimensions,
|
5016
5308
|
pivotColumnDimensions,
|
5017
|
-
pivotDiscreteLegend
|
5309
|
+
colorAdapter(pivotDiscreteLegend, pivotColorLegend)
|
5018
5310
|
];
|
5019
5311
|
const areaSpecPipeline = [
|
5020
5312
|
pivotAdapter_pivotAdapter(area_area, pivotArea)
|
@@ -5025,7 +5317,7 @@
|
|
5025
5317
|
};
|
5026
5318
|
const areaPercentAdvancedPipeline = [
|
5027
5319
|
initAdvancedVSeed_initAdvancedVSeed,
|
5028
|
-
|
5320
|
+
buildMeasures,
|
5029
5321
|
autoDimensions_autoDimensions,
|
5030
5322
|
encodingForColumn,
|
5031
5323
|
pivotAdapter([
|
@@ -5043,7 +5335,7 @@
|
|
5043
5335
|
const areaPercent = [
|
5044
5336
|
initArea,
|
5045
5337
|
stackInverse,
|
5046
|
-
color_color,
|
5338
|
+
colorAdapter(color_color, linearColor),
|
5047
5339
|
background_backgroundColor,
|
5048
5340
|
percent,
|
5049
5341
|
datasetXY,
|
@@ -5052,11 +5344,12 @@
|
|
5052
5344
|
yLinear,
|
5053
5345
|
label_label,
|
5054
5346
|
tooltip_tooltip,
|
5347
|
+
colorAdapter(discreteLegend, colorLegend),
|
5055
5348
|
verticalCrosshairLine,
|
5056
|
-
|
5057
|
-
|
5058
|
-
lineStyle_lineStyle,
|
5059
|
-
areaStyle_areaStyle,
|
5349
|
+
colorPointStyleFill(pointStyle_pointStyle),
|
5350
|
+
pointStateDimensionHover,
|
5351
|
+
colorLineStyleFill(lineStyle_lineStyle),
|
5352
|
+
colorAreaStyleFill(areaStyle_areaStyle),
|
5060
5353
|
annotationPoint_annotationPoint,
|
5061
5354
|
annotationVerticalLine_annotationVerticalLine,
|
5062
5355
|
annotationHorizontalLine_annotationHorizontalLine,
|
@@ -5070,7 +5363,7 @@
|
|
5070
5363
|
pivotIndicators_pivotIndicators([
|
5071
5364
|
initArea,
|
5072
5365
|
stackInverse,
|
5073
|
-
color_color,
|
5366
|
+
colorAdapter(color_color, linearColor),
|
5074
5367
|
background_backgroundColor,
|
5075
5368
|
percent,
|
5076
5369
|
datasetXY,
|
@@ -5080,9 +5373,10 @@
|
|
5080
5373
|
label_label,
|
5081
5374
|
tooltip_tooltip,
|
5082
5375
|
verticalCrosshairLine,
|
5083
|
-
pointStyle_pointStyle,
|
5084
|
-
|
5085
|
-
|
5376
|
+
colorPointStyleFill(pointStyle_pointStyle),
|
5377
|
+
pointStateDimensionHover,
|
5378
|
+
colorLineStyleFill(lineStyle_lineStyle),
|
5379
|
+
colorAreaStyleFill(areaStyle_areaStyle),
|
5086
5380
|
annotationPoint_annotationPoint,
|
5087
5381
|
annotationVerticalLine_annotationVerticalLine,
|
5088
5382
|
annotationHorizontalLine_annotationHorizontalLine,
|
@@ -5090,7 +5384,7 @@
|
|
5090
5384
|
]),
|
5091
5385
|
pivotRowDimensions,
|
5092
5386
|
pivotColumnDimensions,
|
5093
|
-
pivotDiscreteLegend
|
5387
|
+
colorAdapter(pivotDiscreteLegend, pivotColorLegend)
|
5094
5388
|
];
|
5095
5389
|
const areaPercentSpecPipeline = [
|
5096
5390
|
pivotAdapter_pivotAdapter(areaPercent, pivotAreaPercent)
|
@@ -5099,95 +5393,105 @@
|
|
5099
5393
|
Builder._advancedPipelineMap.areaPercent = areaPercentAdvancedPipeline;
|
5100
5394
|
Builder._specPipelineMap.areaPercent = areaPercentSpecPipeline;
|
5101
5395
|
};
|
5102
|
-
const
|
5103
|
-
const result = {
|
5104
|
-
...advancedVSeed
|
5105
|
-
};
|
5396
|
+
const buildMeasuresForScatter = (advancedVSeed, context)=>{
|
5106
5397
|
const { vseed } = context;
|
5107
|
-
|
5108
|
-
|
5109
|
-
|
5110
|
-
if (scatterMeasures) {
|
5111
|
-
result.measures = scatterMeasuresToMeasureTree(scatterMeasures);
|
5112
|
-
return result;
|
5398
|
+
if (isMeasureTreeWithChildren(vseed)) {
|
5399
|
+
advancedVSeed.measures = vseed.measures;
|
5400
|
+
return advancedVSeed;
|
5113
5401
|
}
|
5114
|
-
if (
|
5115
|
-
|
5116
|
-
return
|
5402
|
+
if (isMeasureTreeWithParentId(vseed)) {
|
5403
|
+
advancedVSeed.measures = buildMeasuresForScatter_generateMeasuresByParentId(vseed.measures);
|
5404
|
+
return advancedVSeed;
|
5117
5405
|
}
|
5118
|
-
const
|
5119
|
-
const
|
5120
|
-
|
5121
|
-
|
5122
|
-
|
5123
|
-
|
5124
|
-
|
5125
|
-
|
5126
|
-
|
5127
|
-
]
|
5128
|
-
|
5129
|
-
|
5130
|
-
|
5131
|
-
|
5132
|
-
|
5133
|
-
|
5134
|
-
|
5135
|
-
|
5136
|
-
|
5137
|
-
|
5138
|
-
|
5139
|
-
else if (newMeasures.length > 1) result.measures = [
|
5140
|
-
{
|
5141
|
-
id: 'primary',
|
5142
|
-
alias: 'primary',
|
5143
|
-
children: newMeasures.slice(0, 1)
|
5144
|
-
},
|
5406
|
+
const basicMeasures = getBasicMeasures(vseed);
|
5407
|
+
const scatterMeasures = vseed.scatterMeasures ? vseed.scatterMeasures : basicMeasuresToScatterMeasures(basicMeasures);
|
5408
|
+
advancedVSeed.measures = scatterMeasuresToMeasureTree(scatterMeasures);
|
5409
|
+
return advancedVSeed;
|
5410
|
+
};
|
5411
|
+
const basicMeasuresToScatterMeasures = (basicMeasures)=>{
|
5412
|
+
const yMeasures = [];
|
5413
|
+
const xMeasures = [];
|
5414
|
+
for(let index = 0; index < basicMeasures.length; index++){
|
5415
|
+
const item = basicMeasures[index];
|
5416
|
+
const encoding = Array.isArray(item.encoding) ? item.encoding : [
|
5417
|
+
item.encoding
|
5418
|
+
];
|
5419
|
+
const isYAxis = encoding.includes('yAxis');
|
5420
|
+
const isXAxis = encoding.includes('xAxis');
|
5421
|
+
if (isYAxis) yMeasures.push(item);
|
5422
|
+
else if (isXAxis) xMeasures.push(item);
|
5423
|
+
else if (0 === index) yMeasures.push(item);
|
5424
|
+
else xMeasures.push(item);
|
5425
|
+
}
|
5426
|
+
return [
|
5145
5427
|
{
|
5146
|
-
id: '
|
5147
|
-
|
5148
|
-
|
5428
|
+
id: 'scatterMeasures',
|
5429
|
+
xMeasures,
|
5430
|
+
yMeasures
|
5149
5431
|
}
|
5150
5432
|
];
|
5151
|
-
return result;
|
5152
5433
|
};
|
5153
5434
|
const scatterMeasuresToMeasureTree = (scatterMeasures)=>{
|
5154
5435
|
const measureTree = scatterMeasures.map((item, index)=>{
|
5155
|
-
const { xMeasures, yMeasures } = item;
|
5436
|
+
const { id, xMeasures, yMeasures } = item;
|
5156
5437
|
const groupChildren = [];
|
5157
|
-
let
|
5438
|
+
let groupId = `${id}-`;
|
5158
5439
|
if (xMeasures) {
|
5159
|
-
const
|
5440
|
+
const arrPrimaryMeasures = Array.isArray(xMeasures) ? xMeasures : [
|
5160
5441
|
xMeasures
|
5161
5442
|
];
|
5162
|
-
const alias =
|
5163
|
-
|
5443
|
+
const alias = arrPrimaryMeasures.map((item)=>item.alias || item.id).toString();
|
5444
|
+
groupId += alias;
|
5164
5445
|
groupChildren.push({
|
5165
5446
|
id: `${index}-x`,
|
5166
|
-
alias:
|
5167
|
-
children:
|
5447
|
+
alias: arrPrimaryMeasures.map((item)=>item.alias || item.id).toString(),
|
5448
|
+
children: arrPrimaryMeasures
|
5168
5449
|
});
|
5169
5450
|
}
|
5170
5451
|
if (yMeasures) {
|
5171
|
-
const
|
5452
|
+
const arrSecondaryMeasures = Array.isArray(yMeasures) ? yMeasures : [
|
5172
5453
|
yMeasures
|
5173
5454
|
];
|
5174
|
-
const alias =
|
5175
|
-
|
5455
|
+
const alias = arrSecondaryMeasures.map((item)=>item.alias || item.id).toString();
|
5456
|
+
groupId += alias;
|
5176
5457
|
groupChildren.push({
|
5177
5458
|
id: `${index}-y`,
|
5178
|
-
alias:
|
5179
|
-
children:
|
5459
|
+
alias: arrSecondaryMeasures.map((item)=>item.alias || item.id).toString(),
|
5460
|
+
children: arrSecondaryMeasures
|
5180
5461
|
});
|
5181
5462
|
}
|
5182
5463
|
return {
|
5183
|
-
id,
|
5184
|
-
alias:
|
5464
|
+
id: groupId,
|
5465
|
+
alias: groupId,
|
5185
5466
|
children: groupChildren
|
5186
5467
|
};
|
5187
5468
|
});
|
5188
5469
|
if (1 === scatterMeasures.length) return measureTree[0].children || [];
|
5189
5470
|
return measureTree;
|
5190
5471
|
};
|
5472
|
+
const buildMeasuresForScatter_generateMeasuresByParentId = (measures)=>{
|
5473
|
+
const scatterMeasures = [];
|
5474
|
+
measures.forEach((item)=>{
|
5475
|
+
if (!item.parentId) return;
|
5476
|
+
if (!scatterMeasures.find((d)=>d.id === item.parentId)) scatterMeasures.push({
|
5477
|
+
id: item.parentId,
|
5478
|
+
yMeasures: [],
|
5479
|
+
xMeasures: []
|
5480
|
+
});
|
5481
|
+
const scatterChart = scatterMeasures.find((d)=>d.id === item.parentId);
|
5482
|
+
if (!scatterChart || !Array.isArray(scatterChart.yMeasures) || !Array.isArray(scatterChart.xMeasures)) return;
|
5483
|
+
const encoding = Array.isArray(item.encoding) ? item.encoding : [
|
5484
|
+
item.encoding
|
5485
|
+
];
|
5486
|
+
const isY = encoding.includes('yAxis');
|
5487
|
+
const isX = encoding.includes('xAxis');
|
5488
|
+
if (isY) scatterChart.yMeasures.push(item);
|
5489
|
+
else if (isX) scatterChart.xMeasures.push(item);
|
5490
|
+
else if (!isY && !isX) if (0 === scatterChart.yMeasures.length) scatterChart.yMeasures.push(item);
|
5491
|
+
else scatterChart.xMeasures.push(item);
|
5492
|
+
});
|
5493
|
+
return scatterMeasuresToMeasureTree(scatterMeasures);
|
5494
|
+
};
|
5191
5495
|
const encodingForScatter = (advancedVSeed, context)=>{
|
5192
5496
|
const { vseed } = context;
|
5193
5497
|
const { dimensions } = advancedVSeed;
|
@@ -5198,10 +5502,10 @@
|
|
5198
5502
|
const color = encoding.color || [
|
5199
5503
|
(dimensions[1] || dimensions[0]).id
|
5200
5504
|
];
|
5201
|
-
const mergedDetail = chunk_QJLMYOTX_i([
|
5505
|
+
const mergedDetail = 0 === detail.length ? chunk_QJLMYOTX_i([
|
5202
5506
|
...color,
|
5203
5507
|
...detail
|
5204
|
-
]);
|
5508
|
+
]) : detail;
|
5205
5509
|
return {
|
5206
5510
|
...advancedVSeed,
|
5207
5511
|
encoding: {
|
@@ -5243,7 +5547,8 @@
|
|
5243
5547
|
if (xMeasures && xMeasures.children) {
|
5244
5548
|
const { dataset: newDataset, foldInfo, unfoldInfo } = dataReshapeByEncoding(dataset, dimensions, xMeasures.children, encoding, {
|
5245
5549
|
foldMeasureValue: FoldXMeasureValue,
|
5246
|
-
colorItemAsId: true
|
5550
|
+
colorItemAsId: true,
|
5551
|
+
colorMeasureId: getColorMeasureId(advancedVSeed)
|
5247
5552
|
});
|
5248
5553
|
datasets.push(newDataset);
|
5249
5554
|
foldInfoList.push(foldInfo);
|
@@ -5252,7 +5557,8 @@
|
|
5252
5557
|
if (yMeasures && yMeasures.children) {
|
5253
5558
|
const { dataset: newDataset, foldInfo, unfoldInfo } = dataReshapeByEncoding(datasets[0], dimensions, yMeasures.children, encoding, {
|
5254
5559
|
foldMeasureValue: FoldYMeasureValue,
|
5255
|
-
colorItemAsId: true
|
5560
|
+
colorItemAsId: true,
|
5561
|
+
colorMeasureId: getColorMeasureId(advancedVSeed)
|
5256
5562
|
});
|
5257
5563
|
datasets[0] = newDataset;
|
5258
5564
|
foldInfoList.push(foldInfo);
|
@@ -5307,7 +5613,8 @@
|
|
5307
5613
|
if (xMeasures && xMeasures.children) {
|
5308
5614
|
const { dataset: newDataset, foldInfo, unfoldInfo } = dataReshapeByEncoding(dataset, dimensions, xMeasures.children, encoding, {
|
5309
5615
|
foldMeasureValue: `${FoldXMeasureValue}${index}`,
|
5310
|
-
colorItemAsId: true
|
5616
|
+
colorItemAsId: true,
|
5617
|
+
colorMeasureId: getColorMeasureId(advancedVSeed)
|
5311
5618
|
});
|
5312
5619
|
datasets.push(newDataset);
|
5313
5620
|
foldInfoList.push(foldInfo);
|
@@ -5316,7 +5623,8 @@
|
|
5316
5623
|
if (yMeasures && yMeasures.children) {
|
5317
5624
|
const { dataset: newDataset, foldInfo, unfoldInfo } = dataReshapeByEncoding(dataset, dimensions, yMeasures.children, encoding, {
|
5318
5625
|
foldMeasureValue: `${FoldYMeasureValue}${index}`,
|
5319
|
-
colorItemAsId: true
|
5626
|
+
colorItemAsId: true,
|
5627
|
+
colorMeasureId: getColorMeasureId(advancedVSeed)
|
5320
5628
|
});
|
5321
5629
|
datasets.push(newDataset);
|
5322
5630
|
foldInfoList.push(foldInfo);
|
@@ -5351,7 +5659,7 @@
|
|
5351
5659
|
};
|
5352
5660
|
const scatterAdvancedPipeline = [
|
5353
5661
|
initAdvancedVSeed_initAdvancedVSeed,
|
5354
|
-
|
5662
|
+
buildMeasuresForScatter,
|
5355
5663
|
autoDimensions_autoDimensions,
|
5356
5664
|
encodingForScatter,
|
5357
5665
|
pivotAdapter([
|
@@ -5445,7 +5753,7 @@
|
|
5445
5753
|
};
|
5446
5754
|
const scatter = [
|
5447
5755
|
initScatter,
|
5448
|
-
color_color,
|
5756
|
+
colorAdapter(color_color, linearColor),
|
5449
5757
|
background_backgroundColor,
|
5450
5758
|
datasetScatter,
|
5451
5759
|
progressive,
|
@@ -5453,10 +5761,10 @@
|
|
5453
5761
|
yLinear,
|
5454
5762
|
label_label,
|
5455
5763
|
tooltip_tooltip,
|
5764
|
+
colorAdapter(discreteLegend, colorLegend),
|
5456
5765
|
verticalCrosshairLine,
|
5457
5766
|
horizontalCrosshairLine,
|
5458
|
-
|
5459
|
-
pointStyle_pointStyle,
|
5767
|
+
colorPointStyleFill(pointStyle_pointStyle),
|
5460
5768
|
pointStateHover,
|
5461
5769
|
annotationPoint_annotationPoint,
|
5462
5770
|
annotationVerticalLine_annotationVerticalLine,
|
@@ -5470,7 +5778,7 @@
|
|
5470
5778
|
datasetPivot,
|
5471
5779
|
pivotIndicators_pivotIndicators([
|
5472
5780
|
initScatter,
|
5473
|
-
color_color,
|
5781
|
+
colorAdapter(color_color, linearColor),
|
5474
5782
|
background_backgroundColor,
|
5475
5783
|
datasetScatter,
|
5476
5784
|
progressive,
|
@@ -5480,7 +5788,7 @@
|
|
5480
5788
|
tooltip_tooltip,
|
5481
5789
|
verticalCrosshairLine,
|
5482
5790
|
horizontalCrosshairLine,
|
5483
|
-
pointStyle_pointStyle,
|
5791
|
+
colorPointStyleFill(pointStyle_pointStyle),
|
5484
5792
|
pointStateHover,
|
5485
5793
|
annotationPoint_annotationPoint,
|
5486
5794
|
annotationVerticalLine_annotationVerticalLine,
|
@@ -5498,68 +5806,55 @@
|
|
5498
5806
|
Builder._advancedPipelineMap.scatter = scatterAdvancedPipeline;
|
5499
5807
|
Builder._specPipelineMap.scatter = scatterSpecPipeline;
|
5500
5808
|
};
|
5501
|
-
const
|
5502
|
-
const result = {
|
5503
|
-
...advancedVSeed
|
5504
|
-
};
|
5809
|
+
const buildMeasuresForDualAxis = (advancedVSeed, context)=>{
|
5505
5810
|
const { vseed } = context;
|
5506
|
-
|
5507
|
-
|
5508
|
-
|
5509
|
-
if (dualMeasures) {
|
5510
|
-
result.measures = dualMeasuresToMeasureTree(dualMeasures);
|
5511
|
-
return result;
|
5811
|
+
if (isMeasureTreeWithChildren(vseed)) {
|
5812
|
+
advancedVSeed.measures = vseed.measures;
|
5813
|
+
return advancedVSeed;
|
5512
5814
|
}
|
5513
|
-
if (
|
5514
|
-
|
5515
|
-
return
|
5815
|
+
if (isMeasureTreeWithParentId(vseed)) {
|
5816
|
+
advancedVSeed.measures = buildMeasuresForDualAxis_generateMeasuresByParentId(vseed.measures);
|
5817
|
+
return advancedVSeed;
|
5516
5818
|
}
|
5517
|
-
const
|
5518
|
-
const
|
5519
|
-
|
5520
|
-
|
5521
|
-
|
5522
|
-
|
5523
|
-
|
5524
|
-
|
5525
|
-
|
5526
|
-
]
|
5527
|
-
|
5528
|
-
|
5529
|
-
|
5530
|
-
|
5531
|
-
|
5532
|
-
|
5533
|
-
|
5534
|
-
|
5535
|
-
|
5536
|
-
|
5537
|
-
|
5538
|
-
else if (newMeasures.length > 1) result.measures = [
|
5539
|
-
{
|
5540
|
-
id: 'primary',
|
5541
|
-
alias: 'primary',
|
5542
|
-
children: newMeasures.slice(0, 1)
|
5543
|
-
},
|
5819
|
+
const basicMeasures = getBasicMeasures(vseed);
|
5820
|
+
const dualMeasures = vseed.dualMeasures ? vseed.dualMeasures : basicMeasuresToDualMeasures(basicMeasures);
|
5821
|
+
advancedVSeed.measures = dualMeasuresToMeasureTree(dualMeasures);
|
5822
|
+
return advancedVSeed;
|
5823
|
+
};
|
5824
|
+
const basicMeasuresToDualMeasures = (basicMeasures)=>{
|
5825
|
+
const primaryMeasures = [];
|
5826
|
+
const secondaryMeasures = [];
|
5827
|
+
for(let index = 0; index < basicMeasures.length; index++){
|
5828
|
+
const item = basicMeasures[index];
|
5829
|
+
const encoding = Array.isArray(item.encoding) ? item.encoding : [
|
5830
|
+
item.encoding
|
5831
|
+
];
|
5832
|
+
const isPrimaryYAxis = encoding.includes('primaryYAxis');
|
5833
|
+
const isSecondaryYAxis = encoding.includes('secondaryYAxis');
|
5834
|
+
if (isPrimaryYAxis) primaryMeasures.push(item);
|
5835
|
+
else if (isSecondaryYAxis) secondaryMeasures.push(item);
|
5836
|
+
else if (0 === index) primaryMeasures.push(item);
|
5837
|
+
else secondaryMeasures.push(item);
|
5838
|
+
}
|
5839
|
+
return [
|
5544
5840
|
{
|
5545
|
-
id: '
|
5546
|
-
|
5547
|
-
|
5841
|
+
id: 'dualMeasures',
|
5842
|
+
primaryMeasures,
|
5843
|
+
secondaryMeasures
|
5548
5844
|
}
|
5549
5845
|
];
|
5550
|
-
return result;
|
5551
5846
|
};
|
5552
5847
|
const dualMeasuresToMeasureTree = (dualMeasures)=>{
|
5553
5848
|
const measureTree = dualMeasures.map((item, index)=>{
|
5554
|
-
const { primaryMeasures, secondaryMeasures } = item;
|
5849
|
+
const { id, primaryMeasures, secondaryMeasures } = item;
|
5555
5850
|
const groupChildren = [];
|
5556
|
-
let
|
5851
|
+
let groupId = `${id}-`;
|
5557
5852
|
if (primaryMeasures) {
|
5558
5853
|
const arrPrimaryMeasures = Array.isArray(primaryMeasures) ? primaryMeasures : [
|
5559
5854
|
primaryMeasures
|
5560
5855
|
];
|
5561
5856
|
const alias = arrPrimaryMeasures.map((item)=>item.alias || item.id).toString();
|
5562
|
-
|
5857
|
+
groupId += alias;
|
5563
5858
|
groupChildren.push({
|
5564
5859
|
id: `${index}-primary`,
|
5565
5860
|
alias: arrPrimaryMeasures.map((item)=>item.alias || item.id).toString(),
|
@@ -5571,7 +5866,7 @@
|
|
5571
5866
|
secondaryMeasures
|
5572
5867
|
];
|
5573
5868
|
const alias = arrSecondaryMeasures.map((item)=>item.alias || item.id).toString();
|
5574
|
-
|
5869
|
+
groupId += alias;
|
5575
5870
|
groupChildren.push({
|
5576
5871
|
id: `${index}-secondary`,
|
5577
5872
|
alias: arrSecondaryMeasures.map((item)=>item.alias || item.id).toString(),
|
@@ -5579,14 +5874,37 @@
|
|
5579
5874
|
});
|
5580
5875
|
}
|
5581
5876
|
return {
|
5582
|
-
id,
|
5583
|
-
alias:
|
5877
|
+
id: groupId,
|
5878
|
+
alias: groupId,
|
5584
5879
|
children: groupChildren
|
5585
5880
|
};
|
5586
5881
|
});
|
5587
5882
|
if (1 === dualMeasures.length) return measureTree[0].children || [];
|
5588
5883
|
return measureTree;
|
5589
5884
|
};
|
5885
|
+
const buildMeasuresForDualAxis_generateMeasuresByParentId = (measures)=>{
|
5886
|
+
const dualMeasures = [];
|
5887
|
+
measures.forEach((item)=>{
|
5888
|
+
if (!item.parentId) return;
|
5889
|
+
if (!dualMeasures.find((d)=>d.id === item.parentId)) dualMeasures.push({
|
5890
|
+
id: item.parentId,
|
5891
|
+
primaryMeasures: [],
|
5892
|
+
secondaryMeasures: []
|
5893
|
+
});
|
5894
|
+
const dualChart = dualMeasures.find((d)=>d.id === item.parentId);
|
5895
|
+
if (!dualChart || !Array.isArray(dualChart.primaryMeasures) || !Array.isArray(dualChart.secondaryMeasures)) return;
|
5896
|
+
const encoding = Array.isArray(item.encoding) ? item.encoding : [
|
5897
|
+
item.encoding
|
5898
|
+
];
|
5899
|
+
const isPrimary = encoding.includes('primaryYAxis');
|
5900
|
+
const isSecondary = encoding.includes('secondaryYAxis');
|
5901
|
+
if (isPrimary) dualChart.primaryMeasures.push(item);
|
5902
|
+
else if (isSecondary) dualChart.secondaryMeasures.push(item);
|
5903
|
+
else if (!isPrimary && !isSecondary) if (0 === dualChart.primaryMeasures.length) dualChart.primaryMeasures.push(item);
|
5904
|
+
else dualChart.secondaryMeasures.push(item);
|
5905
|
+
});
|
5906
|
+
return dualMeasuresToMeasureTree(dualMeasures);
|
5907
|
+
};
|
5590
5908
|
const encodingForDualAxis = (advancedVSeed, context)=>{
|
5591
5909
|
const { vseed } = context;
|
5592
5910
|
const { dimensions } = advancedVSeed;
|
@@ -5600,10 +5918,10 @@
|
|
5600
5918
|
(dimensions[1] || dimensions[0]).id
|
5601
5919
|
];
|
5602
5920
|
const detail = encoding.detail || [];
|
5603
|
-
const mergedDetail = chunk_QJLMYOTX_i([
|
5921
|
+
const mergedDetail = 0 === detail.length ? chunk_QJLMYOTX_i([
|
5604
5922
|
...color,
|
5605
5923
|
...detail
|
5606
|
-
]);
|
5924
|
+
]) : detail;
|
5607
5925
|
return {
|
5608
5926
|
...advancedVSeed,
|
5609
5927
|
encoding: {
|
@@ -5645,7 +5963,8 @@
|
|
5645
5963
|
const secondaryMeasures = measures[1] || [];
|
5646
5964
|
if (primaryMeasures && primaryMeasures.children) {
|
5647
5965
|
const { dataset: newDataset, foldInfo, unfoldInfo } = dataReshapeByEncoding(dataset, dimensions, primaryMeasures.children, encoding, {
|
5648
|
-
foldMeasureValue: FoldPrimaryMeasureValue
|
5966
|
+
foldMeasureValue: FoldPrimaryMeasureValue,
|
5967
|
+
colorMeasureId: getColorMeasureId(advancedVSeed)
|
5649
5968
|
});
|
5650
5969
|
datasets.push(newDataset);
|
5651
5970
|
foldInfoList.push(foldInfo);
|
@@ -5653,7 +5972,8 @@
|
|
5653
5972
|
}
|
5654
5973
|
if (secondaryMeasures && secondaryMeasures.children) {
|
5655
5974
|
const { dataset: newDataset, foldInfo, unfoldInfo } = dataReshapeByEncoding(dataset, dimensions, secondaryMeasures.children, encoding, {
|
5656
|
-
foldMeasureValue: FoldSecondaryMeasureValue
|
5975
|
+
foldMeasureValue: FoldSecondaryMeasureValue,
|
5976
|
+
colorMeasureId: getColorMeasureId(advancedVSeed)
|
5657
5977
|
});
|
5658
5978
|
datasets.push(newDataset);
|
5659
5979
|
foldInfoList.push(foldInfo);
|
@@ -5707,7 +6027,8 @@
|
|
5707
6027
|
const secondaryMeasures = measures[1] || [];
|
5708
6028
|
if (primaryMeasures && primaryMeasures.children) {
|
5709
6029
|
const { dataset: newDataset, foldInfo, unfoldInfo } = dataReshapeByEncoding(dataset, dimensions, primaryMeasures.children, encoding, {
|
5710
|
-
foldMeasureValue: `${FoldPrimaryMeasureValue}${index}
|
6030
|
+
foldMeasureValue: `${FoldPrimaryMeasureValue}${index}`,
|
6031
|
+
colorMeasureId: getColorMeasureId(advancedVSeed)
|
5711
6032
|
});
|
5712
6033
|
datasets.push(newDataset);
|
5713
6034
|
foldInfoList.push(foldInfo);
|
@@ -5715,7 +6036,8 @@
|
|
5715
6036
|
}
|
5716
6037
|
if (secondaryMeasures && secondaryMeasures.children) {
|
5717
6038
|
const { dataset: newDataset, foldInfo, unfoldInfo } = dataReshapeByEncoding(dataset, dimensions, secondaryMeasures.children, encoding, {
|
5718
|
-
foldMeasureValue: `${FoldSecondaryMeasureValue}${index}
|
6039
|
+
foldMeasureValue: `${FoldSecondaryMeasureValue}${index}`,
|
6040
|
+
colorMeasureId: getColorMeasureId(advancedVSeed)
|
5719
6041
|
});
|
5720
6042
|
datasets.push(newDataset);
|
5721
6043
|
foldInfoList.push(foldInfo);
|
@@ -5773,7 +6095,7 @@
|
|
5773
6095
|
};
|
5774
6096
|
const dualAxisAdvancedPipeline = [
|
5775
6097
|
initAdvancedVSeed_initAdvancedVSeed,
|
5776
|
-
|
6098
|
+
buildMeasuresForDualAxis,
|
5777
6099
|
autoDimensions_autoDimensions,
|
5778
6100
|
encodingForDualAxis,
|
5779
6101
|
pivotAdapter([
|
@@ -5860,7 +6182,7 @@
|
|
5860
6182
|
result.direction = 'vertical';
|
5861
6183
|
result.xField = unfoldInfo.encodingX;
|
5862
6184
|
if (foldInfoList?.[1]) result.yField = foldInfoList[1].measureValue;
|
5863
|
-
result.seriesField = unfoldInfo.encodingColorId;
|
6185
|
+
result.seriesField = isLinearColor(advancedVSeed) ? unfoldInfo.encodingDetail : unfoldInfo.encodingColorId;
|
5864
6186
|
result.animation = true;
|
5865
6187
|
return result;
|
5866
6188
|
};
|
@@ -6486,6 +6808,37 @@
|
|
6486
6808
|
];
|
6487
6809
|
return result;
|
6488
6810
|
};
|
6811
|
+
const linearColorForDualAxis = (spec, context)=>{
|
6812
|
+
const result = {
|
6813
|
+
...spec
|
6814
|
+
};
|
6815
|
+
const { advancedVSeed } = context;
|
6816
|
+
const { datasetReshapeInfo, chartType } = advancedVSeed;
|
6817
|
+
const { unfoldInfo, id } = datasetReshapeInfo[0];
|
6818
|
+
const baseConfig = advancedVSeed.config[chartType];
|
6819
|
+
if (!baseConfig || !baseConfig.color) return result;
|
6820
|
+
const { color } = baseConfig;
|
6821
|
+
const { colorScheme, linearColorScheme } = color;
|
6822
|
+
result.color = {
|
6823
|
+
type: 'linear',
|
6824
|
+
range: linearColorScheme || colorScheme || [],
|
6825
|
+
domain: [
|
6826
|
+
{
|
6827
|
+
dataId: `${id}-primary-dataset`,
|
6828
|
+
fields: [
|
6829
|
+
unfoldInfo.encodingColor
|
6830
|
+
]
|
6831
|
+
},
|
6832
|
+
{
|
6833
|
+
dataId: `${id}-secondary-dataset`,
|
6834
|
+
fields: [
|
6835
|
+
unfoldInfo.encodingColor
|
6836
|
+
]
|
6837
|
+
}
|
6838
|
+
]
|
6839
|
+
};
|
6840
|
+
return result;
|
6841
|
+
};
|
6489
6842
|
const dualAxis = [
|
6490
6843
|
seriesDualAxis([
|
6491
6844
|
initDualAxisPrimary,
|
@@ -6494,11 +6847,11 @@
|
|
6494
6847
|
labelPrimary,
|
6495
6848
|
tooltipPrimary,
|
6496
6849
|
progressive,
|
6497
|
-
barStyle_barStyle,
|
6498
|
-
pointStyle_pointStyle,
|
6850
|
+
colorBarStyleFill(barStyle_barStyle),
|
6851
|
+
colorPointStyleFill(pointStyle_pointStyle),
|
6499
6852
|
pointStateDimensionHover,
|
6500
|
-
lineStyle_lineStyle,
|
6501
|
-
areaStyle_areaStyle
|
6853
|
+
colorLineStyleFill(lineStyle_lineStyle),
|
6854
|
+
colorAreaStyleFill(areaStyle_areaStyle)
|
6502
6855
|
], [
|
6503
6856
|
initDualAxisSecondary,
|
6504
6857
|
dualChartTypeSecondary,
|
@@ -6506,18 +6859,18 @@
|
|
6506
6859
|
labelSecondary,
|
6507
6860
|
tooltipSecondary,
|
6508
6861
|
progressive,
|
6509
|
-
barStyle_barStyle,
|
6510
|
-
pointStyle_pointStyle,
|
6862
|
+
colorBarStyleFill(barStyle_barStyle),
|
6863
|
+
colorPointStyleFill(pointStyle_pointStyle),
|
6511
6864
|
pointStateDimensionHover,
|
6512
|
-
lineStyle_lineStyle,
|
6513
|
-
areaStyle_areaStyle
|
6865
|
+
colorLineStyleFill(lineStyle_lineStyle),
|
6866
|
+
colorAreaStyleFill(areaStyle_areaStyle)
|
6514
6867
|
]),
|
6515
6868
|
xBand,
|
6516
6869
|
yLinearPrimary,
|
6517
6870
|
yLinearSecondary,
|
6518
|
-
color_color,
|
6871
|
+
colorAdapter(color_color, linearColorForDualAxis),
|
6872
|
+
colorAdapter(discreteLegend, colorLegend),
|
6519
6873
|
background_backgroundColor,
|
6520
|
-
discreteLegend,
|
6521
6874
|
verticalCrosshairRect,
|
6522
6875
|
annotationPoint_annotationPoint,
|
6523
6876
|
annotationVerticalLine_annotationVerticalLine,
|
@@ -6537,11 +6890,11 @@
|
|
6537
6890
|
labelPrimary,
|
6538
6891
|
tooltipPrimary,
|
6539
6892
|
progressive,
|
6540
|
-
barStyle_barStyle,
|
6541
|
-
pointStyle_pointStyle,
|
6893
|
+
colorBarStyleFill(barStyle_barStyle),
|
6894
|
+
colorPointStyleFill(pointStyle_pointStyle),
|
6542
6895
|
pointStateDimensionHover,
|
6543
|
-
lineStyle_lineStyle,
|
6544
|
-
areaStyle_areaStyle
|
6896
|
+
colorLineStyleFill(lineStyle_lineStyle),
|
6897
|
+
colorAreaStyleFill(areaStyle_areaStyle)
|
6545
6898
|
], [
|
6546
6899
|
initDualAxisSecondary,
|
6547
6900
|
dualChartTypeSecondary,
|
@@ -6549,16 +6902,16 @@
|
|
6549
6902
|
labelSecondary,
|
6550
6903
|
tooltipSecondary,
|
6551
6904
|
progressive,
|
6552
|
-
barStyle_barStyle,
|
6553
|
-
pointStyle_pointStyle,
|
6905
|
+
colorBarStyleFill(barStyle_barStyle),
|
6906
|
+
colorPointStyleFill(pointStyle_pointStyle),
|
6554
6907
|
pointStateDimensionHover,
|
6555
|
-
lineStyle_lineStyle,
|
6556
|
-
areaStyle_areaStyle
|
6908
|
+
colorLineStyleFill(lineStyle_lineStyle),
|
6909
|
+
colorAreaStyleFill(areaStyle_areaStyle)
|
6557
6910
|
]),
|
6558
6911
|
xBand,
|
6559
6912
|
yLinearPrimary,
|
6560
6913
|
yLinearSecondary,
|
6561
|
-
color_color,
|
6914
|
+
colorAdapter(color_color, linearColor),
|
6562
6915
|
background_backgroundColor,
|
6563
6916
|
verticalCrosshairRect,
|
6564
6917
|
annotationPoint_annotationPoint,
|
@@ -6568,7 +6921,7 @@
|
|
6568
6921
|
]),
|
6569
6922
|
pivotRowDimensions,
|
6570
6923
|
pivotColumnDimensions,
|
6571
|
-
pivotDiscreteLegend
|
6924
|
+
colorAdapter(pivotDiscreteLegend, pivotColorLegend)
|
6572
6925
|
];
|
6573
6926
|
const dualAxisSpecPipeline = [
|
6574
6927
|
pivotAdapter_pivotAdapter(dualAxis, pivotDualAxis)
|
@@ -6603,7 +6956,7 @@
|
|
6603
6956
|
};
|
6604
6957
|
const pieAdvancedPipeline = [
|
6605
6958
|
initAdvancedVSeed_initAdvancedVSeed,
|
6606
|
-
|
6959
|
+
buildMeasures,
|
6607
6960
|
autoDimensions_autoDimensions,
|
6608
6961
|
encodingForPie,
|
6609
6962
|
pivotAdapter([
|
@@ -6694,7 +7047,7 @@
|
|
6694
7047
|
};
|
6695
7048
|
const donutAdvancedPipeline = [
|
6696
7049
|
initAdvancedVSeed_initAdvancedVSeed,
|
6697
|
-
|
7050
|
+
buildMeasures,
|
6698
7051
|
autoDimensions_autoDimensions,
|
6699
7052
|
encodingForPie,
|
6700
7053
|
pivotAdapter([
|
@@ -6795,10 +7148,10 @@
|
|
6795
7148
|
(dimensions[1] || dimensions[0]).id
|
6796
7149
|
];
|
6797
7150
|
const detail = encoding.detail || [];
|
6798
|
-
const mergedDetail = chunk_QJLMYOTX_i([
|
7151
|
+
const mergedDetail = 0 === detail.length ? chunk_QJLMYOTX_i([
|
6799
7152
|
...color,
|
6800
7153
|
...detail
|
6801
|
-
]);
|
7154
|
+
]) : detail;
|
6802
7155
|
return {
|
6803
7156
|
...advancedVSeed,
|
6804
7157
|
encoding: {
|
@@ -6826,7 +7179,7 @@
|
|
6826
7179
|
};
|
6827
7180
|
const roseAdvancedPipeline = [
|
6828
7181
|
initAdvancedVSeed_initAdvancedVSeed,
|
6829
|
-
|
7182
|
+
buildMeasures,
|
6830
7183
|
autoDimensions_autoDimensions,
|
6831
7184
|
encodingForRose,
|
6832
7185
|
pivotAdapter([
|
@@ -6995,7 +7348,7 @@
|
|
6995
7348
|
};
|
6996
7349
|
const roseParallelAdvancedPipeline = [
|
6997
7350
|
initAdvancedVSeed_initAdvancedVSeed,
|
6998
|
-
|
7351
|
+
buildMeasures,
|
6999
7352
|
autoDimensions_autoDimensions,
|
7000
7353
|
encodingForRose,
|
7001
7354
|
pivotAdapter([
|
@@ -7114,10 +7467,10 @@
|
|
7114
7467
|
(dimensions[1] || dimensions[0]).id
|
7115
7468
|
];
|
7116
7469
|
const detail = encoding.detail || [];
|
7117
|
-
const mergedDetail = chunk_QJLMYOTX_i([
|
7470
|
+
const mergedDetail = 0 === detail.length ? chunk_QJLMYOTX_i([
|
7118
7471
|
...color,
|
7119
7472
|
...detail
|
7120
|
-
]);
|
7473
|
+
]) : detail;
|
7121
7474
|
return {
|
7122
7475
|
...advancedVSeed,
|
7123
7476
|
encoding: {
|
@@ -7144,7 +7497,7 @@
|
|
7144
7497
|
};
|
7145
7498
|
const radarAdvancedPipeline = [
|
7146
7499
|
initAdvancedVSeed_initAdvancedVSeed,
|
7147
|
-
|
7500
|
+
buildMeasures,
|
7148
7501
|
autoDimensions_autoDimensions,
|
7149
7502
|
encodingForRadar,
|
7150
7503
|
pivotAdapter([
|
@@ -7168,7 +7521,7 @@
|
|
7168
7521
|
result.type = 'radar';
|
7169
7522
|
result.angleField = unfoldInfo.encodingAngle;
|
7170
7523
|
result.radiusField = foldInfo.measureValue;
|
7171
|
-
result.seriesField = unfoldInfo.encodingColorId;
|
7524
|
+
result.seriesField = isLinearColor(advancedVSeed) ? unfoldInfo.encodingDetail : unfoldInfo.encodingColorId;
|
7172
7525
|
result.padding = 0;
|
7173
7526
|
result.region = [
|
7174
7527
|
{
|
@@ -7233,7 +7586,7 @@
|
|
7233
7586
|
};
|
7234
7587
|
const radar = [
|
7235
7588
|
initRadar,
|
7236
|
-
color_color,
|
7589
|
+
colorAdapter(color_color, linearColor),
|
7237
7590
|
background_backgroundColor,
|
7238
7591
|
datasetXY,
|
7239
7592
|
progressive,
|
@@ -7241,12 +7594,12 @@
|
|
7241
7594
|
radarRadiusAxis,
|
7242
7595
|
label_label,
|
7243
7596
|
tooltip_tooltip,
|
7597
|
+
colorAdapter(discreteLegend, colorLegend),
|
7244
7598
|
verticalCrosshairLine,
|
7245
|
-
|
7246
|
-
pointStyle_pointStyle,
|
7599
|
+
colorPointStyleFill(pointStyle_pointStyle),
|
7247
7600
|
pointStateDimensionHover,
|
7248
|
-
lineStyle_lineStyle,
|
7249
|
-
areaStyle_areaStyle
|
7601
|
+
colorLineStyleFill(lineStyle_lineStyle),
|
7602
|
+
colorAreaStyleFill(areaStyle_areaStyle)
|
7250
7603
|
];
|
7251
7604
|
const pivotRadar = [
|
7252
7605
|
initPivot,
|
@@ -7255,7 +7608,7 @@
|
|
7255
7608
|
datasetPivot,
|
7256
7609
|
pivotIndicators_pivotIndicators([
|
7257
7610
|
initRadar,
|
7258
|
-
color_color,
|
7611
|
+
colorAdapter(color_color, linearColor),
|
7259
7612
|
background_backgroundColor,
|
7260
7613
|
datasetXY,
|
7261
7614
|
progressive,
|
@@ -7264,14 +7617,14 @@
|
|
7264
7617
|
label_label,
|
7265
7618
|
tooltip_tooltip,
|
7266
7619
|
verticalCrosshairLine,
|
7267
|
-
pointStyle_pointStyle,
|
7620
|
+
colorPointStyleFill(pointStyle_pointStyle),
|
7268
7621
|
pointStateDimensionHover,
|
7269
|
-
lineStyle_lineStyle,
|
7270
|
-
areaStyle_areaStyle
|
7622
|
+
colorLineStyleFill(lineStyle_lineStyle),
|
7623
|
+
colorAreaStyleFill(areaStyle_areaStyle)
|
7271
7624
|
]),
|
7272
7625
|
pivotRowDimensions,
|
7273
7626
|
pivotColumnDimensions,
|
7274
|
-
pivotDiscreteLegend
|
7627
|
+
colorAdapter(pivotDiscreteLegend, pivotColorLegend)
|
7275
7628
|
];
|
7276
7629
|
const radarSpecPipeline = [
|
7277
7630
|
pivotAdapter_pivotAdapter(radar, pivotRadar)
|
@@ -7306,7 +7659,7 @@
|
|
7306
7659
|
};
|
7307
7660
|
const funnelAdvancedPipeline = [
|
7308
7661
|
initAdvancedVSeed_initAdvancedVSeed,
|
7309
|
-
|
7662
|
+
buildMeasures,
|
7310
7663
|
autoDimensions_autoDimensions,
|
7311
7664
|
encodingForFunnel,
|
7312
7665
|
pivotAdapter([
|
@@ -7437,7 +7790,7 @@
|
|
7437
7790
|
};
|
7438
7791
|
const heatmapAdvancedPipeline = [
|
7439
7792
|
initAdvancedVSeed_initAdvancedVSeed,
|
7440
|
-
|
7793
|
+
buildMeasures,
|
7441
7794
|
autoDimensions_autoDimensions,
|
7442
7795
|
encodingForHeatmap,
|
7443
7796
|
pivotAdapter([
|
@@ -7659,6 +8012,10 @@
|
|
7659
8012
|
const baseConfig = {
|
7660
8013
|
backgroundColor: 'transparent',
|
7661
8014
|
color: {
|
8015
|
+
linearColorScheme: [
|
8016
|
+
'#C2CEFF',
|
8017
|
+
'#5766EC'
|
8018
|
+
],
|
7662
8019
|
colorScheme: [
|
7663
8020
|
'#8D72F6',
|
7664
8021
|
'#5766EC',
|
@@ -7723,8 +8080,8 @@
|
|
7723
8080
|
stackCornerRadius: [
|
7724
8081
|
4,
|
7725
8082
|
4,
|
7726
|
-
|
7727
|
-
|
8083
|
+
0,
|
8084
|
+
0
|
7728
8085
|
]
|
7729
8086
|
},
|
7730
8087
|
columnParallel: {
|
@@ -7735,8 +8092,8 @@
|
|
7735
8092
|
stackCornerRadius: [
|
7736
8093
|
4,
|
7737
8094
|
4,
|
7738
|
-
|
7739
|
-
|
8095
|
+
0,
|
8096
|
+
0
|
7740
8097
|
]
|
7741
8098
|
},
|
7742
8099
|
columnPercent: {
|
@@ -7747,8 +8104,8 @@
|
|
7747
8104
|
stackCornerRadius: [
|
7748
8105
|
4,
|
7749
8106
|
4,
|
7750
|
-
|
7751
|
-
|
8107
|
+
0,
|
8108
|
+
0
|
7752
8109
|
]
|
7753
8110
|
},
|
7754
8111
|
bar: {
|
@@ -7757,10 +8114,10 @@
|
|
7757
8114
|
yAxis: barBandAxis,
|
7758
8115
|
crosshairRect,
|
7759
8116
|
stackCornerRadius: [
|
8117
|
+
0,
|
7760
8118
|
4,
|
7761
8119
|
4,
|
7762
|
-
|
7763
|
-
4
|
8120
|
+
0
|
7764
8121
|
]
|
7765
8122
|
},
|
7766
8123
|
barParallel: {
|
@@ -7769,10 +8126,10 @@
|
|
7769
8126
|
yAxis: barBandAxis,
|
7770
8127
|
crosshairRect,
|
7771
8128
|
stackCornerRadius: [
|
8129
|
+
0,
|
7772
8130
|
4,
|
7773
8131
|
4,
|
7774
|
-
|
7775
|
-
4
|
8132
|
+
0
|
7776
8133
|
]
|
7777
8134
|
},
|
7778
8135
|
barPercent: {
|
@@ -7781,10 +8138,10 @@
|
|
7781
8138
|
yAxis: barBandAxis,
|
7782
8139
|
crosshairRect,
|
7783
8140
|
stackCornerRadius: [
|
8141
|
+
0,
|
7784
8142
|
4,
|
7785
8143
|
4,
|
7786
|
-
|
7787
|
-
4
|
8144
|
+
0
|
7788
8145
|
]
|
7789
8146
|
},
|
7790
8147
|
area: {
|
@@ -7849,38 +8206,10 @@
|
|
7849
8206
|
...baseConfig
|
7850
8207
|
},
|
7851
8208
|
funnel: {
|
7852
|
-
...baseConfig
|
7853
|
-
color: {
|
7854
|
-
colorScheme: [
|
7855
|
-
'#5766EC',
|
7856
|
-
'#6372F0',
|
7857
|
-
'#7080F4',
|
7858
|
-
'#7C8CFA',
|
7859
|
-
'#8998FF',
|
7860
|
-
'#95A3FF',
|
7861
|
-
'#A0AEFF',
|
7862
|
-
'#ACB9FF',
|
7863
|
-
'#B7C4FF',
|
7864
|
-
'#C2CEFF'
|
7865
|
-
].reverse()
|
7866
|
-
}
|
8209
|
+
...baseConfig
|
7867
8210
|
},
|
7868
8211
|
heatmap: {
|
7869
|
-
...baseConfig
|
7870
|
-
color: {
|
7871
|
-
colorScheme: [
|
7872
|
-
'#5766EC',
|
7873
|
-
'#6372F0',
|
7874
|
-
'#7080F4',
|
7875
|
-
'#7C8CFA',
|
7876
|
-
'#8998FF',
|
7877
|
-
'#95A3FF',
|
7878
|
-
'#A0AEFF',
|
7879
|
-
'#ACB9FF',
|
7880
|
-
'#B7C4FF',
|
7881
|
-
'#C2CEFF'
|
7882
|
-
].reverse()
|
7883
|
-
}
|
8212
|
+
...baseConfig
|
7884
8213
|
}
|
7885
8214
|
}
|
7886
8215
|
};
|
@@ -7992,6 +8321,10 @@
|
|
7992
8321
|
const baseConfig = {
|
7993
8322
|
backgroundColor: 'transparent',
|
7994
8323
|
color: {
|
8324
|
+
linearColorScheme: [
|
8325
|
+
'#A0CEFF',
|
8326
|
+
'#2E62F1'
|
8327
|
+
],
|
7995
8328
|
colorScheme: [
|
7996
8329
|
'#2E62F1',
|
7997
8330
|
'#4DC36A',
|
@@ -8055,8 +8388,8 @@
|
|
8055
8388
|
stackCornerRadius: [
|
8056
8389
|
4,
|
8057
8390
|
4,
|
8058
|
-
|
8059
|
-
|
8391
|
+
0,
|
8392
|
+
0
|
8060
8393
|
]
|
8061
8394
|
},
|
8062
8395
|
columnParallel: {
|
@@ -8067,8 +8400,8 @@
|
|
8067
8400
|
stackCornerRadius: [
|
8068
8401
|
4,
|
8069
8402
|
4,
|
8070
|
-
|
8071
|
-
|
8403
|
+
0,
|
8404
|
+
0
|
8072
8405
|
]
|
8073
8406
|
},
|
8074
8407
|
columnPercent: {
|
@@ -8079,8 +8412,8 @@
|
|
8079
8412
|
stackCornerRadius: [
|
8080
8413
|
4,
|
8081
8414
|
4,
|
8082
|
-
|
8083
|
-
|
8415
|
+
0,
|
8416
|
+
0
|
8084
8417
|
]
|
8085
8418
|
},
|
8086
8419
|
bar: {
|
@@ -8101,10 +8434,10 @@
|
|
8101
8434
|
yAxis: barBandAxis,
|
8102
8435
|
crosshairRect: crosshairRect,
|
8103
8436
|
stackCornerRadius: [
|
8437
|
+
0,
|
8104
8438
|
4,
|
8105
8439
|
4,
|
8106
|
-
|
8107
|
-
4
|
8440
|
+
0
|
8108
8441
|
]
|
8109
8442
|
},
|
8110
8443
|
barPercent: {
|
@@ -8113,10 +8446,10 @@
|
|
8113
8446
|
yAxis: barBandAxis,
|
8114
8447
|
crosshairRect: crosshairRect,
|
8115
8448
|
stackCornerRadius: [
|
8449
|
+
0,
|
8116
8450
|
4,
|
8117
8451
|
4,
|
8118
|
-
|
8119
|
-
4
|
8452
|
+
0
|
8120
8453
|
]
|
8121
8454
|
},
|
8122
8455
|
area: {
|
@@ -8181,21 +8514,7 @@
|
|
8181
8514
|
...baseConfig
|
8182
8515
|
},
|
8183
8516
|
funnel: {
|
8184
|
-
...baseConfig
|
8185
|
-
color: {
|
8186
|
-
colorScheme: [
|
8187
|
-
'#2E62F1',
|
8188
|
-
'#3A6EF6',
|
8189
|
-
'#4780FA',
|
8190
|
-
'#548CFE',
|
8191
|
-
'#6198FF',
|
8192
|
-
'#6FA3FF',
|
8193
|
-
'#7CACFF',
|
8194
|
-
'#88B7FF',
|
8195
|
-
'#94C2FF',
|
8196
|
-
'#A0CEFF'
|
8197
|
-
]
|
8198
|
-
}
|
8517
|
+
...baseConfig
|
8199
8518
|
},
|
8200
8519
|
heatmap: {
|
8201
8520
|
...baseConfig
|
@@ -8246,9 +8565,6 @@
|
|
8246
8565
|
const updateSpec = (chartType, specPipe)=>{
|
8247
8566
|
Builder._customSpecPipe[chartType] = specPipe;
|
8248
8567
|
};
|
8249
|
-
const isDimension = (dimension)=>!('children' in dimension);
|
8250
|
-
const isDimensionGroup = (dimension)=>'children' in dimension;
|
8251
|
-
const isDimensions = (dimensions)=>dimensions.every(isDimension);
|
8252
8568
|
Object.freeze({
|
8253
8569
|
status: "aborted"
|
8254
8570
|
});
|
@@ -11624,7 +11940,20 @@
|
|
11624
11940
|
id: schemas_string(),
|
11625
11941
|
alias: schemas_string().optional(),
|
11626
11942
|
autoFormat: schemas_boolean().default(true),
|
11627
|
-
format: zNumFormat["default"]({})
|
11943
|
+
format: zNumFormat["default"]({}),
|
11944
|
+
encoding: schemas_enum([
|
11945
|
+
'primaryYAxis',
|
11946
|
+
'secondaryYAxis',
|
11947
|
+
'xAxis',
|
11948
|
+
'yAxis',
|
11949
|
+
'angle',
|
11950
|
+
'radius',
|
11951
|
+
'size',
|
11952
|
+
'color',
|
11953
|
+
'label',
|
11954
|
+
'tooltip'
|
11955
|
+
]).optional(),
|
11956
|
+
parentId: schemas_string().optional()
|
11628
11957
|
});
|
11629
11958
|
const zMeasureGroup = schemas_object({
|
11630
11959
|
id: schemas_string(),
|
@@ -11649,6 +11978,8 @@
|
|
11649
11978
|
const zScatterMeasures = schemas_array(zScatterMeasure);
|
11650
11979
|
const zFoldInfo = schemas_object({
|
11651
11980
|
foldMap: record(schemas_string(), schemas_string().or(schemas_undefined())),
|
11981
|
+
colorRange: schemas_array(schemas_number()),
|
11982
|
+
measureRange: schemas_array(schemas_number()),
|
11652
11983
|
measureId: schemas_string(),
|
11653
11984
|
measureName: schemas_string(),
|
11654
11985
|
measureValue: schemas_string()
|
@@ -11684,7 +12015,6 @@
|
|
11684
12015
|
column: schemas_array(schemas_string()).nullish(),
|
11685
12016
|
group: schemas_array(schemas_string()).nullish().describe("\u5DF2\u5F03\u7528, \u8BF7\u4F7F\u7528\u989C\u8272\u66FF\u4EE3")
|
11686
12017
|
});
|
11687
|
-
const zEncodings = schemas_array(zEncoding);
|
11688
12018
|
const zXBandAxis = schemas_object({
|
11689
12019
|
visible: schemas_boolean().default(true).nullish(),
|
11690
12020
|
labelAutoHide: schemas_boolean().default(true).nullish(),
|
@@ -11793,10 +12123,11 @@
|
|
11793
12123
|
const zBackgroundColor = schemas_string().default('transparent').nullish();
|
11794
12124
|
const zColor = schemas_object({
|
11795
12125
|
colorScheme: schemas_array(schemas_string()).nullish(),
|
12126
|
+
linearColorScheme: schemas_array(schemas_string()).nullish(),
|
11796
12127
|
colorMapping: record(schemas_string(), schemas_string()).nullish()
|
11797
12128
|
});
|
11798
12129
|
const zLinearColor = schemas_object({
|
11799
|
-
|
12130
|
+
linearColorScheme: schemas_array(schemas_string()).nullish()
|
11800
12131
|
});
|
11801
12132
|
const zLabel = schemas_object({
|
11802
12133
|
enable: schemas_boolean().default(true).nullish()
|
@@ -12777,7 +13108,7 @@
|
|
12777
13108
|
dimensions: zDimensions.nullish(),
|
12778
13109
|
measures: zMeasureTree.nullish(),
|
12779
13110
|
backgroundColor: zBackgroundColor.nullish(),
|
12780
|
-
color:
|
13111
|
+
color: zColor.nullish(),
|
12781
13112
|
label: zLabel.nullish(),
|
12782
13113
|
legend: zColorLegend.nullish(),
|
12783
13114
|
tooltip: zTooltip.nullish(),
|
@@ -12790,7 +13121,7 @@
|
|
12790
13121
|
dimensions: zDimensions.nullish(),
|
12791
13122
|
measures: zMeasureTree.nullish(),
|
12792
13123
|
backgroundColor: zBackgroundColor.nullish(),
|
12793
|
-
color:
|
13124
|
+
color: zColor.nullish(),
|
12794
13125
|
label: zLabel.nullish(),
|
12795
13126
|
legend: zColorLegend.nullish(),
|
12796
13127
|
tooltip: zTooltip.nullish(),
|
@@ -12826,7 +13157,6 @@
|
|
12826
13157
|
dimensions: zDimensionTree,
|
12827
13158
|
measures: zMeasureTree,
|
12828
13159
|
encoding: zEncoding,
|
12829
|
-
encodings: zEncodings,
|
12830
13160
|
config: zConfig,
|
12831
13161
|
analysis: zAnalysis,
|
12832
13162
|
theme: zTheme,
|