@visactor/vseed 0.0.37 → 0.0.39
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 +22 -24
- package/dist/index.cjs +132 -71
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +132 -71
- package/dist/index.js.map +1 -1
- package/dist/pipeline/spec/chart/pipes/color/color.d.ts +3 -0
- package/dist/pipeline/spec/chart/pipes/series/series.d.ts +4 -0
- package/dist/pipeline/utils/constant.d.ts +2 -0
- package/dist/types/advancedVSeed.d.ts +10 -12
- package/dist/types/chartType/area/area.d.ts +13 -10
- package/dist/types/chartType/area/zArea.d.ts +6 -12
- package/dist/types/chartType/areaPercent/areaPercent.d.ts +4 -0
- package/dist/types/chartType/areaPercent/zAreaPercent.d.ts +6 -12
- package/dist/types/chartType/areaRange/areaRange.d.ts +4 -0
- package/dist/types/chartType/areaRange/zAreaRange.d.ts +6 -12
- package/dist/types/chartType/bar/bar.d.ts +4 -0
- package/dist/types/chartType/bar/zBar.d.ts +2 -12
- package/dist/types/chartType/barParallel/barParallel.d.ts +4 -0
- package/dist/types/chartType/barParallel/zBarParallel.d.ts +2 -12
- package/dist/types/chartType/barPercent/barPercent.d.ts +4 -0
- package/dist/types/chartType/barPercent/zBarPercent.d.ts +2 -12
- package/dist/types/chartType/column/column.d.ts +4 -0
- package/dist/types/chartType/column/zColumn.d.ts +2 -12
- package/dist/types/chartType/columnParallel/columnParallel.d.ts +4 -0
- package/dist/types/chartType/columnParallel/zColumnParallel.d.ts +2 -12
- package/dist/types/chartType/columnPercent/columnPercent.d.ts +4 -0
- package/dist/types/chartType/columnPercent/zColumnPercent.d.ts +2 -12
- package/dist/types/chartType/donut/donut.d.ts +4 -0
- package/dist/types/chartType/dualAxis/dualAxis.d.ts +9 -0
- package/dist/types/chartType/dualAxis/zDualAxis.d.ts +9 -12
- package/dist/types/chartType/funnel/funnel.d.ts +4 -0
- package/dist/types/chartType/heatmap/heatmap.d.ts +4 -0
- package/dist/types/chartType/line/line.d.ts +8 -2
- package/dist/types/chartType/line/zLine.d.ts +4 -12
- package/dist/types/chartType/pie/pie.d.ts +4 -0
- package/dist/types/chartType/pivotTable/pivotTable.d.ts +4 -0
- package/dist/types/chartType/radar/radar.d.ts +29 -1
- package/dist/types/chartType/rose/rose.d.ts +4 -0
- package/dist/types/chartType/roseParallel/roseParallel.d.ts +4 -0
- package/dist/types/chartType/scatter/scatter.d.ts +4 -0
- package/dist/types/chartType/scatter/zScatter.d.ts +2 -12
- package/dist/types/chartType/table/table.d.ts +4 -0
- package/dist/types/dataSelector/selector.d.ts +54 -0
- package/dist/types/properties/annotation/annotation.d.ts +0 -12
- package/dist/types/properties/annotation/annotationArea.d.ts +17 -32
- package/dist/types/properties/annotation/annotationHorizontalLine.d.ts +0 -14
- package/dist/types/properties/annotation/annotationVerticalLine.d.ts +0 -14
- package/dist/types/properties/annotation/zAnnotationArea.d.ts +0 -2
- package/dist/types/properties/annotation/zAnnotationHorizontalLine.d.ts +0 -2
- package/dist/types/properties/annotation/zAnnotationVerticalLine.d.ts +0 -2
- package/dist/types/properties/config/axes/axis.d.ts +0 -14
- package/dist/types/properties/config/color/color.d.ts +4 -6
- package/dist/types/properties/config/config.d.ts +2 -0
- package/dist/types/properties/config/crosshair/crosshair.d.ts +14 -17
- package/dist/types/properties/config/crosshair/index.d.ts +2 -1
- package/dist/types/properties/config/crosshair/zCrosshair.d.ts +15 -0
- package/dist/types/properties/config/legend/legend.d.ts +0 -4
- package/dist/types/properties/dimensions/dimensions.d.ts +6 -29
- package/dist/types/properties/dimensions/index.d.ts +2 -1
- package/dist/types/properties/dimensions/zDimensions.d.ts +30 -0
- package/dist/types/properties/markStyle/areaStyle.d.ts +5 -76
- package/dist/types/properties/markStyle/barStyle.d.ts +11 -12
- package/dist/types/properties/markStyle/index.d.ts +2 -1
- package/dist/types/properties/markStyle/lineStyle.d.ts +11 -17
- package/dist/types/properties/markStyle/markStyle.d.ts +8 -0
- package/dist/types/properties/markStyle/pointStyle.d.ts +5 -6
- package/dist/types/properties/markStyle/zAreaStyle.d.ts +75 -0
- package/dist/types/properties/measures/measures.d.ts +3 -0
- package/dist/types/properties/theme/customTheme.d.ts +2 -0
- package/dist/types/vseed.d.ts +45 -144
- package/dist/umd/index.js +132 -71
- package/dist/umd/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
@@ -845,6 +845,9 @@ const initPivotTable = (spec, context)=>{
|
|
845
845
|
tooltip: {
|
846
846
|
isShowOverflowTextTooltip: true
|
847
847
|
},
|
848
|
+
corner: {
|
849
|
+
titleOnDimension: 'all'
|
850
|
+
},
|
848
851
|
widthAdaptiveMode: 'all',
|
849
852
|
animationAppear: {
|
850
853
|
duration: 300,
|
@@ -1707,22 +1710,44 @@ const color_color = (spec, context)=>{
|
|
1707
1710
|
const colorIdMap = unfoldInfo.colorIdMap;
|
1708
1711
|
const { color } = baseConfig;
|
1709
1712
|
const { colorScheme, colorMapping } = color;
|
1710
|
-
const mappingList = [];
|
1711
|
-
if (colorMapping) Object.entries(colorMapping).sort((a, b)=>a[0].split(Separator).length - b[0].split(Separator).length).forEach(([key, value])=>{
|
1712
|
-
const idMap = Object.entries(colorIdMap).filter(([_, v])=>v.includes(key));
|
1713
|
-
for (const [colorId] of idMap)mappingList.push([
|
1714
|
-
colorId,
|
1715
|
-
value
|
1716
|
-
]);
|
1717
|
-
});
|
1718
1713
|
result.color = {
|
1719
1714
|
type: 'ordinal',
|
1720
1715
|
domain: colorItems,
|
1721
1716
|
range: colorScheme,
|
1722
|
-
specified:
|
1717
|
+
specified: createSpecifiedForColorMapping(colorMapping, colorIdMap, colorItems)
|
1723
1718
|
};
|
1724
1719
|
return result;
|
1725
1720
|
};
|
1721
|
+
const createSpecifiedForColorMapping = (colorMapping, colorIdMap, colorItems)=>{
|
1722
|
+
if (!colorMapping || !colorIdMap || !colorItems) return;
|
1723
|
+
const matchedList = [];
|
1724
|
+
const colors = Object.entries(colorMapping).sort((a, b)=>b[0].length - a[0].length);
|
1725
|
+
const accurateMap = colors.reduce((prev, cur)=>{
|
1726
|
+
const name = cur[0];
|
1727
|
+
const colorValue = cur[1];
|
1728
|
+
const accurateMatchedList = Object.entries(colorIdMap).filter(([colorKey, colorAlias])=>colorKey === name || colorAlias === name);
|
1729
|
+
accurateMatchedList.forEach((item)=>{
|
1730
|
+
prev[item[0]] = colorValue;
|
1731
|
+
matchedList.push(name);
|
1732
|
+
});
|
1733
|
+
return prev;
|
1734
|
+
}, {});
|
1735
|
+
const fuzzyMap = colors.reduce((prev, cur)=>{
|
1736
|
+
const name = cur[0];
|
1737
|
+
const colorValue = cur[1];
|
1738
|
+
if (matchedList.includes(name)) return prev;
|
1739
|
+
const fuzzyMatchedList = Object.entries(colorIdMap).filter(([colorKey, colorAlias])=>colorKey.includes(name) || colorAlias.includes(name));
|
1740
|
+
fuzzyMatchedList.forEach((item)=>{
|
1741
|
+
if (prev[item[0]]) return;
|
1742
|
+
prev[item[0]] = colorValue;
|
1743
|
+
});
|
1744
|
+
return prev;
|
1745
|
+
}, {});
|
1746
|
+
return {
|
1747
|
+
...fuzzyMap,
|
1748
|
+
...accurateMap
|
1749
|
+
};
|
1750
|
+
};
|
1726
1751
|
const background_backgroundColor = (spec, context)=>{
|
1727
1752
|
const result = {
|
1728
1753
|
...spec
|
@@ -1889,6 +1914,8 @@ const xBand = (spec, context)=>{
|
|
1889
1914
|
};
|
1890
1915
|
const ANNOTATION_Z_INDEX = 1000;
|
1891
1916
|
const LINEAR_AXIS_INNER_OFFSET_TOP = 7;
|
1917
|
+
const DUAL_AXIS_CHART_COLUMN_Z_INDEX = 1000;
|
1918
|
+
const DUAL_AXIS_CHART_NON_COLUMN_Z_INDEX = 1001;
|
1892
1919
|
const yLinear = (spec, context)=>{
|
1893
1920
|
const result = {
|
1894
1921
|
...spec
|
@@ -2330,7 +2357,7 @@ const pointStyle_pointStyle = (spec, context)=>{
|
|
2330
2357
|
pointStyle
|
2331
2358
|
];
|
2332
2359
|
const customMap = pointStyles.reduce((result, style, index)=>{
|
2333
|
-
const { pointBorderColor, pointBorderStyle, pointBorderWidth = 1, pointColor, pointColorOpacity, pointSize } = style;
|
2360
|
+
const { pointBorderColor, pointBorderStyle, pointBorderWidth = 1, pointColor, pointColorOpacity, pointSize, pointVisible = true } = style;
|
2334
2361
|
const lineDash = 'dashed' === pointBorderStyle ? [
|
2335
2362
|
5,
|
2336
2363
|
2
|
@@ -2350,6 +2377,7 @@ const pointStyle_pointStyle = (spec, context)=>{
|
|
2350
2377
|
return false;
|
2351
2378
|
},
|
2352
2379
|
style: {
|
2380
|
+
visible: pointVisible,
|
2353
2381
|
size: pointSize,
|
2354
2382
|
fill: pointColor,
|
2355
2383
|
fillOpacity: pointColorOpacity,
|
@@ -2382,7 +2410,12 @@ const pointStateDimensionHover = (spec)=>{
|
|
2382
2410
|
...point.state || {},
|
2383
2411
|
dimension_hover: {
|
2384
2412
|
scaleX: 1.4,
|
2385
|
-
scaleY: 1.4
|
2413
|
+
scaleY: 1.4,
|
2414
|
+
outerBorder: {
|
2415
|
+
lineWidth: 4,
|
2416
|
+
strokeOpacity: 0.25,
|
2417
|
+
distance: 2
|
2418
|
+
}
|
2386
2419
|
}
|
2387
2420
|
}
|
2388
2421
|
}
|
@@ -2429,9 +2462,9 @@ const lineStyle_lineStyle = (spec, context)=>{
|
|
2429
2462
|
const group = encoding[0]?.group?.[0];
|
2430
2463
|
const lineGroups = groupBy(dataset, (d)=>d[group ?? '']);
|
2431
2464
|
const customMap = lineStyles.reduce((result, style, index)=>{
|
2432
|
-
const { lineColor, lineColorOpacity, lineSmooth, lineStyle, lineWidth } = style;
|
2433
|
-
const dashSegment =
|
2434
|
-
const dashGap = lineWidth
|
2465
|
+
const { lineColor, lineColorOpacity, lineSmooth, lineStyle, lineWidth = 2, lineVisible = true } = style;
|
2466
|
+
const dashSegment = 2 * lineWidth;
|
2467
|
+
const dashGap = lineWidth;
|
2435
2468
|
const lineDash = 'dashed' === lineStyle ? [
|
2436
2469
|
dashSegment,
|
2437
2470
|
dashSegment
|
@@ -2453,6 +2486,7 @@ const lineStyle_lineStyle = (spec, context)=>{
|
|
2453
2486
|
return false;
|
2454
2487
|
},
|
2455
2488
|
style: {
|
2489
|
+
visible: lineVisible,
|
2456
2490
|
curveType: curveType,
|
2457
2491
|
strokeOpacity: lineColorOpacity,
|
2458
2492
|
stroke: lineColor,
|
@@ -2557,13 +2591,11 @@ const annotationVerticalLine_annotationVerticalLine = (spec, context)=>{
|
|
2557
2591
|
insideEnd: 'insideEndTop'
|
2558
2592
|
};
|
2559
2593
|
const markLine = annotationVerticalLineList.flatMap((annotationVerticalLine)=>{
|
2560
|
-
const { selector: selectorPoint, xValue, text = '', textPosition = 'insideEnd', textColor = '#ffffff', textFontSize = 12, textFontWeight = 400, textAlign = 'right', textBaseline = 'top', textBackgroundVisible = true, textBackgroundBorderColor = '#212121', textBackgroundColor = '#212121', textBackgroundBorderRadius = 4, textBackgroundBorderWidth = 1, textBackgroundPadding = 2, lineVisible = true, lineColor = '#212121', lineWidth = 1, lineStyle = 'dashed'
|
2594
|
+
const { selector: selectorPoint, xValue, text = '', textPosition = 'insideEnd', textColor = '#ffffff', textFontSize = 12, textFontWeight = 400, textAlign = 'right', textBaseline = 'top', textBackgroundVisible = true, textBackgroundBorderColor = '#212121', textBackgroundColor = '#212121', textBackgroundBorderRadius = 4, textBackgroundBorderWidth = 1, textBackgroundPadding = 2, lineVisible = true, lineColor = '#212121', lineWidth = 1, lineStyle = 'dashed' } = annotationVerticalLine;
|
2561
2595
|
const dataset = advancedVSeed.dataset.flat();
|
2562
2596
|
const generateOneMarkLine = (x)=>({
|
2563
2597
|
x: x,
|
2564
2598
|
zIndex: ANNOTATION_Z_INDEX,
|
2565
|
-
offsetX,
|
2566
|
-
offsetY,
|
2567
2599
|
line: {
|
2568
2600
|
style: {
|
2569
2601
|
visible: lineVisible,
|
@@ -2656,12 +2688,10 @@ const annotationHorizontalLine_annotationHorizontalLine = (spec, context)=>{
|
|
2656
2688
|
insideEnd: 'insideEndTop'
|
2657
2689
|
};
|
2658
2690
|
const markLine = annotationVerticalLineList.flatMap((annotationVerticalLine)=>{
|
2659
|
-
const { selector: selectorPoint, yValue, text = '', textPosition = 'insideEnd', textColor = '#ffffff', textFontSize = 12, textFontWeight = 400, textAlign = 'right', textBaseline = 'top', lineColor = '#212121', lineStyle = 'dashed', lineVisible = true, lineWidth = 1, textBackgroundVisible = true, textBackgroundColor = '#212121', textBackgroundBorderColor = '#212121', textBackgroundBorderRadius = 4, textBackgroundBorderWidth = 1, textBackgroundPadding = 2
|
2691
|
+
const { selector: selectorPoint, yValue, text = '', textPosition = 'insideEnd', textColor = '#ffffff', textFontSize = 12, textFontWeight = 400, textAlign = 'right', textBaseline = 'top', lineColor = '#212121', lineStyle = 'dashed', lineVisible = true, lineWidth = 1, textBackgroundVisible = true, textBackgroundColor = '#212121', textBackgroundBorderColor = '#212121', textBackgroundBorderRadius = 4, textBackgroundBorderWidth = 1, textBackgroundPadding = 2 } = annotationVerticalLine;
|
2660
2692
|
const dataset = advancedVSeed.dataset.flat();
|
2661
2693
|
const generateOneMarkLine = (y)=>({
|
2662
2694
|
y,
|
2663
|
-
offsetX,
|
2664
|
-
offsetY,
|
2665
2695
|
zIndex: ANNOTATION_Z_INDEX,
|
2666
2696
|
line: {
|
2667
2697
|
style: {
|
@@ -2757,7 +2787,7 @@ const annotationArea_annotationArea = (spec, context)=>{
|
|
2757
2787
|
right: 'insideRight'
|
2758
2788
|
};
|
2759
2789
|
const markArea = annotationAreaList.flatMap((annotationArea)=>{
|
2760
|
-
const { selector: selectorPoint, text = '', textPosition = 'top', textColor = '#ffffff', textFontSize = 12, textFontWeight = 400, textAlign = 'center', textBaseline = 'top', textBackgroundVisible = true, textBackgroundColor = '#191d24', textBackgroundBorderColor = '#191d24', textBackgroundBorderWidth = 1, textBackgroundBorderRadius = 4, textBackgroundPadding = 4, areaColor = '#888888', areaColorOpacity = 0.15, areaBorderColor = '#888888', areaBorderRadius = 4, areaBorderWidth = 1, outerPadding = 4
|
2790
|
+
const { selector: selectorPoint, text = '', textPosition = 'top', textColor = '#ffffff', textFontSize = 12, textFontWeight = 400, textAlign = 'center', textBaseline = 'top', textBackgroundVisible = true, textBackgroundColor = '#191d24', textBackgroundBorderColor = '#191d24', textBackgroundBorderWidth = 1, textBackgroundBorderRadius = 4, textBackgroundPadding = 4, areaColor = '#888888', areaColorOpacity = 0.15, areaBorderColor = '#888888', areaBorderRadius = 4, areaBorderWidth = 1, outerPadding = 4 } = annotationArea;
|
2761
2791
|
const dataset = advancedVSeed.dataset.flat();
|
2762
2792
|
const selectedData = selectorPoint ? dataset.filter((datum)=>selector_selector(datum, selectorPoint)) : [];
|
2763
2793
|
const labelPosition = positionMap[textPosition || 'top'];
|
@@ -2765,8 +2795,6 @@ const annotationArea_annotationArea = (spec, context)=>{
|
|
2765
2795
|
return {
|
2766
2796
|
zIndex: ANNOTATION_Z_INDEX,
|
2767
2797
|
regionRelative: true,
|
2768
|
-
offsetX,
|
2769
|
-
offsetY,
|
2770
2798
|
positions: (data, context)=>{
|
2771
2799
|
const positionData = data.filter((item)=>selectedData.some((datum)=>isSubset(datum, item)));
|
2772
2800
|
const xyList = positionData.map((datum)=>context.dataToPosition(datum));
|
@@ -3006,13 +3034,14 @@ const pivotIndicators_pivotIndicators = (chartPipeline)=>(spec, context)=>{
|
|
3006
3034
|
...spec
|
3007
3035
|
};
|
3008
3036
|
const { advancedVSeed } = context;
|
3009
|
-
const { measures, datasetReshapeInfo, encoding } = advancedVSeed;
|
3037
|
+
const { measures, datasetReshapeInfo, encoding, dataset } = advancedVSeed;
|
3010
3038
|
const colorItems = unique(datasetReshapeInfo.flatMap((d)=>d.unfoldInfo.colorItems));
|
3011
3039
|
const indicators = datasetReshapeInfo.map((reshapeInfo, index)=>{
|
3012
3040
|
const measure = measures?.find((d)=>d.id === reshapeInfo.id);
|
3013
3041
|
const newEncoding = [
|
3014
3042
|
encoding[index]
|
3015
3043
|
];
|
3044
|
+
const newDataset = dataset[index];
|
3016
3045
|
const newDatasetReshapeInfo = [
|
3017
3046
|
{
|
3018
3047
|
...reshapeInfo,
|
@@ -3027,6 +3056,7 @@ const pivotIndicators_pivotIndicators = (chartPipeline)=>(spec, context)=>{
|
|
3027
3056
|
advancedVSeed: {
|
3028
3057
|
...advancedVSeed,
|
3029
3058
|
datasetReshapeInfo: newDatasetReshapeInfo,
|
3059
|
+
dataset: newDataset,
|
3030
3060
|
encoding: newEncoding
|
3031
3061
|
}
|
3032
3062
|
};
|
@@ -3135,7 +3165,8 @@ const pivotDiscreteLegend = (spec, context)=>{
|
|
3135
3165
|
...cur.unfoldInfo.colorIdMap
|
3136
3166
|
}), {});
|
3137
3167
|
const { legend, color } = baseConfig;
|
3138
|
-
const { colorScheme } = color;
|
3168
|
+
const { colorScheme, colorMapping } = color;
|
3169
|
+
const colorSpecified = createSpecifiedForColorMapping(colorMapping, colorIdMap, colorItems);
|
3139
3170
|
const { enable, position = 'bottom', labelFontColor, labelFontSize = 12, labelFontWeight = 400, maxSize = 1, border, shapeType = 'rectRound' } = legend || {};
|
3140
3171
|
const orient = [
|
3141
3172
|
'bottom',
|
@@ -3182,17 +3213,20 @@ const pivotDiscreteLegend = (spec, context)=>{
|
|
3182
3213
|
position: legendPosition,
|
3183
3214
|
maxCol: Math.max(1, maxSize),
|
3184
3215
|
maxRow: Math.max(1, maxSize),
|
3185
|
-
data: colorItems.map((d, index)=>
|
3216
|
+
data: colorItems.map((d, index)=>{
|
3217
|
+
const color = colorSpecified?.[d] ?? colorScheme?.[index % colorScheme.length];
|
3218
|
+
return {
|
3186
3219
|
label: d,
|
3187
3220
|
shape: {
|
3188
3221
|
outerBorder: border ? {
|
3189
|
-
stroke:
|
3222
|
+
stroke: color,
|
3190
3223
|
distance: 3,
|
3191
3224
|
lineWidth: 1
|
3192
3225
|
} : void 0,
|
3193
|
-
fill:
|
3226
|
+
fill: color
|
3194
3227
|
}
|
3195
|
-
}
|
3228
|
+
};
|
3229
|
+
}),
|
3196
3230
|
item: {
|
3197
3231
|
focus: true,
|
3198
3232
|
maxWidth: '30%',
|
@@ -3542,7 +3576,7 @@ const barStyle_barStyle = (spec, context)=>{
|
|
3542
3576
|
barStyle
|
3543
3577
|
];
|
3544
3578
|
const customMap = barStyles.reduce((result, style, index)=>{
|
3545
|
-
const { barBorderColor, barBorderStyle, barBorderWidth = 1, barColor, barColorOpacity, barRadius } = style;
|
3579
|
+
const { barBorderColor, barBorderStyle, barBorderWidth = 1, barColor, barColorOpacity, barRadius, barVisible = true } = style;
|
3546
3580
|
const lineDash = 'dashed' === barBorderStyle ? [
|
3547
3581
|
5,
|
3548
3582
|
2
|
@@ -3562,6 +3596,7 @@ const barStyle_barStyle = (spec, context)=>{
|
|
3562
3596
|
return false;
|
3563
3597
|
},
|
3564
3598
|
style: {
|
3599
|
+
visible: barVisible,
|
3565
3600
|
fill: barColor,
|
3566
3601
|
fillOpacity: barColorOpacity,
|
3567
3602
|
cornerRadius: barRadius,
|
@@ -3603,14 +3638,12 @@ const annotationAreaBand = (spec, context)=>{
|
|
3603
3638
|
right: 'insideRight'
|
3604
3639
|
};
|
3605
3640
|
const markArea = annotationAreaList.flatMap((annotationArea)=>{
|
3606
|
-
const { selector: selectorPoint, text = '', textPosition = 'top', textColor = '#ffffff', textFontSize = 12, textFontWeight = 400, textAlign = 'center', textBaseline = 'top', textBackgroundVisible = true, textBackgroundColor = '#191d24', textBackgroundBorderColor = '#191d24', textBackgroundBorderWidth = 1, textBackgroundBorderRadius = 4, textBackgroundPadding = 4, areaColor = '#888888', areaColorOpacity = 0.15, areaBorderColor = '#888888', areaBorderRadius = 4, areaBorderWidth = 1, outerPadding = 4
|
3641
|
+
const { selector: selectorPoint, text = '', textPosition = 'top', textColor = '#ffffff', textFontSize = 12, textFontWeight = 400, textAlign = 'center', textBaseline = 'top', textBackgroundVisible = true, textBackgroundColor = '#191d24', textBackgroundBorderColor = '#191d24', textBackgroundBorderWidth = 1, textBackgroundBorderRadius = 4, textBackgroundPadding = 4, areaColor = '#888888', areaColorOpacity = 0.15, areaBorderColor = '#888888', areaBorderRadius = 4, areaBorderWidth = 1, outerPadding = 4 } = annotationArea;
|
3607
3642
|
const dataset = advancedVSeed.dataset.flat();
|
3608
3643
|
const selectedData = selectorPoint ? dataset.filter((datum)=>selector_selector(datum, selectorPoint)) : [];
|
3609
3644
|
return {
|
3610
3645
|
zIndex: ANNOTATION_Z_INDEX,
|
3611
3646
|
regionRelative: true,
|
3612
|
-
offsetX,
|
3613
|
-
offsetY,
|
3614
3647
|
positions: (data, context)=>{
|
3615
3648
|
const positionData = data.filter((item)=>selectedData.some((datum)=>isSubset(datum, item)));
|
3616
3649
|
const xyList = positionData.map((datum)=>context.dataToPosition(datum));
|
@@ -4542,7 +4575,12 @@ const areaStyle_areaStyle = (spec, context)=>{
|
|
4542
4575
|
const { advancedVSeed } = context;
|
4543
4576
|
const { markStyle, encoding, dataset } = advancedVSeed;
|
4544
4577
|
const { areaStyle } = markStyle;
|
4545
|
-
if (!areaStyle) return
|
4578
|
+
if (!areaStyle) return {
|
4579
|
+
...spec,
|
4580
|
+
area: {
|
4581
|
+
visible: true
|
4582
|
+
}
|
4583
|
+
};
|
4546
4584
|
const result = {
|
4547
4585
|
...spec
|
4548
4586
|
};
|
@@ -4550,19 +4588,20 @@ const areaStyle_areaStyle = (spec, context)=>{
|
|
4550
4588
|
areaStyle
|
4551
4589
|
];
|
4552
4590
|
const group = encoding[0]?.group?.[0];
|
4553
|
-
const
|
4591
|
+
const areaGroups = groupBy(dataset, (d)=>d[group ?? '']);
|
4554
4592
|
const customMap = areaStyles.reduce((result, style, index)=>{
|
4555
|
-
const { areaColor, areaColorOpacity } = style;
|
4593
|
+
const { areaColor, areaColorOpacity, areaVisible = true } = style;
|
4556
4594
|
return {
|
4557
4595
|
...result,
|
4558
4596
|
[`custom${index + 1}`]: {
|
4559
4597
|
level: index + 1,
|
4560
4598
|
filter: (datum)=>{
|
4561
|
-
const lineData =
|
4599
|
+
const lineData = areaGroups[datum[group ?? '']];
|
4562
4600
|
for (const d of lineData)if (selector_selector(d, style.selector)) return true;
|
4563
4601
|
return false;
|
4564
4602
|
},
|
4565
4603
|
style: {
|
4604
|
+
visible: areaVisible,
|
4566
4605
|
fill: areaColor,
|
4567
4606
|
fillOpacity: areaColorOpacity
|
4568
4607
|
}
|
@@ -4572,6 +4611,7 @@ const areaStyle_areaStyle = (spec, context)=>{
|
|
4572
4611
|
return {
|
4573
4612
|
...result,
|
4574
4613
|
area: {
|
4614
|
+
visible: true,
|
4575
4615
|
state: {
|
4576
4616
|
...customMap
|
4577
4617
|
}
|
@@ -5685,6 +5725,7 @@ const dualAxisConfig = (advancedVSeed, context)=>{
|
|
5685
5725
|
'legend',
|
5686
5726
|
'tooltip',
|
5687
5727
|
'dualChartType',
|
5728
|
+
'alignTicks',
|
5688
5729
|
'primaryYAxis',
|
5689
5730
|
'secondaryYAxis',
|
5690
5731
|
'crosshairLine'
|
@@ -5837,7 +5878,8 @@ const initDualAxisSecondary = (spec, context)=>{
|
|
5837
5878
|
};
|
5838
5879
|
const dualChartTypePrimary = (spec, context)=>{
|
5839
5880
|
const result = {
|
5840
|
-
...spec
|
5881
|
+
...spec,
|
5882
|
+
zIndex: DUAL_AXIS_CHART_NON_COLUMN_Z_INDEX
|
5841
5883
|
};
|
5842
5884
|
const { advancedVSeed, vseed } = context;
|
5843
5885
|
const { chartType } = vseed;
|
@@ -5848,12 +5890,16 @@ const dualChartTypePrimary = (spec, context)=>{
|
|
5848
5890
|
secondary: 'line'
|
5849
5891
|
};
|
5850
5892
|
const primary = Array.isArray(config) ? config[index].primary || config[0].primary : config.primary;
|
5851
|
-
|
5893
|
+
const secondary = Array.isArray(config) ? config[index].secondary || config[0].secondary : config.secondary;
|
5894
|
+
const bothColumn = 'column' === primary && 'column' === secondary;
|
5895
|
+
const type = bothColumn ? 'columnParallel' : primary;
|
5896
|
+
switch(type){
|
5852
5897
|
case 'line':
|
5853
5898
|
result.type = 'line';
|
5854
5899
|
break;
|
5855
5900
|
case 'column':
|
5856
5901
|
result.type = 'bar';
|
5902
|
+
result.zIndex = DUAL_AXIS_CHART_COLUMN_Z_INDEX;
|
5857
5903
|
break;
|
5858
5904
|
case 'columnParallel':
|
5859
5905
|
{
|
@@ -5864,6 +5910,7 @@ const dualChartTypePrimary = (spec, context)=>{
|
|
5864
5910
|
datasetReshapeInfo[0].unfoldInfo.groupId
|
5865
5911
|
];
|
5866
5912
|
columnSpec.type = 'bar';
|
5913
|
+
result.zIndex = DUAL_AXIS_CHART_COLUMN_Z_INDEX;
|
5867
5914
|
break;
|
5868
5915
|
}
|
5869
5916
|
case 'columnPercent':
|
@@ -5887,7 +5934,8 @@ const dualChartTypePrimary = (spec, context)=>{
|
|
5887
5934
|
};
|
5888
5935
|
const dualChartTypeSecondary = (spec, context)=>{
|
5889
5936
|
const result = {
|
5890
|
-
...spec
|
5937
|
+
...spec,
|
5938
|
+
zIndex: DUAL_AXIS_CHART_NON_COLUMN_Z_INDEX
|
5891
5939
|
};
|
5892
5940
|
const { advancedVSeed, vseed } = context;
|
5893
5941
|
const { chartType } = vseed;
|
@@ -5897,13 +5945,17 @@ const dualChartTypeSecondary = (spec, context)=>{
|
|
5897
5945
|
secondary: 'line'
|
5898
5946
|
};
|
5899
5947
|
const index = datasetReshapeInfo[0].index;
|
5948
|
+
const primary = Array.isArray(config) ? config[index].primary || config[0].primary : config.primary;
|
5900
5949
|
const secondary = Array.isArray(config) ? config[index].secondary || config[0].secondary : config.secondary;
|
5901
|
-
|
5950
|
+
const bothColumn = 'column' === primary && 'column' === secondary;
|
5951
|
+
const type = bothColumn ? 'columnParallel' : secondary;
|
5952
|
+
switch(type){
|
5902
5953
|
case 'line':
|
5903
5954
|
result.type = 'line';
|
5904
5955
|
break;
|
5905
5956
|
case 'column':
|
5906
5957
|
result.type = 'bar';
|
5958
|
+
result.zIndex = DUAL_AXIS_CHART_COLUMN_Z_INDEX;
|
5907
5959
|
break;
|
5908
5960
|
case 'columnParallel':
|
5909
5961
|
{
|
@@ -5914,6 +5966,7 @@ const dualChartTypeSecondary = (spec, context)=>{
|
|
5914
5966
|
datasetReshapeInfo[0].unfoldInfo.groupId
|
5915
5967
|
];
|
5916
5968
|
columnSpec.type = 'bar';
|
5969
|
+
result.zIndex = DUAL_AXIS_CHART_COLUMN_Z_INDEX;
|
5917
5970
|
break;
|
5918
5971
|
}
|
5919
5972
|
case 'columnPercent':
|
@@ -6252,12 +6305,18 @@ const yLinearPrimary = (spec, context)=>{
|
|
6252
6305
|
const { locale, datasetReshapeInfo } = advancedVSeed;
|
6253
6306
|
const index = datasetReshapeInfo[0].index;
|
6254
6307
|
const primaryYAxis = advancedVSeed.config?.[chartType]?.primaryYAxis;
|
6255
|
-
const
|
6308
|
+
const yAxisConfig = Array.isArray(primaryYAxis) ? primaryYAxis[index] || primaryYAxis[0] : primaryYAxis;
|
6309
|
+
const alignTicks = advancedVSeed.config?.[chartType]?.alignTicks;
|
6310
|
+
const alignTicksConfig = Array.isArray(alignTicks) ? alignTicks[index] || alignTicks[0] : alignTicks;
|
6256
6311
|
if (datasetReshapeInfo[0].foldInfoList?.[0] && isEmpty(datasetReshapeInfo[0].foldInfoList[0].foldMap)) return result;
|
6257
6312
|
const id = `${datasetReshapeInfo[0].id}-primary-axis`;
|
6258
|
-
const
|
6313
|
+
const seriesIds = [
|
6314
|
+
`${datasetReshapeInfo[0].id}-primary-series`,
|
6315
|
+
`${datasetReshapeInfo[0].id}-secondary-series`
|
6316
|
+
];
|
6317
|
+
const seriesId = alignTicksConfig ? seriesIds : seriesIds[0];
|
6259
6318
|
if (!result.axes) result.axes = [];
|
6260
|
-
if (!
|
6319
|
+
if (!yAxisConfig) {
|
6261
6320
|
result.axes = [
|
6262
6321
|
...result.axes,
|
6263
6322
|
{
|
@@ -6265,26 +6324,16 @@ const yLinearPrimary = (spec, context)=>{
|
|
6265
6324
|
id,
|
6266
6325
|
seriesId,
|
6267
6326
|
type: 'linear',
|
6268
|
-
orient: 'left'
|
6269
|
-
sync: {
|
6270
|
-
axisId: `${datasetReshapeInfo[0].id}-secondary-axis`,
|
6271
|
-
tickAlign: false,
|
6272
|
-
zeroAlign: true
|
6273
|
-
}
|
6327
|
+
orient: 'left'
|
6274
6328
|
}
|
6275
6329
|
];
|
6276
6330
|
return result;
|
6277
6331
|
}
|
6278
|
-
const { visible = true, label, tick, title, grid, line, zero, nice, inverse, max, min, log, logBase = 10 } =
|
6332
|
+
const { visible = true, label, tick, title, grid, line, zero, nice, inverse, max, min, log, logBase = 10 } = yAxisConfig;
|
6279
6333
|
const linearAxis = {
|
6280
6334
|
visible,
|
6281
6335
|
id,
|
6282
6336
|
seriesId,
|
6283
|
-
sync: {
|
6284
|
-
axisId: `${datasetReshapeInfo[0].id}-secondary-axis`,
|
6285
|
-
tickAlign: false,
|
6286
|
-
zeroAlign: true
|
6287
|
-
},
|
6288
6337
|
type: log ? 'log' : 'linear',
|
6289
6338
|
base: logBase,
|
6290
6339
|
orient: 'left',
|
@@ -6353,12 +6402,22 @@ const yLinearSecondary = (spec, context)=>{
|
|
6353
6402
|
const { locale, datasetReshapeInfo } = advancedVSeed;
|
6354
6403
|
const index = datasetReshapeInfo[0].index;
|
6355
6404
|
const secondaryYAxis = advancedVSeed.config?.[chartType]?.secondaryYAxis;
|
6356
|
-
const
|
6405
|
+
const yAxisConfig = Array.isArray(secondaryYAxis) ? secondaryYAxis[index] || secondaryYAxis[0] : secondaryYAxis;
|
6406
|
+
const alignTicks = advancedVSeed.config?.[chartType]?.alignTicks;
|
6407
|
+
const alignTicksConfig = Array.isArray(alignTicks) ? alignTicks[index] || alignTicks[0] : alignTicks;
|
6357
6408
|
if (isNullish(datasetReshapeInfo[0].foldInfoList?.[1])) return result;
|
6409
|
+
const sync = {
|
6410
|
+
axisId: `${datasetReshapeInfo[0].id}-primary-axis`,
|
6411
|
+
zeroAlign: true
|
6412
|
+
};
|
6358
6413
|
const id = `${datasetReshapeInfo[0].id}-secondary-axis`;
|
6359
|
-
const
|
6414
|
+
const seriesIds = [
|
6415
|
+
`${datasetReshapeInfo[0].id}-primary-series`,
|
6416
|
+
`${datasetReshapeInfo[0].id}-secondary-series`
|
6417
|
+
];
|
6418
|
+
const seriesId = alignTicksConfig ? seriesIds : seriesIds[1];
|
6360
6419
|
if (!result.axes) result.axes = [];
|
6361
|
-
if (!
|
6420
|
+
if (!yAxisConfig) {
|
6362
6421
|
result.axes = [
|
6363
6422
|
...result.axes,
|
6364
6423
|
{
|
@@ -6366,16 +6425,18 @@ const yLinearSecondary = (spec, context)=>{
|
|
6366
6425
|
id,
|
6367
6426
|
seriesId,
|
6368
6427
|
type: 'linear',
|
6369
|
-
orient: 'right'
|
6428
|
+
orient: 'right',
|
6429
|
+
sync
|
6370
6430
|
}
|
6371
6431
|
];
|
6372
6432
|
return result;
|
6373
6433
|
}
|
6374
|
-
const { visible = true, label, tick, title, grid, line, zero, nice, inverse, max, min, log, logBase = 10 } =
|
6434
|
+
const { visible = true, label, tick, title, grid, line, zero, nice, inverse, max, min, log, logBase = 10 } = yAxisConfig;
|
6375
6435
|
const linearAxis = {
|
6376
6436
|
visible,
|
6377
6437
|
id,
|
6378
6438
|
seriesId,
|
6439
|
+
sync,
|
6379
6440
|
type: log ? 'log' : 'linear',
|
6380
6441
|
base: logBase,
|
6381
6442
|
orient: 'right',
|
@@ -6479,7 +6540,7 @@ const pivotDualAxis = [
|
|
6479
6540
|
pivotIndicators_pivotIndicatorsAsRow,
|
6480
6541
|
datasetPivot,
|
6481
6542
|
pivotIndicators_pivotIndicators([
|
6482
|
-
|
6543
|
+
series([
|
6483
6544
|
initDualAxisPrimary,
|
6484
6545
|
dualChartTypePrimary,
|
6485
6546
|
datasetPrimary,
|
@@ -8842,6 +8903,7 @@ const zDualAxisConfig = z.object({
|
|
8842
8903
|
tooltip: zTooltip.nullish(),
|
8843
8904
|
legend: zLegend.nullish(),
|
8844
8905
|
dualChartType: z.array(zDualChartType).or(zDualChartType).nullish(),
|
8906
|
+
alignTicks: z.array(z.boolean()).or(z.boolean()).nullish(),
|
8845
8907
|
primaryYAxis: z.array(zYLinearAxis).or(zYLinearAxis).nullish(),
|
8846
8908
|
secondaryYAxis: z.array(zYLinearAxis).or(zYLinearAxis).nullish(),
|
8847
8909
|
xAxis: zXBandAxis.nullish(),
|
@@ -9014,6 +9076,7 @@ const zBarStyle = z.object({
|
|
9014
9076
|
zSelector,
|
9015
9077
|
zSelectors
|
9016
9078
|
]).nullish(),
|
9079
|
+
barVisible: z.boolean().nullish(),
|
9017
9080
|
barColor: z.string().nullish(),
|
9018
9081
|
barColorOpacity: z.number().nullish(),
|
9019
9082
|
barBorderColor: z.string().nullish(),
|
@@ -9033,6 +9096,7 @@ const zPointStyle = z.object({
|
|
9033
9096
|
zSelector,
|
9034
9097
|
zSelectors
|
9035
9098
|
]).nullish(),
|
9099
|
+
pointVisible: z.boolean().nullish(),
|
9036
9100
|
pointSize: z.number().nullish(),
|
9037
9101
|
pointColor: z.string().nullish(),
|
9038
9102
|
pointColorOpacity: z.number().nullish(),
|
@@ -9051,6 +9115,7 @@ const zLineStyle = z.object({
|
|
9051
9115
|
zSelector,
|
9052
9116
|
zSelectors
|
9053
9117
|
]).nullish(),
|
9118
|
+
lineVisible: z.boolean().nullish(),
|
9054
9119
|
lineSmooth: z.boolean().nullish(),
|
9055
9120
|
lineColor: z.string().nullish(),
|
9056
9121
|
lineColorOpacity: z.number().nullish(),
|
@@ -9068,6 +9133,7 @@ const zAreaStyle = z.object({
|
|
9068
9133
|
zSelector,
|
9069
9134
|
zSelectors
|
9070
9135
|
]).nullish(),
|
9136
|
+
areaVisible: z.boolean().nullish(),
|
9071
9137
|
areaColor: z.string().nullish(),
|
9072
9138
|
areaColorOpacity: z.number().nullish()
|
9073
9139
|
});
|
@@ -9153,9 +9219,7 @@ const zAnnotationVerticalLine = z.object({
|
|
9153
9219
|
z.literal('solid'),
|
9154
9220
|
z.literal('dashed'),
|
9155
9221
|
z.literal('dotted')
|
9156
|
-
]).default('dashed').nullish()
|
9157
|
-
offsetX: z.number().default(0),
|
9158
|
-
offsetY: z.number().default(0)
|
9222
|
+
]).default('dashed').nullish()
|
9159
9223
|
});
|
9160
9224
|
const zAnnotationHorizontalLine = z.object({
|
9161
9225
|
selector: z.union([
|
@@ -9205,9 +9269,7 @@ const zAnnotationHorizontalLine = z.object({
|
|
9205
9269
|
textBackgroundBorderColor: z.string().default('#212121').nullish(),
|
9206
9270
|
textBackgroundBorderRadius: z.number().default(4).nullish(),
|
9207
9271
|
textBackgroundBorderWidth: z.number().default(1).nullish(),
|
9208
|
-
textBackgroundPadding: z.number().default(2).nullish()
|
9209
|
-
offsetX: z.number().default(0),
|
9210
|
-
offsetY: z.number().default(0)
|
9272
|
+
textBackgroundPadding: z.number().default(2).nullish()
|
9211
9273
|
});
|
9212
9274
|
const zAnnotationArea = z.object({
|
9213
9275
|
selector: z.union([
|
@@ -9249,9 +9311,7 @@ const zAnnotationArea = z.object({
|
|
9249
9311
|
areaBorderColor: z.string().default('#888888').nullish(),
|
9250
9312
|
areaBorderWidth: z.number().default(1).nullish(),
|
9251
9313
|
areaBorderRadius: z.number().default(4).nullish(),
|
9252
|
-
outerPadding: z.number().default(4).nullish()
|
9253
|
-
offsetX: z.number().default(0).nullish(),
|
9254
|
-
offsetY: z.number().default(0).nullish()
|
9314
|
+
outerPadding: z.number().default(4).nullish()
|
9255
9315
|
});
|
9256
9316
|
const zAnnotation = z.object({
|
9257
9317
|
annotationPoint: zAnnotationPoint.or(z.array(zAnnotationPoint)).nullish(),
|
@@ -9576,6 +9636,7 @@ const zDualAxis = z.object({
|
|
9576
9636
|
measures: zMeasureTree.nullish(),
|
9577
9637
|
dualMeasures: zDualMeasures.nullish(),
|
9578
9638
|
dualChartType: z.array(zDualChartType).or(zDualChartType).nullish(),
|
9639
|
+
alignTicks: z.array(z.boolean()).or(z.boolean()).nullish(),
|
9579
9640
|
primaryYAxis: z.array(zYLinearAxis).or(zYLinearAxis).nullish(),
|
9580
9641
|
secondaryYAxis: z.array(zYLinearAxis).or(zYLinearAxis).nullish(),
|
9581
9642
|
xAxis: zXBandAxis.nullish(),
|