@visactor/vseed 0.0.22 → 0.0.23
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 +939 -65
- package/dist/builder/register/chartType.d.ts +1 -0
- package/dist/builder/register/custom.d.ts +3 -0
- package/dist/builder/register/index.d.ts +1 -0
- package/dist/dataReshape/dataReshapeFor1D.d.ts +19 -0
- package/dist/dataReshape/index.d.ts +1 -0
- package/dist/index.cjs +500 -14
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +470 -8
- package/dist/index.js.map +1 -1
- package/dist/pipeline/advanced/chart/pipeline/areaRange.d.ts +2 -0
- package/dist/pipeline/advanced/chart/pipeline/index.d.ts +1 -0
- package/dist/pipeline/advanced/chart/pipes/encoding/encodingXYY.d.ts +2 -0
- package/dist/pipeline/advanced/chart/pipes/encoding/index.d.ts +1 -0
- package/dist/pipeline/advanced/chart/pipes/init/autoMeasuresBy2M1Group.d.ts +8 -0
- package/dist/pipeline/advanced/chart/pipes/init/index.d.ts +1 -0
- package/dist/pipeline/advanced/chart/pipes/reshape/index.d.ts +2 -0
- package/dist/pipeline/advanced/chart/pipes/reshape/pivotReshapeTo1D.d.ts +8 -0
- package/dist/pipeline/advanced/chart/pipes/reshape/reshapeTo1D.d.ts +8 -0
- package/dist/pipeline/spec/chart/pipeline/areaRange.d.ts +1 -0
- package/dist/pipeline/spec/chart/pipeline/index.d.ts +1 -0
- package/dist/pipeline/spec/chart/pipes/index.d.ts +1 -0
- package/dist/pipeline/spec/chart/pipes/init/areaRange.d.ts +4 -0
- package/dist/pipeline/spec/chart/pipes/init/index.d.ts +1 -0
- package/dist/pipeline/spec/chart/pipes/series/index.d.ts +1 -0
- package/dist/pipeline/spec/chart/pipes/series/series.d.ts +2 -0
- package/dist/types/advancedVSeed.d.ts +307 -0
- package/dist/types/chartType/areaRange/areaRange.d.ts +1337 -0
- package/dist/types/chartType/areaRange/index.d.ts +1 -0
- package/dist/types/chartType/index.d.ts +1 -0
- package/dist/types/properties/chartType/chartType.d.ts +3 -1
- package/dist/types/properties/config/config.d.ts +307 -0
- package/dist/types/properties/theme/customTheme.d.ts +306 -0
- package/dist/types/vseed.d.ts +1190 -1
- package/dist/umd/index.js +484 -14
- package/dist/umd/index.js.map +1 -1
- package/package.json +1 -1
package/dist/umd/index.js
CHANGED
@@ -41,6 +41,7 @@
|
|
41
41
|
zRoseConfig: ()=>zRoseConfig,
|
42
42
|
findFirstMeasure: ()=>findFirstMeasure,
|
43
43
|
scatterAdvancedPipeline: ()=>scatterAdvancedPipeline,
|
44
|
+
updateSpec: ()=>updateSpec,
|
44
45
|
zCrosshairRect: ()=>zCrosshairRect,
|
45
46
|
scatterSpecPipeline: ()=>scatterSpecPipeline,
|
46
47
|
intl: ()=>intl,
|
@@ -75,6 +76,7 @@
|
|
75
76
|
barPercentAdvancedPipeline: ()=>barPercentAdvancedPipeline,
|
76
77
|
findAllDimensions: ()=>findAllDimensions,
|
77
78
|
findDimensionById: ()=>findDimensionById,
|
79
|
+
zAreaRangeConfig: ()=>zAreaRangeConfig,
|
78
80
|
zPivotTableConfig: ()=>zPivotTableConfig,
|
79
81
|
zArea: ()=>zArea,
|
80
82
|
zColumnParallel: ()=>zColumnParallel,
|
@@ -91,22 +93,22 @@
|
|
91
93
|
zCustomThemeConfig: ()=>zCustomThemeConfig,
|
92
94
|
registerColumnPercent: ()=>registerColumnPercent,
|
93
95
|
zCrosshairLine: ()=>zCrosshairLine,
|
94
|
-
|
96
|
+
registerAreaRange: ()=>registerAreaRange,
|
95
97
|
roseSpecPipeline: ()=>roseSpecPipeline,
|
98
|
+
registerBarPercent: ()=>registerBarPercent,
|
96
99
|
zPivotTable: ()=>zPivotTable,
|
97
|
-
zSortAxis: ()=>zSortAxis,
|
98
100
|
registerLightTheme: ()=>registerLightTheme,
|
99
101
|
roseAdvancedPipeline: ()=>roseAdvancedPipeline,
|
100
102
|
zBarParallel: ()=>zBarParallel,
|
101
103
|
zAnnotationVerticalLine: ()=>zAnnotationVerticalLine,
|
102
|
-
zChartType: ()=>zChartType,
|
103
|
-
tableAdvancedPipeline: ()=>tableAdvancedPipeline,
|
104
104
|
registerDarkTheme: ()=>registerDarkTheme,
|
105
|
-
|
105
|
+
tableAdvancedPipeline: ()=>tableAdvancedPipeline,
|
106
106
|
pieSpecPipeline: ()=>pieSpecPipeline,
|
107
|
+
registerPivotTable: ()=>registerPivotTable,
|
108
|
+
zChartType: ()=>zChartType,
|
107
109
|
zMeasureTree: ()=>zMeasureTree,
|
108
110
|
barSpecPipeline: ()=>barSpecPipeline,
|
109
|
-
|
111
|
+
zSortAxis: ()=>zSortAxis,
|
110
112
|
registerRose: ()=>registerRose,
|
111
113
|
zRose: ()=>zRose,
|
112
114
|
unfoldDimensions: ()=>unfoldDimensions,
|
@@ -119,6 +121,7 @@
|
|
119
121
|
registerBar: ()=>registerBar,
|
120
122
|
isVChart: ()=>isVChart,
|
121
123
|
zPieConfig: ()=>zPieConfig,
|
124
|
+
zStackCornerRadius: ()=>zStackCornerRadius,
|
122
125
|
zTable: ()=>zTable,
|
123
126
|
registerLine: ()=>registerLine,
|
124
127
|
registerCustomTheme: ()=>registerCustomTheme,
|
@@ -150,6 +153,7 @@
|
|
150
153
|
zAnnotationPoint: ()=>zAnnotationPoint,
|
151
154
|
lightTheme: ()=>lightTheme,
|
152
155
|
registerColumnParallel: ()=>registerColumnParallel,
|
156
|
+
updateAdvanced: ()=>updateAdvanced,
|
153
157
|
zDimension: ()=>zDimension,
|
154
158
|
isPivotChart: ()=>isPivotChart,
|
155
159
|
zDualAxisConfig: ()=>zDualAxisConfig,
|
@@ -158,6 +162,7 @@
|
|
158
162
|
zLineConfig: ()=>zLineConfig,
|
159
163
|
zTableConfig: ()=>zTableConfig,
|
160
164
|
zXBandAxis: ()=>zXBandAxis,
|
165
|
+
dataReshapeFor1D: ()=>dataReshapeFor1D,
|
161
166
|
zColumnPercentConfig: ()=>zColumnPercentConfig,
|
162
167
|
findMeasureById: ()=>findMeasureById,
|
163
168
|
zVSeed: ()=>zVSeed,
|
@@ -168,6 +173,9 @@
|
|
168
173
|
zMeasure: ()=>zMeasure,
|
169
174
|
zLocale: ()=>zLocale,
|
170
175
|
pivotTableSpecPipeline: ()=>pivotTableSpecPipeline,
|
176
|
+
areaRangeSpecPipeline: ()=>areaRangeSpecPipeline,
|
177
|
+
areaRangeAdvancedPipeline: ()=>areaRangeAdvancedPipeline,
|
178
|
+
zAreaRange: ()=>zAreaRange,
|
171
179
|
registerScatter: ()=>registerScatter,
|
172
180
|
zEncoding: ()=>zEncoding,
|
173
181
|
autoNumFormatter: ()=>autoNumFormatter,
|
@@ -191,9 +199,9 @@
|
|
191
199
|
zBarParallelConfig: ()=>zBarParallelConfig,
|
192
200
|
barParallelAdvancedPipeline: ()=>barParallelAdvancedPipeline,
|
193
201
|
FoldMeasureValue: ()=>FoldMeasureValue,
|
194
|
-
zBarPercentConfig: ()=>zBarPercentConfig,
|
195
202
|
barPercentSpecPipeline: ()=>barPercentSpecPipeline,
|
196
203
|
lineAdvancedPipeline: ()=>lineAdvancedPipeline,
|
204
|
+
zBarPercentConfig: ()=>zBarPercentConfig,
|
197
205
|
lineSpecPipeline: ()=>lineSpecPipeline,
|
198
206
|
zTooltip: ()=>zTooltip,
|
199
207
|
createFormatter: ()=>createFormatter,
|
@@ -1135,6 +1143,51 @@
|
|
1135
1143
|
}));
|
1136
1144
|
return result;
|
1137
1145
|
};
|
1146
|
+
const autoMeasuresBy2M1Group = (advancedVSeed, context)=>{
|
1147
|
+
const result = {
|
1148
|
+
...advancedVSeed
|
1149
|
+
};
|
1150
|
+
const { vseed } = context;
|
1151
|
+
const { measures, dataset } = vseed;
|
1152
|
+
if (!dataset) throw new Error('dataset is required');
|
1153
|
+
if (0 === dataset.length) return result;
|
1154
|
+
if (measures) {
|
1155
|
+
result.measures = auto2M1Group(measures);
|
1156
|
+
return result;
|
1157
|
+
}
|
1158
|
+
const top100dataset = dataset.slice(0, 100);
|
1159
|
+
const sample = top100dataset.reduce((prev, cur)=>({
|
1160
|
+
...prev,
|
1161
|
+
...cur
|
1162
|
+
}), {});
|
1163
|
+
const newMeasures = Object.keys(sample).filter((key)=>top100dataset.some((item)=>'number' == typeof item[key]) && ![
|
1164
|
+
'',
|
1165
|
+
null,
|
1166
|
+
void 0
|
1167
|
+
].includes(key)).map((measure)=>({
|
1168
|
+
id: measure,
|
1169
|
+
alias: measure
|
1170
|
+
}));
|
1171
|
+
result.measures = auto2M1Group(newMeasures);
|
1172
|
+
return result;
|
1173
|
+
};
|
1174
|
+
const auto2M1Group = (measures)=>{
|
1175
|
+
const allMeasures = findAllMeasures(measures);
|
1176
|
+
if (allMeasures.length <= 2) return allMeasures;
|
1177
|
+
const groups = measures.filter((measure)=>'children' in measure);
|
1178
|
+
const singleMeasures = measures.filter((measure)=>!('children' in measure));
|
1179
|
+
for(let i = 0; i < singleMeasures.length; i += 2){
|
1180
|
+
const group = autoMeasuresBy2M1Group_createEmptyMeasureGroup();
|
1181
|
+
group.children = allMeasures.slice(i, i + 2);
|
1182
|
+
groups.push(group);
|
1183
|
+
}
|
1184
|
+
return groups;
|
1185
|
+
};
|
1186
|
+
const autoMeasuresBy2M1Group_createEmptyMeasureGroup = ()=>({
|
1187
|
+
id: '',
|
1188
|
+
alias: '',
|
1189
|
+
children: []
|
1190
|
+
});
|
1138
1191
|
const FoldMeasureName = '__MeaName__';
|
1139
1192
|
const FoldMeasureValue = '__MeaValue__';
|
1140
1193
|
const FoldMeasureId = '__MeaId__';
|
@@ -1246,10 +1299,10 @@
|
|
1246
1299
|
for(let i = 0; i < dataset.length; i++){
|
1247
1300
|
const datum = dataset[i];
|
1248
1301
|
const colorName = generateDimGroupName(dimensionsToBeUnfolded, datum, dimensionsSeparator);
|
1249
|
-
const colorId = [
|
1302
|
+
const colorId = datum[foldMeasureId] ? [
|
1250
1303
|
colorName,
|
1251
|
-
datum[foldMeasureId]
|
1252
|
-
].join(dimensionsSeparator);
|
1304
|
+
datum[foldMeasureId]
|
1305
|
+
].join(dimensionsSeparator) : colorName;
|
1253
1306
|
datum[unfoldGroupName] = colorName;
|
1254
1307
|
datum[unfoldGroupId] = colorId;
|
1255
1308
|
colorItems.push(colorId);
|
@@ -1509,6 +1562,58 @@
|
|
1509
1562
|
};
|
1510
1563
|
}
|
1511
1564
|
};
|
1565
|
+
const dataReshapeFor1D_emptyReshapeResult = {
|
1566
|
+
dataset: [],
|
1567
|
+
foldInfo: {
|
1568
|
+
foldMap: {},
|
1569
|
+
measureId: '',
|
1570
|
+
measureName: '',
|
1571
|
+
measureValue: ''
|
1572
|
+
},
|
1573
|
+
unfoldInfo: {
|
1574
|
+
groupName: '',
|
1575
|
+
groupId: '',
|
1576
|
+
colorItems: [],
|
1577
|
+
colorIdMap: {}
|
1578
|
+
}
|
1579
|
+
};
|
1580
|
+
const dataReshapeFor1D = (dataset, dimensions, measures, options)=>{
|
1581
|
+
const { foldMeasureId = FoldMeasureId, foldMeasureName = FoldMeasureName, foldMeasureValue = FoldMeasureValue, unfoldDimensionGroup = UnfoldDimensionGroup, unfoldDimensionGroupId = UnfoldDimensionGroupId } = options || {};
|
1582
|
+
if (0 === dimensions.length && 0 === measures.length) return dataReshapeFor1D_emptyReshapeResult;
|
1583
|
+
if (0 === dimensions.length) {
|
1584
|
+
const { dataset: finalDataset, unfoldInfo } = unfoldDimensions(dataset, [], [], 0, unfoldDimensionGroup, unfoldDimensionGroupId, foldMeasureId);
|
1585
|
+
return {
|
1586
|
+
dataset: finalDataset,
|
1587
|
+
foldInfo: {
|
1588
|
+
foldMap: {},
|
1589
|
+
measureId: foldMeasureId,
|
1590
|
+
measureName: foldMeasureName,
|
1591
|
+
measureValue: foldMeasureValue
|
1592
|
+
},
|
1593
|
+
unfoldInfo
|
1594
|
+
};
|
1595
|
+
}
|
1596
|
+
{
|
1597
|
+
const { dataset: finalDataset, unfoldInfo } = unfoldDimensions(dataset, [
|
1598
|
+
...dimensions
|
1599
|
+
], [
|
1600
|
+
{
|
1601
|
+
id: foldMeasureValue,
|
1602
|
+
alias: i18n`指标值`
|
1603
|
+
}
|
1604
|
+
], 0, unfoldDimensionGroup, unfoldDimensionGroupId, foldMeasureId);
|
1605
|
+
return {
|
1606
|
+
dataset: finalDataset,
|
1607
|
+
foldInfo: {
|
1608
|
+
foldMap: {},
|
1609
|
+
measureId: foldMeasureId,
|
1610
|
+
measureName: foldMeasureName,
|
1611
|
+
measureValue: foldMeasureValue
|
1612
|
+
},
|
1613
|
+
unfoldInfo
|
1614
|
+
};
|
1615
|
+
}
|
1616
|
+
};
|
1512
1617
|
const reshapeTo2D1M = (advancedVSeed, context)=>{
|
1513
1618
|
const result = {
|
1514
1619
|
...advancedVSeed
|
@@ -1577,6 +1682,28 @@
|
|
1577
1682
|
]
|
1578
1683
|
};
|
1579
1684
|
};
|
1685
|
+
const reshapeTo1D = (advancedVSeed, context)=>{
|
1686
|
+
const result = {
|
1687
|
+
...advancedVSeed
|
1688
|
+
};
|
1689
|
+
const { vseed } = context;
|
1690
|
+
const { dataset } = vseed;
|
1691
|
+
const { dimensions, measures } = advancedVSeed;
|
1692
|
+
if (!measures || !dimensions || !dataset) return result;
|
1693
|
+
if (0 === measures.length) throw new Error('measures can not be empty');
|
1694
|
+
const { dataset: newDatasets, foldInfo, unfoldInfo } = dataReshapeFor1D(dataset, dimensions, measures);
|
1695
|
+
return {
|
1696
|
+
...result,
|
1697
|
+
dataset: newDatasets,
|
1698
|
+
datasetReshapeInfo: [
|
1699
|
+
{
|
1700
|
+
id: '1D2M',
|
1701
|
+
foldInfo,
|
1702
|
+
unfoldInfo
|
1703
|
+
}
|
1704
|
+
]
|
1705
|
+
};
|
1706
|
+
};
|
1580
1707
|
const pivotReshapeTo1D1M = (advancedVSeed, context)=>{
|
1581
1708
|
const result = {
|
1582
1709
|
...advancedVSeed
|
@@ -1697,6 +1824,46 @@
|
|
1697
1824
|
datasetReshapeInfo: datasetReshapeInfo
|
1698
1825
|
};
|
1699
1826
|
};
|
1827
|
+
const pivotReshapeTo1D = (advancedVSeed, context)=>{
|
1828
|
+
const result = {
|
1829
|
+
...advancedVSeed
|
1830
|
+
};
|
1831
|
+
const { vseed } = context;
|
1832
|
+
const { dataset } = vseed;
|
1833
|
+
const { measures } = advancedVSeed;
|
1834
|
+
const dimensions = advancedVSeed.dimensions;
|
1835
|
+
if (!measures || !dimensions) return result;
|
1836
|
+
const measureGroups = [];
|
1837
|
+
if (measures) measures.forEach((measure)=>{
|
1838
|
+
if (measure.children && measure.children.length > 0) measureGroups.push(measure);
|
1839
|
+
});
|
1840
|
+
const newDatasets = [];
|
1841
|
+
const datasetReshapeInfo = [];
|
1842
|
+
measureGroups.forEach((measureGroup)=>{
|
1843
|
+
const measures = measureGroup.children;
|
1844
|
+
if (!measures) return;
|
1845
|
+
const commonDimensions = dimensions.filter((dim)=>'dimension' === dim.location);
|
1846
|
+
const groupId = measureGroup.id;
|
1847
|
+
const { dataset: newSubDataset, foldInfo, unfoldInfo } = dataReshapeFor1D(dataset, commonDimensions, measures, {
|
1848
|
+
foldMeasureId: FoldMeasureId,
|
1849
|
+
foldMeasureName: FoldMeasureName,
|
1850
|
+
foldMeasureValue: FoldMeasureValue + groupId,
|
1851
|
+
unfoldDimensionGroup: UnfoldDimensionGroup
|
1852
|
+
});
|
1853
|
+
const reshapeInfo = {
|
1854
|
+
id: groupId,
|
1855
|
+
foldInfo,
|
1856
|
+
unfoldInfo
|
1857
|
+
};
|
1858
|
+
newDatasets.push(newSubDataset);
|
1859
|
+
datasetReshapeInfo.push(reshapeInfo);
|
1860
|
+
});
|
1861
|
+
return {
|
1862
|
+
...result,
|
1863
|
+
dataset: newDatasets,
|
1864
|
+
datasetReshapeInfo: datasetReshapeInfo
|
1865
|
+
};
|
1866
|
+
};
|
1700
1867
|
const encodingXY = (advancedVSeed)=>{
|
1701
1868
|
const result = {
|
1702
1869
|
...advancedVSeed
|
@@ -1807,6 +1974,74 @@
|
|
1807
1974
|
encoding
|
1808
1975
|
};
|
1809
1976
|
};
|
1977
|
+
const encodingXYY = (advancedVSeed)=>{
|
1978
|
+
const result = {
|
1979
|
+
...advancedVSeed
|
1980
|
+
};
|
1981
|
+
const { datasetReshapeInfo, dimensions, measures } = advancedVSeed;
|
1982
|
+
if (!datasetReshapeInfo || !dimensions || !measures) return result;
|
1983
|
+
const encoding = datasetReshapeInfo.reduce((prev, cur, index)=>{
|
1984
|
+
const measure = measures[index];
|
1985
|
+
if ('children' in measure) {
|
1986
|
+
const m1 = measure.children?.[0];
|
1987
|
+
const m2 = measure.children?.[1] || m1;
|
1988
|
+
const { foldInfo, unfoldInfo } = cur;
|
1989
|
+
const x = [
|
1990
|
+
unfoldInfo.groupId
|
1991
|
+
];
|
1992
|
+
const y = [
|
1993
|
+
m1?.id,
|
1994
|
+
m2?.id
|
1995
|
+
];
|
1996
|
+
const group = [
|
1997
|
+
unfoldInfo.groupId
|
1998
|
+
];
|
1999
|
+
const color = [
|
2000
|
+
foldInfo.measureName
|
2001
|
+
];
|
2002
|
+
return [
|
2003
|
+
...prev,
|
2004
|
+
{
|
2005
|
+
x,
|
2006
|
+
y,
|
2007
|
+
group,
|
2008
|
+
color
|
2009
|
+
}
|
2010
|
+
];
|
2011
|
+
}
|
2012
|
+
{
|
2013
|
+
const m1 = measures[index];
|
2014
|
+
const m2 = measures[index + 1] || m1;
|
2015
|
+
const { foldInfo, unfoldInfo } = cur;
|
2016
|
+
const x = [
|
2017
|
+
unfoldInfo.groupId
|
2018
|
+
];
|
2019
|
+
const y = [
|
2020
|
+
m1.id,
|
2021
|
+
m2.id
|
2022
|
+
];
|
2023
|
+
const group = [
|
2024
|
+
unfoldInfo.groupId
|
2025
|
+
];
|
2026
|
+
const color = [
|
2027
|
+
foldInfo.measureName
|
2028
|
+
];
|
2029
|
+
return [
|
2030
|
+
...prev,
|
2031
|
+
{
|
2032
|
+
x,
|
2033
|
+
y,
|
2034
|
+
group,
|
2035
|
+
color
|
2036
|
+
}
|
2037
|
+
];
|
2038
|
+
}
|
2039
|
+
}, []);
|
2040
|
+
return {
|
2041
|
+
...result,
|
2042
|
+
encoding
|
2043
|
+
};
|
2044
|
+
};
|
1810
2045
|
const encodingRose = (advancedVSeed)=>{
|
1811
2046
|
const result = {
|
1812
2047
|
...advancedVSeed
|
@@ -2338,6 +2573,22 @@
|
|
2338
2573
|
markStyle_markStyle,
|
2339
2574
|
annotation_annotation
|
2340
2575
|
];
|
2576
|
+
const areaRangeAdvancedPipeline = [
|
2577
|
+
initAdvancedVSeed,
|
2578
|
+
autoMeasuresBy2M1Group,
|
2579
|
+
autoDimensions,
|
2580
|
+
pivotAdapter([
|
2581
|
+
reshapeTo1D
|
2582
|
+
], [
|
2583
|
+
pivotReshapeTo1D
|
2584
|
+
]),
|
2585
|
+
encodingXYY,
|
2586
|
+
sortXBandAxis,
|
2587
|
+
areaConfig,
|
2588
|
+
theme_theme,
|
2589
|
+
markStyle_markStyle,
|
2590
|
+
annotation_annotation
|
2591
|
+
];
|
2341
2592
|
const pieAdvancedPipeline = [
|
2342
2593
|
initAdvancedVSeed,
|
2343
2594
|
autoMeasures,
|
@@ -2578,7 +2829,7 @@
|
|
2578
2829
|
theme_theme
|
2579
2830
|
];
|
2580
2831
|
const dataset_dataset = (spec, context)=>{
|
2581
|
-
const { advancedVSeed } = context;
|
2832
|
+
const { advancedVSeed, vseed } = context;
|
2582
2833
|
const { encoding, analysis, datasetReshapeInfo } = advancedVSeed;
|
2583
2834
|
const { orderMapping = {} } = analysis ?? {};
|
2584
2835
|
const angle = encoding[0]?.angle?.[0];
|
@@ -2627,7 +2878,7 @@
|
|
2627
2878
|
...spec,
|
2628
2879
|
data: {
|
2629
2880
|
id,
|
2630
|
-
values: advancedVSeed.dataset,
|
2881
|
+
values: isPivotChart(vseed) ? void 0 : advancedVSeed.dataset,
|
2631
2882
|
fields: fields
|
2632
2883
|
}
|
2633
2884
|
};
|
@@ -2736,6 +2987,88 @@
|
|
2736
2987
|
result.animation = true;
|
2737
2988
|
return result;
|
2738
2989
|
};
|
2990
|
+
const initAreaRange = (spec, context)=>{
|
2991
|
+
const result = {
|
2992
|
+
...spec
|
2993
|
+
};
|
2994
|
+
const { advancedVSeed } = context;
|
2995
|
+
const { encoding } = advancedVSeed;
|
2996
|
+
if (!encoding[0].y || !encoding[0].x || !encoding[0].group) return result;
|
2997
|
+
const { color } = advancedVSeed.config.areaRange;
|
2998
|
+
result.type = 'rangeArea';
|
2999
|
+
result.direction = 'vertical';
|
3000
|
+
result.stack = false;
|
3001
|
+
result.xField = encoding[0].x[0];
|
3002
|
+
result.yField = [
|
3003
|
+
encoding[0].y[0],
|
3004
|
+
encoding[0].y[1]
|
3005
|
+
];
|
3006
|
+
result.animation = true;
|
3007
|
+
result.area = {
|
3008
|
+
style: {
|
3009
|
+
fill: color.colorScheme?.[0]
|
3010
|
+
}
|
3011
|
+
};
|
3012
|
+
return result;
|
3013
|
+
};
|
3014
|
+
const initAreaRangeLine1 = (spec, context)=>{
|
3015
|
+
const result = {
|
3016
|
+
...spec
|
3017
|
+
};
|
3018
|
+
const { advancedVSeed } = context;
|
3019
|
+
const { encoding } = advancedVSeed;
|
3020
|
+
if (!encoding[0].y || !encoding[0].x || !encoding[0].group) return result;
|
3021
|
+
const { color } = advancedVSeed.config.areaRange;
|
3022
|
+
result.type = 'line';
|
3023
|
+
result.direction = 'vertical';
|
3024
|
+
result.stack = false;
|
3025
|
+
result.xField = encoding[0].x[0];
|
3026
|
+
result.yField = [
|
3027
|
+
encoding[0].y[0]
|
3028
|
+
];
|
3029
|
+
result.animation = true;
|
3030
|
+
result.line = {
|
3031
|
+
style: {
|
3032
|
+
stroke: color.colorScheme?.[0]
|
3033
|
+
}
|
3034
|
+
};
|
3035
|
+
result.point = {
|
3036
|
+
style: {
|
3037
|
+
visible: false,
|
3038
|
+
fill: color.colorScheme?.[0]
|
3039
|
+
}
|
3040
|
+
};
|
3041
|
+
return result;
|
3042
|
+
};
|
3043
|
+
const initAreaRangeLine2 = (spec, context)=>{
|
3044
|
+
const result = {
|
3045
|
+
...spec
|
3046
|
+
};
|
3047
|
+
const { advancedVSeed } = context;
|
3048
|
+
const { encoding } = advancedVSeed;
|
3049
|
+
if (!encoding[0].y || !encoding[0].x || !encoding[0].group) return result;
|
3050
|
+
const { color } = advancedVSeed.config.areaRange;
|
3051
|
+
result.type = 'line';
|
3052
|
+
result.direction = 'vertical';
|
3053
|
+
result.stack = false;
|
3054
|
+
result.xField = encoding[0].x[0];
|
3055
|
+
result.yField = [
|
3056
|
+
encoding[0].y[1]
|
3057
|
+
];
|
3058
|
+
result.animation = true;
|
3059
|
+
result.line = {
|
3060
|
+
style: {
|
3061
|
+
stroke: color.colorScheme?.[0]
|
3062
|
+
}
|
3063
|
+
};
|
3064
|
+
result.point = {
|
3065
|
+
style: {
|
3066
|
+
visible: false,
|
3067
|
+
fill: color.colorScheme?.[0]
|
3068
|
+
}
|
3069
|
+
};
|
3070
|
+
return result;
|
3071
|
+
};
|
2739
3072
|
const initLine = (spec, context)=>{
|
2740
3073
|
const result = {
|
2741
3074
|
...spec
|
@@ -5034,6 +5367,21 @@
|
|
5034
5367
|
};
|
5035
5368
|
return result;
|
5036
5369
|
};
|
5370
|
+
const series = (...args)=>{
|
5371
|
+
const result = {
|
5372
|
+
type: 'common',
|
5373
|
+
padding: 0,
|
5374
|
+
region: [
|
5375
|
+
{
|
5376
|
+
clip: true
|
5377
|
+
}
|
5378
|
+
]
|
5379
|
+
};
|
5380
|
+
return (_, context)=>{
|
5381
|
+
result.series = args.map((pipeline)=>execPipeline(pipeline, context, {}));
|
5382
|
+
return result;
|
5383
|
+
};
|
5384
|
+
};
|
5037
5385
|
const line_line = [
|
5038
5386
|
initLine,
|
5039
5387
|
color_color,
|
@@ -5480,6 +5828,69 @@
|
|
5480
5828
|
const areaPercentSpecPipeline = [
|
5481
5829
|
pivotAdapter_pivotAdapter(areaPercent, pivotAreaPercent)
|
5482
5830
|
];
|
5831
|
+
const areaRange = [
|
5832
|
+
series([
|
5833
|
+
initAreaRange,
|
5834
|
+
areaStyle_areaStyle
|
5835
|
+
], [
|
5836
|
+
initAreaRangeLine1,
|
5837
|
+
lineStyle_lineStyle,
|
5838
|
+
pointStyle_pointStyle,
|
5839
|
+
pointStateDimensionHover
|
5840
|
+
], [
|
5841
|
+
initAreaRangeLine2,
|
5842
|
+
lineStyle_lineStyle,
|
5843
|
+
pointStyle_pointStyle,
|
5844
|
+
pointStateDimensionHover
|
5845
|
+
]),
|
5846
|
+
dataset_dataset,
|
5847
|
+
background_backgroundColor,
|
5848
|
+
xBand,
|
5849
|
+
yLinear,
|
5850
|
+
label_label,
|
5851
|
+
verticalCrosshairLine,
|
5852
|
+
annotationPoint_annotationPoint,
|
5853
|
+
annotationVerticalLine_annotationVerticalLine,
|
5854
|
+
annotationHorizontalLine_annotationHorizontalLine,
|
5855
|
+
annotationArea_annotationArea
|
5856
|
+
];
|
5857
|
+
const pivotAreaRange = [
|
5858
|
+
initPivot,
|
5859
|
+
pivotGridStyle,
|
5860
|
+
pivotIndicators_pivotIndicatorsAsRow,
|
5861
|
+
datasetPivot,
|
5862
|
+
pivotIndicators([
|
5863
|
+
series([
|
5864
|
+
initAreaRange,
|
5865
|
+
areaStyle_areaStyle
|
5866
|
+
], [
|
5867
|
+
initAreaRangeLine1,
|
5868
|
+
lineStyle_lineStyle,
|
5869
|
+
pointStyle_pointStyle,
|
5870
|
+
pointStateDimensionHover
|
5871
|
+
], [
|
5872
|
+
initAreaRangeLine2,
|
5873
|
+
lineStyle_lineStyle,
|
5874
|
+
pointStyle_pointStyle,
|
5875
|
+
pointStateDimensionHover
|
5876
|
+
]),
|
5877
|
+
background_backgroundColor,
|
5878
|
+
dataset_dataset,
|
5879
|
+
xBand,
|
5880
|
+
yLinear,
|
5881
|
+
label_label,
|
5882
|
+
verticalCrosshairLine,
|
5883
|
+
annotationPoint_annotationPoint,
|
5884
|
+
annotationVerticalLine_annotationVerticalLine,
|
5885
|
+
annotationHorizontalLine_annotationHorizontalLine,
|
5886
|
+
annotationArea_annotationArea
|
5887
|
+
]),
|
5888
|
+
pivotRowDimensions,
|
5889
|
+
pivotColumnDimensions
|
5890
|
+
];
|
5891
|
+
const areaRangeSpecPipeline = [
|
5892
|
+
pivotAdapter_pivotAdapter(areaRange, pivotAreaRange)
|
5893
|
+
];
|
5483
5894
|
const pie = [
|
5484
5895
|
initPie,
|
5485
5896
|
color_color,
|
@@ -6541,8 +6952,18 @@
|
|
6541
6952
|
build = ()=>build(this);
|
6542
6953
|
buildSpec = (advanced)=>buildSpec(this, advanced);
|
6543
6954
|
buildAdvanced = ()=>buildAdvanced(this);
|
6544
|
-
getAdvancedPipeline = (chartType)=>
|
6545
|
-
|
6955
|
+
getAdvancedPipeline = (chartType)=>{
|
6956
|
+
const customPipe = Builder._customAdvancedPipe[chartType];
|
6957
|
+
const pipeline = Builder._advancedPipelineMap[chartType];
|
6958
|
+
if (customPipe) pipeline.push(customPipe);
|
6959
|
+
return pipeline;
|
6960
|
+
};
|
6961
|
+
getSpecPipeline = (chartType)=>{
|
6962
|
+
const customPipe = Builder._customSpecPipe[chartType];
|
6963
|
+
const pipeline = Builder._specPipelineMap[chartType];
|
6964
|
+
if (customPipe) pipeline.push(customPipe);
|
6965
|
+
return pipeline;
|
6966
|
+
};
|
6546
6967
|
getTheme = (themeKey)=>Builder._themeMap[themeKey];
|
6547
6968
|
getThemeMap = ()=>Builder._themeMap;
|
6548
6969
|
getColorItems = ()=>getColorItems(this);
|
@@ -6567,6 +6988,8 @@
|
|
6567
6988
|
}
|
6568
6989
|
static _advancedPipelineMap = {};
|
6569
6990
|
static _specPipelineMap = {};
|
6991
|
+
static _customAdvancedPipe = {};
|
6992
|
+
static _customSpecPipe = {};
|
6570
6993
|
static _themeMap = {};
|
6571
6994
|
static from = (vseed)=>new Builder(vseed);
|
6572
6995
|
}
|
@@ -6590,6 +7013,10 @@
|
|
6590
7013
|
Builder._advancedPipelineMap.areaPercent = areaPercentAdvancedPipeline;
|
6591
7014
|
Builder._specPipelineMap.areaPercent = areaPercentSpecPipeline;
|
6592
7015
|
};
|
7016
|
+
const registerAreaRange = ()=>{
|
7017
|
+
Builder._advancedPipelineMap.areaRange = areaRangeAdvancedPipeline;
|
7018
|
+
Builder._specPipelineMap.areaRange = areaRangeSpecPipeline;
|
7019
|
+
};
|
6593
7020
|
const registerBarPercent = ()=>{
|
6594
7021
|
Builder._advancedPipelineMap.barPercent = barPercentAdvancedPipeline;
|
6595
7022
|
Builder._specPipelineMap.barPercent = barPercentSpecPipeline;
|
@@ -6882,6 +7309,12 @@
|
|
6882
7309
|
yAxis: linearAxis,
|
6883
7310
|
crosshairLine
|
6884
7311
|
},
|
7312
|
+
areaRange: {
|
7313
|
+
...baseConfig,
|
7314
|
+
xAxis: bandAxis,
|
7315
|
+
yAxis: linearAxis,
|
7316
|
+
crosshairLine
|
7317
|
+
},
|
6885
7318
|
scatter: {
|
6886
7319
|
...baseConfig,
|
6887
7320
|
xAxis: {
|
@@ -7175,6 +7608,12 @@
|
|
7175
7608
|
yAxis: linearAxis,
|
7176
7609
|
crosshairLine: crosshairLine
|
7177
7610
|
},
|
7611
|
+
areaRange: {
|
7612
|
+
...baseConfig,
|
7613
|
+
xAxis: bandAxis,
|
7614
|
+
yAxis: linearAxis,
|
7615
|
+
crosshairLine: crosshairLine
|
7616
|
+
},
|
7178
7617
|
scatter: {
|
7179
7618
|
...baseConfig,
|
7180
7619
|
xAxis: {
|
@@ -7248,6 +7687,7 @@
|
|
7248
7687
|
registerBarPercent();
|
7249
7688
|
registerArea();
|
7250
7689
|
registerAreaPercent();
|
7690
|
+
registerAreaRange();
|
7251
7691
|
registerPie();
|
7252
7692
|
registerDonut();
|
7253
7693
|
registerRose();
|
@@ -7259,6 +7699,12 @@
|
|
7259
7699
|
registerLightTheme();
|
7260
7700
|
registerDarkTheme();
|
7261
7701
|
};
|
7702
|
+
const updateAdvanced = (chartType, advancedPipe)=>{
|
7703
|
+
Builder._customAdvancedPipe[chartType] = advancedPipe;
|
7704
|
+
};
|
7705
|
+
const updateSpec = (chartType, specPipe)=>{
|
7706
|
+
Builder._customSpecPipe[chartType] = specPipe;
|
7707
|
+
};
|
7262
7708
|
const NEVER = Object.freeze({
|
7263
7709
|
status: "aborted"
|
7264
7710
|
});
|
@@ -12076,6 +12522,7 @@
|
|
12076
12522
|
'barParallel',
|
12077
12523
|
'area',
|
12078
12524
|
'areaPercent',
|
12525
|
+
'areaRange',
|
12079
12526
|
'rose',
|
12080
12527
|
'roseParallel',
|
12081
12528
|
'pie',
|
@@ -12406,6 +12853,7 @@
|
|
12406
12853
|
crosshairLine: zCrosshairLine.optional()
|
12407
12854
|
});
|
12408
12855
|
const zAreaPercentConfig = zAreaConfig;
|
12856
|
+
const zAreaRangeConfig = zAreaConfig;
|
12409
12857
|
const zRoseConfig = schemas_object({
|
12410
12858
|
backgroundColor: zBackgroundColor.optional(),
|
12411
12859
|
label: zLabel.optional(),
|
@@ -12458,6 +12906,7 @@
|
|
12458
12906
|
barPercent: zBarPercentConfig.optional(),
|
12459
12907
|
area: zAreaConfig.optional(),
|
12460
12908
|
areaPercent: zAreaPercentConfig.optional(),
|
12909
|
+
areaRange: zAreaRangeConfig.optional(),
|
12461
12910
|
rose: zRoseConfig.optional(),
|
12462
12911
|
roseParallel: zRoseParallelConfig.optional(),
|
12463
12912
|
pie: zPieConfig.optional(),
|
@@ -18772,6 +19221,26 @@
|
|
18772
19221
|
annotationArea: schemas_array(zAnnotationArea).or(zAnnotationArea).optional(),
|
18773
19222
|
locale: zLocale.optional()
|
18774
19223
|
});
|
19224
|
+
const zAreaRange = schemas_object({
|
19225
|
+
chartType: literal('areaRange'),
|
19226
|
+
dataset: zDataset.optional(),
|
19227
|
+
dimensions: zDimensions.optional(),
|
19228
|
+
measures: zMeasureTree.optional(),
|
19229
|
+
backgroundColor: zBackgroundColor.optional(),
|
19230
|
+
label: zLabel.optional(),
|
19231
|
+
xAxis: zXBandAxis.optional(),
|
19232
|
+
yAxis: zYLinearAxis.optional(),
|
19233
|
+
crosshairLine: zCrosshairLine.optional(),
|
19234
|
+
theme: zTheme.optional(),
|
19235
|
+
pointStyle: zPointStyle.optional(),
|
19236
|
+
lineStyle: zLineStyle.optional(),
|
19237
|
+
areaStyle: zAreaStyle.optional(),
|
19238
|
+
annotationPoint: schemas_array(zAnnotationPoint).or(zAnnotationPoint).optional(),
|
19239
|
+
annotationVerticalLine: schemas_array(zAnnotationVerticalLine).or(zAnnotationVerticalLine).optional(),
|
19240
|
+
annotationHorizontalLine: schemas_array(zAnnotationHorizontalLine).or(zAnnotationHorizontalLine).optional(),
|
19241
|
+
annotationArea: schemas_array(zAnnotationArea).or(zAnnotationArea).optional(),
|
19242
|
+
locale: zLocale.optional()
|
19243
|
+
});
|
18775
19244
|
const zRose = schemas_object({
|
18776
19245
|
chartType: literal('rose'),
|
18777
19246
|
dataset: zDataset.optional(),
|
@@ -18870,6 +19339,7 @@
|
|
18870
19339
|
zBarPercent,
|
18871
19340
|
zArea,
|
18872
19341
|
zAreaPercent,
|
19342
|
+
zAreaRange,
|
18873
19343
|
zPie,
|
18874
19344
|
zRose,
|
18875
19345
|
zRoseParallel,
|