@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.cjs
CHANGED
@@ -1085,6 +1085,9 @@ const initPivotTable = (spec, context)=>{
|
|
1085
1085
|
tooltip: {
|
1086
1086
|
isShowOverflowTextTooltip: true
|
1087
1087
|
},
|
1088
|
+
corner: {
|
1089
|
+
titleOnDimension: 'all'
|
1090
|
+
},
|
1088
1091
|
widthAdaptiveMode: 'all',
|
1089
1092
|
animationAppear: {
|
1090
1093
|
duration: 300,
|
@@ -1947,22 +1950,44 @@ const color_color = (spec, context)=>{
|
|
1947
1950
|
const colorIdMap = unfoldInfo.colorIdMap;
|
1948
1951
|
const { color } = baseConfig;
|
1949
1952
|
const { colorScheme, colorMapping } = color;
|
1950
|
-
const mappingList = [];
|
1951
|
-
if (colorMapping) Object.entries(colorMapping).sort((a, b)=>a[0].split(Separator).length - b[0].split(Separator).length).forEach(([key, value])=>{
|
1952
|
-
const idMap = Object.entries(colorIdMap).filter(([_, v])=>v.includes(key));
|
1953
|
-
for (const [colorId] of idMap)mappingList.push([
|
1954
|
-
colorId,
|
1955
|
-
value
|
1956
|
-
]);
|
1957
|
-
});
|
1958
1953
|
result.color = {
|
1959
1954
|
type: 'ordinal',
|
1960
1955
|
domain: colorItems,
|
1961
1956
|
range: colorScheme,
|
1962
|
-
specified:
|
1957
|
+
specified: createSpecifiedForColorMapping(colorMapping, colorIdMap, colorItems)
|
1963
1958
|
};
|
1964
1959
|
return result;
|
1965
1960
|
};
|
1961
|
+
const createSpecifiedForColorMapping = (colorMapping, colorIdMap, colorItems)=>{
|
1962
|
+
if (!colorMapping || !colorIdMap || !colorItems) return;
|
1963
|
+
const matchedList = [];
|
1964
|
+
const colors = Object.entries(colorMapping).sort((a, b)=>b[0].length - a[0].length);
|
1965
|
+
const accurateMap = colors.reduce((prev, cur)=>{
|
1966
|
+
const name = cur[0];
|
1967
|
+
const colorValue = cur[1];
|
1968
|
+
const accurateMatchedList = Object.entries(colorIdMap).filter(([colorKey, colorAlias])=>colorKey === name || colorAlias === name);
|
1969
|
+
accurateMatchedList.forEach((item)=>{
|
1970
|
+
prev[item[0]] = colorValue;
|
1971
|
+
matchedList.push(name);
|
1972
|
+
});
|
1973
|
+
return prev;
|
1974
|
+
}, {});
|
1975
|
+
const fuzzyMap = colors.reduce((prev, cur)=>{
|
1976
|
+
const name = cur[0];
|
1977
|
+
const colorValue = cur[1];
|
1978
|
+
if (matchedList.includes(name)) return prev;
|
1979
|
+
const fuzzyMatchedList = Object.entries(colorIdMap).filter(([colorKey, colorAlias])=>colorKey.includes(name) || colorAlias.includes(name));
|
1980
|
+
fuzzyMatchedList.forEach((item)=>{
|
1981
|
+
if (prev[item[0]]) return;
|
1982
|
+
prev[item[0]] = colorValue;
|
1983
|
+
});
|
1984
|
+
return prev;
|
1985
|
+
}, {});
|
1986
|
+
return {
|
1987
|
+
...fuzzyMap,
|
1988
|
+
...accurateMap
|
1989
|
+
};
|
1990
|
+
};
|
1966
1991
|
const background_backgroundColor = (spec, context)=>{
|
1967
1992
|
const result = {
|
1968
1993
|
...spec
|
@@ -2129,6 +2154,8 @@ const xBand = (spec, context)=>{
|
|
2129
2154
|
};
|
2130
2155
|
const ANNOTATION_Z_INDEX = 1000;
|
2131
2156
|
const LINEAR_AXIS_INNER_OFFSET_TOP = 7;
|
2157
|
+
const DUAL_AXIS_CHART_COLUMN_Z_INDEX = 1000;
|
2158
|
+
const DUAL_AXIS_CHART_NON_COLUMN_Z_INDEX = 1001;
|
2132
2159
|
const yLinear = (spec, context)=>{
|
2133
2160
|
const result = {
|
2134
2161
|
...spec
|
@@ -2570,7 +2597,7 @@ const pointStyle_pointStyle = (spec, context)=>{
|
|
2570
2597
|
pointStyle
|
2571
2598
|
];
|
2572
2599
|
const customMap = pointStyles.reduce((result, style, index)=>{
|
2573
|
-
const { pointBorderColor, pointBorderStyle, pointBorderWidth = 1, pointColor, pointColorOpacity, pointSize } = style;
|
2600
|
+
const { pointBorderColor, pointBorderStyle, pointBorderWidth = 1, pointColor, pointColorOpacity, pointSize, pointVisible = true } = style;
|
2574
2601
|
const lineDash = 'dashed' === pointBorderStyle ? [
|
2575
2602
|
5,
|
2576
2603
|
2
|
@@ -2590,6 +2617,7 @@ const pointStyle_pointStyle = (spec, context)=>{
|
|
2590
2617
|
return false;
|
2591
2618
|
},
|
2592
2619
|
style: {
|
2620
|
+
visible: pointVisible,
|
2593
2621
|
size: pointSize,
|
2594
2622
|
fill: pointColor,
|
2595
2623
|
fillOpacity: pointColorOpacity,
|
@@ -2622,7 +2650,12 @@ const pointStateDimensionHover = (spec)=>{
|
|
2622
2650
|
...point.state || {},
|
2623
2651
|
dimension_hover: {
|
2624
2652
|
scaleX: 1.4,
|
2625
|
-
scaleY: 1.4
|
2653
|
+
scaleY: 1.4,
|
2654
|
+
outerBorder: {
|
2655
|
+
lineWidth: 4,
|
2656
|
+
strokeOpacity: 0.25,
|
2657
|
+
distance: 2
|
2658
|
+
}
|
2626
2659
|
}
|
2627
2660
|
}
|
2628
2661
|
}
|
@@ -2669,9 +2702,9 @@ const lineStyle_lineStyle = (spec, context)=>{
|
|
2669
2702
|
const group = encoding[0]?.group?.[0];
|
2670
2703
|
const lineGroups = (0, external_remeda_namespaceObject.groupBy)(dataset, (d)=>d[group ?? '']);
|
2671
2704
|
const customMap = lineStyles.reduce((result, style, index)=>{
|
2672
|
-
const { lineColor, lineColorOpacity, lineSmooth, lineStyle, lineWidth } = style;
|
2673
|
-
const dashSegment =
|
2674
|
-
const dashGap = lineWidth
|
2705
|
+
const { lineColor, lineColorOpacity, lineSmooth, lineStyle, lineWidth = 2, lineVisible = true } = style;
|
2706
|
+
const dashSegment = 2 * lineWidth;
|
2707
|
+
const dashGap = lineWidth;
|
2675
2708
|
const lineDash = 'dashed' === lineStyle ? [
|
2676
2709
|
dashSegment,
|
2677
2710
|
dashSegment
|
@@ -2693,6 +2726,7 @@ const lineStyle_lineStyle = (spec, context)=>{
|
|
2693
2726
|
return false;
|
2694
2727
|
},
|
2695
2728
|
style: {
|
2729
|
+
visible: lineVisible,
|
2696
2730
|
curveType: curveType,
|
2697
2731
|
strokeOpacity: lineColorOpacity,
|
2698
2732
|
stroke: lineColor,
|
@@ -2797,13 +2831,11 @@ const annotationVerticalLine_annotationVerticalLine = (spec, context)=>{
|
|
2797
2831
|
insideEnd: 'insideEndTop'
|
2798
2832
|
};
|
2799
2833
|
const markLine = annotationVerticalLineList.flatMap((annotationVerticalLine)=>{
|
2800
|
-
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'
|
2834
|
+
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;
|
2801
2835
|
const dataset = advancedVSeed.dataset.flat();
|
2802
2836
|
const generateOneMarkLine = (x)=>({
|
2803
2837
|
x: x,
|
2804
2838
|
zIndex: ANNOTATION_Z_INDEX,
|
2805
|
-
offsetX,
|
2806
|
-
offsetY,
|
2807
2839
|
line: {
|
2808
2840
|
style: {
|
2809
2841
|
visible: lineVisible,
|
@@ -2896,12 +2928,10 @@ const annotationHorizontalLine_annotationHorizontalLine = (spec, context)=>{
|
|
2896
2928
|
insideEnd: 'insideEndTop'
|
2897
2929
|
};
|
2898
2930
|
const markLine = annotationVerticalLineList.flatMap((annotationVerticalLine)=>{
|
2899
|
-
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
|
2931
|
+
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;
|
2900
2932
|
const dataset = advancedVSeed.dataset.flat();
|
2901
2933
|
const generateOneMarkLine = (y)=>({
|
2902
2934
|
y,
|
2903
|
-
offsetX,
|
2904
|
-
offsetY,
|
2905
2935
|
zIndex: ANNOTATION_Z_INDEX,
|
2906
2936
|
line: {
|
2907
2937
|
style: {
|
@@ -2997,7 +3027,7 @@ const annotationArea_annotationArea = (spec, context)=>{
|
|
2997
3027
|
right: 'insideRight'
|
2998
3028
|
};
|
2999
3029
|
const markArea = annotationAreaList.flatMap((annotationArea)=>{
|
3000
|
-
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
|
3030
|
+
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;
|
3001
3031
|
const dataset = advancedVSeed.dataset.flat();
|
3002
3032
|
const selectedData = selectorPoint ? dataset.filter((datum)=>selector_selector(datum, selectorPoint)) : [];
|
3003
3033
|
const labelPosition = positionMap[textPosition || 'top'];
|
@@ -3005,8 +3035,6 @@ const annotationArea_annotationArea = (spec, context)=>{
|
|
3005
3035
|
return {
|
3006
3036
|
zIndex: ANNOTATION_Z_INDEX,
|
3007
3037
|
regionRelative: true,
|
3008
|
-
offsetX,
|
3009
|
-
offsetY,
|
3010
3038
|
positions: (data, context)=>{
|
3011
3039
|
const positionData = data.filter((item)=>selectedData.some((datum)=>isSubset(datum, item)));
|
3012
3040
|
const xyList = positionData.map((datum)=>context.dataToPosition(datum));
|
@@ -3246,13 +3274,14 @@ const pivotIndicators_pivotIndicators = (chartPipeline)=>(spec, context)=>{
|
|
3246
3274
|
...spec
|
3247
3275
|
};
|
3248
3276
|
const { advancedVSeed } = context;
|
3249
|
-
const { measures, datasetReshapeInfo, encoding } = advancedVSeed;
|
3277
|
+
const { measures, datasetReshapeInfo, encoding, dataset } = advancedVSeed;
|
3250
3278
|
const colorItems = (0, external_remeda_namespaceObject.unique)(datasetReshapeInfo.flatMap((d)=>d.unfoldInfo.colorItems));
|
3251
3279
|
const indicators = datasetReshapeInfo.map((reshapeInfo, index)=>{
|
3252
3280
|
const measure = measures?.find((d)=>d.id === reshapeInfo.id);
|
3253
3281
|
const newEncoding = [
|
3254
3282
|
encoding[index]
|
3255
3283
|
];
|
3284
|
+
const newDataset = dataset[index];
|
3256
3285
|
const newDatasetReshapeInfo = [
|
3257
3286
|
{
|
3258
3287
|
...reshapeInfo,
|
@@ -3267,6 +3296,7 @@ const pivotIndicators_pivotIndicators = (chartPipeline)=>(spec, context)=>{
|
|
3267
3296
|
advancedVSeed: {
|
3268
3297
|
...advancedVSeed,
|
3269
3298
|
datasetReshapeInfo: newDatasetReshapeInfo,
|
3299
|
+
dataset: newDataset,
|
3270
3300
|
encoding: newEncoding
|
3271
3301
|
}
|
3272
3302
|
};
|
@@ -3375,7 +3405,8 @@ const pivotDiscreteLegend = (spec, context)=>{
|
|
3375
3405
|
...cur.unfoldInfo.colorIdMap
|
3376
3406
|
}), {});
|
3377
3407
|
const { legend, color } = baseConfig;
|
3378
|
-
const { colorScheme } = color;
|
3408
|
+
const { colorScheme, colorMapping } = color;
|
3409
|
+
const colorSpecified = createSpecifiedForColorMapping(colorMapping, colorIdMap, colorItems);
|
3379
3410
|
const { enable, position = 'bottom', labelFontColor, labelFontSize = 12, labelFontWeight = 400, maxSize = 1, border, shapeType = 'rectRound' } = legend || {};
|
3380
3411
|
const orient = [
|
3381
3412
|
'bottom',
|
@@ -3422,17 +3453,20 @@ const pivotDiscreteLegend = (spec, context)=>{
|
|
3422
3453
|
position: legendPosition,
|
3423
3454
|
maxCol: Math.max(1, maxSize),
|
3424
3455
|
maxRow: Math.max(1, maxSize),
|
3425
|
-
data: colorItems.map((d, index)=>
|
3456
|
+
data: colorItems.map((d, index)=>{
|
3457
|
+
const color = colorSpecified?.[d] ?? colorScheme?.[index % colorScheme.length];
|
3458
|
+
return {
|
3426
3459
|
label: d,
|
3427
3460
|
shape: {
|
3428
3461
|
outerBorder: border ? {
|
3429
|
-
stroke:
|
3462
|
+
stroke: color,
|
3430
3463
|
distance: 3,
|
3431
3464
|
lineWidth: 1
|
3432
3465
|
} : void 0,
|
3433
|
-
fill:
|
3466
|
+
fill: color
|
3434
3467
|
}
|
3435
|
-
}
|
3468
|
+
};
|
3469
|
+
}),
|
3436
3470
|
item: {
|
3437
3471
|
focus: true,
|
3438
3472
|
maxWidth: '30%',
|
@@ -3782,7 +3816,7 @@ const barStyle_barStyle = (spec, context)=>{
|
|
3782
3816
|
barStyle
|
3783
3817
|
];
|
3784
3818
|
const customMap = barStyles.reduce((result, style, index)=>{
|
3785
|
-
const { barBorderColor, barBorderStyle, barBorderWidth = 1, barColor, barColorOpacity, barRadius } = style;
|
3819
|
+
const { barBorderColor, barBorderStyle, barBorderWidth = 1, barColor, barColorOpacity, barRadius, barVisible = true } = style;
|
3786
3820
|
const lineDash = 'dashed' === barBorderStyle ? [
|
3787
3821
|
5,
|
3788
3822
|
2
|
@@ -3802,6 +3836,7 @@ const barStyle_barStyle = (spec, context)=>{
|
|
3802
3836
|
return false;
|
3803
3837
|
},
|
3804
3838
|
style: {
|
3839
|
+
visible: barVisible,
|
3805
3840
|
fill: barColor,
|
3806
3841
|
fillOpacity: barColorOpacity,
|
3807
3842
|
cornerRadius: barRadius,
|
@@ -3843,14 +3878,12 @@ const annotationAreaBand = (spec, context)=>{
|
|
3843
3878
|
right: 'insideRight'
|
3844
3879
|
};
|
3845
3880
|
const markArea = annotationAreaList.flatMap((annotationArea)=>{
|
3846
|
-
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
|
3881
|
+
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;
|
3847
3882
|
const dataset = advancedVSeed.dataset.flat();
|
3848
3883
|
const selectedData = selectorPoint ? dataset.filter((datum)=>selector_selector(datum, selectorPoint)) : [];
|
3849
3884
|
return {
|
3850
3885
|
zIndex: ANNOTATION_Z_INDEX,
|
3851
3886
|
regionRelative: true,
|
3852
|
-
offsetX,
|
3853
|
-
offsetY,
|
3854
3887
|
positions: (data, context)=>{
|
3855
3888
|
const positionData = data.filter((item)=>selectedData.some((datum)=>isSubset(datum, item)));
|
3856
3889
|
const xyList = positionData.map((datum)=>context.dataToPosition(datum));
|
@@ -4782,7 +4815,12 @@ const areaStyle_areaStyle = (spec, context)=>{
|
|
4782
4815
|
const { advancedVSeed } = context;
|
4783
4816
|
const { markStyle, encoding, dataset } = advancedVSeed;
|
4784
4817
|
const { areaStyle } = markStyle;
|
4785
|
-
if (!areaStyle) return
|
4818
|
+
if (!areaStyle) return {
|
4819
|
+
...spec,
|
4820
|
+
area: {
|
4821
|
+
visible: true
|
4822
|
+
}
|
4823
|
+
};
|
4786
4824
|
const result = {
|
4787
4825
|
...spec
|
4788
4826
|
};
|
@@ -4790,19 +4828,20 @@ const areaStyle_areaStyle = (spec, context)=>{
|
|
4790
4828
|
areaStyle
|
4791
4829
|
];
|
4792
4830
|
const group = encoding[0]?.group?.[0];
|
4793
|
-
const
|
4831
|
+
const areaGroups = (0, external_remeda_namespaceObject.groupBy)(dataset, (d)=>d[group ?? '']);
|
4794
4832
|
const customMap = areaStyles.reduce((result, style, index)=>{
|
4795
|
-
const { areaColor, areaColorOpacity } = style;
|
4833
|
+
const { areaColor, areaColorOpacity, areaVisible = true } = style;
|
4796
4834
|
return {
|
4797
4835
|
...result,
|
4798
4836
|
[`custom${index + 1}`]: {
|
4799
4837
|
level: index + 1,
|
4800
4838
|
filter: (datum)=>{
|
4801
|
-
const lineData =
|
4839
|
+
const lineData = areaGroups[datum[group ?? '']];
|
4802
4840
|
for (const d of lineData)if (selector_selector(d, style.selector)) return true;
|
4803
4841
|
return false;
|
4804
4842
|
},
|
4805
4843
|
style: {
|
4844
|
+
visible: areaVisible,
|
4806
4845
|
fill: areaColor,
|
4807
4846
|
fillOpacity: areaColorOpacity
|
4808
4847
|
}
|
@@ -4812,6 +4851,7 @@ const areaStyle_areaStyle = (spec, context)=>{
|
|
4812
4851
|
return {
|
4813
4852
|
...result,
|
4814
4853
|
area: {
|
4854
|
+
visible: true,
|
4815
4855
|
state: {
|
4816
4856
|
...customMap
|
4817
4857
|
}
|
@@ -5925,6 +5965,7 @@ const dualAxisConfig = (advancedVSeed, context)=>{
|
|
5925
5965
|
'legend',
|
5926
5966
|
'tooltip',
|
5927
5967
|
'dualChartType',
|
5968
|
+
'alignTicks',
|
5928
5969
|
'primaryYAxis',
|
5929
5970
|
'secondaryYAxis',
|
5930
5971
|
'crosshairLine'
|
@@ -6077,7 +6118,8 @@ const initDualAxisSecondary = (spec, context)=>{
|
|
6077
6118
|
};
|
6078
6119
|
const dualChartTypePrimary = (spec, context)=>{
|
6079
6120
|
const result = {
|
6080
|
-
...spec
|
6121
|
+
...spec,
|
6122
|
+
zIndex: DUAL_AXIS_CHART_NON_COLUMN_Z_INDEX
|
6081
6123
|
};
|
6082
6124
|
const { advancedVSeed, vseed } = context;
|
6083
6125
|
const { chartType } = vseed;
|
@@ -6088,12 +6130,16 @@ const dualChartTypePrimary = (spec, context)=>{
|
|
6088
6130
|
secondary: 'line'
|
6089
6131
|
};
|
6090
6132
|
const primary = Array.isArray(config) ? config[index].primary || config[0].primary : config.primary;
|
6091
|
-
|
6133
|
+
const secondary = Array.isArray(config) ? config[index].secondary || config[0].secondary : config.secondary;
|
6134
|
+
const bothColumn = 'column' === primary && 'column' === secondary;
|
6135
|
+
const type = bothColumn ? 'columnParallel' : primary;
|
6136
|
+
switch(type){
|
6092
6137
|
case 'line':
|
6093
6138
|
result.type = 'line';
|
6094
6139
|
break;
|
6095
6140
|
case 'column':
|
6096
6141
|
result.type = 'bar';
|
6142
|
+
result.zIndex = DUAL_AXIS_CHART_COLUMN_Z_INDEX;
|
6097
6143
|
break;
|
6098
6144
|
case 'columnParallel':
|
6099
6145
|
{
|
@@ -6104,6 +6150,7 @@ const dualChartTypePrimary = (spec, context)=>{
|
|
6104
6150
|
datasetReshapeInfo[0].unfoldInfo.groupId
|
6105
6151
|
];
|
6106
6152
|
columnSpec.type = 'bar';
|
6153
|
+
result.zIndex = DUAL_AXIS_CHART_COLUMN_Z_INDEX;
|
6107
6154
|
break;
|
6108
6155
|
}
|
6109
6156
|
case 'columnPercent':
|
@@ -6127,7 +6174,8 @@ const dualChartTypePrimary = (spec, context)=>{
|
|
6127
6174
|
};
|
6128
6175
|
const dualChartTypeSecondary = (spec, context)=>{
|
6129
6176
|
const result = {
|
6130
|
-
...spec
|
6177
|
+
...spec,
|
6178
|
+
zIndex: DUAL_AXIS_CHART_NON_COLUMN_Z_INDEX
|
6131
6179
|
};
|
6132
6180
|
const { advancedVSeed, vseed } = context;
|
6133
6181
|
const { chartType } = vseed;
|
@@ -6137,13 +6185,17 @@ const dualChartTypeSecondary = (spec, context)=>{
|
|
6137
6185
|
secondary: 'line'
|
6138
6186
|
};
|
6139
6187
|
const index = datasetReshapeInfo[0].index;
|
6188
|
+
const primary = Array.isArray(config) ? config[index].primary || config[0].primary : config.primary;
|
6140
6189
|
const secondary = Array.isArray(config) ? config[index].secondary || config[0].secondary : config.secondary;
|
6141
|
-
|
6190
|
+
const bothColumn = 'column' === primary && 'column' === secondary;
|
6191
|
+
const type = bothColumn ? 'columnParallel' : secondary;
|
6192
|
+
switch(type){
|
6142
6193
|
case 'line':
|
6143
6194
|
result.type = 'line';
|
6144
6195
|
break;
|
6145
6196
|
case 'column':
|
6146
6197
|
result.type = 'bar';
|
6198
|
+
result.zIndex = DUAL_AXIS_CHART_COLUMN_Z_INDEX;
|
6147
6199
|
break;
|
6148
6200
|
case 'columnParallel':
|
6149
6201
|
{
|
@@ -6154,6 +6206,7 @@ const dualChartTypeSecondary = (spec, context)=>{
|
|
6154
6206
|
datasetReshapeInfo[0].unfoldInfo.groupId
|
6155
6207
|
];
|
6156
6208
|
columnSpec.type = 'bar';
|
6209
|
+
result.zIndex = DUAL_AXIS_CHART_COLUMN_Z_INDEX;
|
6157
6210
|
break;
|
6158
6211
|
}
|
6159
6212
|
case 'columnPercent':
|
@@ -6492,12 +6545,18 @@ const yLinearPrimary = (spec, context)=>{
|
|
6492
6545
|
const { locale, datasetReshapeInfo } = advancedVSeed;
|
6493
6546
|
const index = datasetReshapeInfo[0].index;
|
6494
6547
|
const primaryYAxis = advancedVSeed.config?.[chartType]?.primaryYAxis;
|
6495
|
-
const
|
6548
|
+
const yAxisConfig = Array.isArray(primaryYAxis) ? primaryYAxis[index] || primaryYAxis[0] : primaryYAxis;
|
6549
|
+
const alignTicks = advancedVSeed.config?.[chartType]?.alignTicks;
|
6550
|
+
const alignTicksConfig = Array.isArray(alignTicks) ? alignTicks[index] || alignTicks[0] : alignTicks;
|
6496
6551
|
if (datasetReshapeInfo[0].foldInfoList?.[0] && (0, external_remeda_namespaceObject.isEmpty)(datasetReshapeInfo[0].foldInfoList[0].foldMap)) return result;
|
6497
6552
|
const id = `${datasetReshapeInfo[0].id}-primary-axis`;
|
6498
|
-
const
|
6553
|
+
const seriesIds = [
|
6554
|
+
`${datasetReshapeInfo[0].id}-primary-series`,
|
6555
|
+
`${datasetReshapeInfo[0].id}-secondary-series`
|
6556
|
+
];
|
6557
|
+
const seriesId = alignTicksConfig ? seriesIds : seriesIds[0];
|
6499
6558
|
if (!result.axes) result.axes = [];
|
6500
|
-
if (!
|
6559
|
+
if (!yAxisConfig) {
|
6501
6560
|
result.axes = [
|
6502
6561
|
...result.axes,
|
6503
6562
|
{
|
@@ -6505,26 +6564,16 @@ const yLinearPrimary = (spec, context)=>{
|
|
6505
6564
|
id,
|
6506
6565
|
seriesId,
|
6507
6566
|
type: 'linear',
|
6508
|
-
orient: 'left'
|
6509
|
-
sync: {
|
6510
|
-
axisId: `${datasetReshapeInfo[0].id}-secondary-axis`,
|
6511
|
-
tickAlign: false,
|
6512
|
-
zeroAlign: true
|
6513
|
-
}
|
6567
|
+
orient: 'left'
|
6514
6568
|
}
|
6515
6569
|
];
|
6516
6570
|
return result;
|
6517
6571
|
}
|
6518
|
-
const { visible = true, label, tick, title, grid, line, zero, nice, inverse, max, min, log, logBase = 10 } =
|
6572
|
+
const { visible = true, label, tick, title, grid, line, zero, nice, inverse, max, min, log, logBase = 10 } = yAxisConfig;
|
6519
6573
|
const linearAxis = {
|
6520
6574
|
visible,
|
6521
6575
|
id,
|
6522
6576
|
seriesId,
|
6523
|
-
sync: {
|
6524
|
-
axisId: `${datasetReshapeInfo[0].id}-secondary-axis`,
|
6525
|
-
tickAlign: false,
|
6526
|
-
zeroAlign: true
|
6527
|
-
},
|
6528
6577
|
type: log ? 'log' : 'linear',
|
6529
6578
|
base: logBase,
|
6530
6579
|
orient: 'left',
|
@@ -6593,12 +6642,22 @@ const yLinearSecondary = (spec, context)=>{
|
|
6593
6642
|
const { locale, datasetReshapeInfo } = advancedVSeed;
|
6594
6643
|
const index = datasetReshapeInfo[0].index;
|
6595
6644
|
const secondaryYAxis = advancedVSeed.config?.[chartType]?.secondaryYAxis;
|
6596
|
-
const
|
6645
|
+
const yAxisConfig = Array.isArray(secondaryYAxis) ? secondaryYAxis[index] || secondaryYAxis[0] : secondaryYAxis;
|
6646
|
+
const alignTicks = advancedVSeed.config?.[chartType]?.alignTicks;
|
6647
|
+
const alignTicksConfig = Array.isArray(alignTicks) ? alignTicks[index] || alignTicks[0] : alignTicks;
|
6597
6648
|
if ((0, external_remeda_namespaceObject.isNullish)(datasetReshapeInfo[0].foldInfoList?.[1])) return result;
|
6649
|
+
const sync = {
|
6650
|
+
axisId: `${datasetReshapeInfo[0].id}-primary-axis`,
|
6651
|
+
zeroAlign: true
|
6652
|
+
};
|
6598
6653
|
const id = `${datasetReshapeInfo[0].id}-secondary-axis`;
|
6599
|
-
const
|
6654
|
+
const seriesIds = [
|
6655
|
+
`${datasetReshapeInfo[0].id}-primary-series`,
|
6656
|
+
`${datasetReshapeInfo[0].id}-secondary-series`
|
6657
|
+
];
|
6658
|
+
const seriesId = alignTicksConfig ? seriesIds : seriesIds[1];
|
6600
6659
|
if (!result.axes) result.axes = [];
|
6601
|
-
if (!
|
6660
|
+
if (!yAxisConfig) {
|
6602
6661
|
result.axes = [
|
6603
6662
|
...result.axes,
|
6604
6663
|
{
|
@@ -6606,16 +6665,18 @@ const yLinearSecondary = (spec, context)=>{
|
|
6606
6665
|
id,
|
6607
6666
|
seriesId,
|
6608
6667
|
type: 'linear',
|
6609
|
-
orient: 'right'
|
6668
|
+
orient: 'right',
|
6669
|
+
sync
|
6610
6670
|
}
|
6611
6671
|
];
|
6612
6672
|
return result;
|
6613
6673
|
}
|
6614
|
-
const { visible = true, label, tick, title, grid, line, zero, nice, inverse, max, min, log, logBase = 10 } =
|
6674
|
+
const { visible = true, label, tick, title, grid, line, zero, nice, inverse, max, min, log, logBase = 10 } = yAxisConfig;
|
6615
6675
|
const linearAxis = {
|
6616
6676
|
visible,
|
6617
6677
|
id,
|
6618
6678
|
seriesId,
|
6679
|
+
sync,
|
6619
6680
|
type: log ? 'log' : 'linear',
|
6620
6681
|
base: logBase,
|
6621
6682
|
orient: 'right',
|
@@ -6719,7 +6780,7 @@ const pivotDualAxis = [
|
|
6719
6780
|
pivotIndicators_pivotIndicatorsAsRow,
|
6720
6781
|
datasetPivot,
|
6721
6782
|
pivotIndicators_pivotIndicators([
|
6722
|
-
|
6783
|
+
series([
|
6723
6784
|
initDualAxisPrimary,
|
6724
6785
|
dualChartTypePrimary,
|
6725
6786
|
datasetPrimary,
|
@@ -9083,6 +9144,7 @@ const zDualAxisConfig = external_zod_namespaceObject.z.object({
|
|
9083
9144
|
tooltip: zTooltip.nullish(),
|
9084
9145
|
legend: zLegend.nullish(),
|
9085
9146
|
dualChartType: external_zod_namespaceObject.z.array(zDualChartType).or(zDualChartType).nullish(),
|
9147
|
+
alignTicks: external_zod_namespaceObject.z.array(external_zod_namespaceObject.z.boolean()).or(external_zod_namespaceObject.z.boolean()).nullish(),
|
9086
9148
|
primaryYAxis: external_zod_namespaceObject.z.array(zYLinearAxis).or(zYLinearAxis).nullish(),
|
9087
9149
|
secondaryYAxis: external_zod_namespaceObject.z.array(zYLinearAxis).or(zYLinearAxis).nullish(),
|
9088
9150
|
xAxis: zXBandAxis.nullish(),
|
@@ -9255,6 +9317,7 @@ const zBarStyle = external_zod_namespaceObject.z.object({
|
|
9255
9317
|
zSelector,
|
9256
9318
|
zSelectors
|
9257
9319
|
]).nullish(),
|
9320
|
+
barVisible: external_zod_namespaceObject.z.boolean().nullish(),
|
9258
9321
|
barColor: external_zod_namespaceObject.z.string().nullish(),
|
9259
9322
|
barColorOpacity: external_zod_namespaceObject.z.number().nullish(),
|
9260
9323
|
barBorderColor: external_zod_namespaceObject.z.string().nullish(),
|
@@ -9274,6 +9337,7 @@ const zPointStyle = external_zod_namespaceObject.z.object({
|
|
9274
9337
|
zSelector,
|
9275
9338
|
zSelectors
|
9276
9339
|
]).nullish(),
|
9340
|
+
pointVisible: external_zod_namespaceObject.z.boolean().nullish(),
|
9277
9341
|
pointSize: external_zod_namespaceObject.z.number().nullish(),
|
9278
9342
|
pointColor: external_zod_namespaceObject.z.string().nullish(),
|
9279
9343
|
pointColorOpacity: external_zod_namespaceObject.z.number().nullish(),
|
@@ -9292,6 +9356,7 @@ const zLineStyle = external_zod_namespaceObject.z.object({
|
|
9292
9356
|
zSelector,
|
9293
9357
|
zSelectors
|
9294
9358
|
]).nullish(),
|
9359
|
+
lineVisible: external_zod_namespaceObject.z.boolean().nullish(),
|
9295
9360
|
lineSmooth: external_zod_namespaceObject.z.boolean().nullish(),
|
9296
9361
|
lineColor: external_zod_namespaceObject.z.string().nullish(),
|
9297
9362
|
lineColorOpacity: external_zod_namespaceObject.z.number().nullish(),
|
@@ -9309,6 +9374,7 @@ const zAreaStyle = external_zod_namespaceObject.z.object({
|
|
9309
9374
|
zSelector,
|
9310
9375
|
zSelectors
|
9311
9376
|
]).nullish(),
|
9377
|
+
areaVisible: external_zod_namespaceObject.z.boolean().nullish(),
|
9312
9378
|
areaColor: external_zod_namespaceObject.z.string().nullish(),
|
9313
9379
|
areaColorOpacity: external_zod_namespaceObject.z.number().nullish()
|
9314
9380
|
});
|
@@ -9394,9 +9460,7 @@ const zAnnotationVerticalLine = external_zod_namespaceObject.z.object({
|
|
9394
9460
|
external_zod_namespaceObject.z.literal('solid'),
|
9395
9461
|
external_zod_namespaceObject.z.literal('dashed'),
|
9396
9462
|
external_zod_namespaceObject.z.literal('dotted')
|
9397
|
-
]).default('dashed').nullish()
|
9398
|
-
offsetX: external_zod_namespaceObject.z.number().default(0),
|
9399
|
-
offsetY: external_zod_namespaceObject.z.number().default(0)
|
9463
|
+
]).default('dashed').nullish()
|
9400
9464
|
});
|
9401
9465
|
const zAnnotationHorizontalLine = external_zod_namespaceObject.z.object({
|
9402
9466
|
selector: external_zod_namespaceObject.z.union([
|
@@ -9446,9 +9510,7 @@ const zAnnotationHorizontalLine = external_zod_namespaceObject.z.object({
|
|
9446
9510
|
textBackgroundBorderColor: external_zod_namespaceObject.z.string().default('#212121').nullish(),
|
9447
9511
|
textBackgroundBorderRadius: external_zod_namespaceObject.z.number().default(4).nullish(),
|
9448
9512
|
textBackgroundBorderWidth: external_zod_namespaceObject.z.number().default(1).nullish(),
|
9449
|
-
textBackgroundPadding: external_zod_namespaceObject.z.number().default(2).nullish()
|
9450
|
-
offsetX: external_zod_namespaceObject.z.number().default(0),
|
9451
|
-
offsetY: external_zod_namespaceObject.z.number().default(0)
|
9513
|
+
textBackgroundPadding: external_zod_namespaceObject.z.number().default(2).nullish()
|
9452
9514
|
});
|
9453
9515
|
const zAnnotationArea = external_zod_namespaceObject.z.object({
|
9454
9516
|
selector: external_zod_namespaceObject.z.union([
|
@@ -9490,9 +9552,7 @@ const zAnnotationArea = external_zod_namespaceObject.z.object({
|
|
9490
9552
|
areaBorderColor: external_zod_namespaceObject.z.string().default('#888888').nullish(),
|
9491
9553
|
areaBorderWidth: external_zod_namespaceObject.z.number().default(1).nullish(),
|
9492
9554
|
areaBorderRadius: external_zod_namespaceObject.z.number().default(4).nullish(),
|
9493
|
-
outerPadding: external_zod_namespaceObject.z.number().default(4).nullish()
|
9494
|
-
offsetX: external_zod_namespaceObject.z.number().default(0).nullish(),
|
9495
|
-
offsetY: external_zod_namespaceObject.z.number().default(0).nullish()
|
9555
|
+
outerPadding: external_zod_namespaceObject.z.number().default(4).nullish()
|
9496
9556
|
});
|
9497
9557
|
const zAnnotation = external_zod_namespaceObject.z.object({
|
9498
9558
|
annotationPoint: zAnnotationPoint.or(external_zod_namespaceObject.z.array(zAnnotationPoint)).nullish(),
|
@@ -9817,6 +9877,7 @@ const zDualAxis = external_zod_namespaceObject.z.object({
|
|
9817
9877
|
measures: zMeasureTree.nullish(),
|
9818
9878
|
dualMeasures: zDualMeasures.nullish(),
|
9819
9879
|
dualChartType: external_zod_namespaceObject.z.array(zDualChartType).or(zDualChartType).nullish(),
|
9880
|
+
alignTicks: external_zod_namespaceObject.z.array(external_zod_namespaceObject.z.boolean()).or(external_zod_namespaceObject.z.boolean()).nullish(),
|
9820
9881
|
primaryYAxis: external_zod_namespaceObject.z.array(zYLinearAxis).or(zYLinearAxis).nullish(),
|
9821
9882
|
secondaryYAxis: external_zod_namespaceObject.z.array(zYLinearAxis).or(zYLinearAxis).nullish(),
|
9822
9883
|
xAxis: zXBandAxis.nullish(),
|