@visactor/vseed 0.0.38 → 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 +16 -0
- package/dist/index.cjs +36 -16
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +36 -16
- 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/types/advancedVSeed.d.ts +8 -0
- package/dist/types/chartType/area/area.d.ts +2 -8
- package/dist/types/chartType/area/zArea.d.ts +6 -0
- package/dist/types/chartType/areaPercent/zAreaPercent.d.ts +6 -0
- package/dist/types/chartType/areaRange/zAreaRange.d.ts +6 -0
- package/dist/types/chartType/bar/zBar.d.ts +2 -0
- package/dist/types/chartType/barParallel/zBarParallel.d.ts +2 -0
- package/dist/types/chartType/barPercent/zBarPercent.d.ts +2 -0
- package/dist/types/chartType/column/zColumn.d.ts +2 -0
- package/dist/types/chartType/columnParallel/zColumnParallel.d.ts +2 -0
- package/dist/types/chartType/columnPercent/zColumnPercent.d.ts +2 -0
- package/dist/types/chartType/dualAxis/zDualAxis.d.ts +8 -0
- package/dist/types/chartType/line/zLine.d.ts +4 -0
- package/dist/types/chartType/radar/radar.d.ts +25 -1
- package/dist/types/chartType/scatter/zScatter.d.ts +2 -0
- package/dist/types/properties/annotation/annotationArea.d.ts +17 -17
- 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/vseed.d.ts +44 -0
- package/dist/umd/index.js +36 -16
- package/dist/umd/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
@@ -2357,7 +2357,7 @@ const pointStyle_pointStyle = (spec, context)=>{
|
|
2357
2357
|
pointStyle
|
2358
2358
|
];
|
2359
2359
|
const customMap = pointStyles.reduce((result, style, index)=>{
|
2360
|
-
const { pointBorderColor, pointBorderStyle, pointBorderWidth = 1, pointColor, pointColorOpacity, pointSize } = style;
|
2360
|
+
const { pointBorderColor, pointBorderStyle, pointBorderWidth = 1, pointColor, pointColorOpacity, pointSize, pointVisible = true } = style;
|
2361
2361
|
const lineDash = 'dashed' === pointBorderStyle ? [
|
2362
2362
|
5,
|
2363
2363
|
2
|
@@ -2377,6 +2377,7 @@ const pointStyle_pointStyle = (spec, context)=>{
|
|
2377
2377
|
return false;
|
2378
2378
|
},
|
2379
2379
|
style: {
|
2380
|
+
visible: pointVisible,
|
2380
2381
|
size: pointSize,
|
2381
2382
|
fill: pointColor,
|
2382
2383
|
fillOpacity: pointColorOpacity,
|
@@ -2461,9 +2462,9 @@ const lineStyle_lineStyle = (spec, context)=>{
|
|
2461
2462
|
const group = encoding[0]?.group?.[0];
|
2462
2463
|
const lineGroups = groupBy(dataset, (d)=>d[group ?? '']);
|
2463
2464
|
const customMap = lineStyles.reduce((result, style, index)=>{
|
2464
|
-
const { lineColor, lineColorOpacity, lineSmooth, lineStyle, lineWidth } = style;
|
2465
|
-
const dashSegment =
|
2466
|
-
const dashGap = lineWidth
|
2465
|
+
const { lineColor, lineColorOpacity, lineSmooth, lineStyle, lineWidth = 2, lineVisible = true } = style;
|
2466
|
+
const dashSegment = 2 * lineWidth;
|
2467
|
+
const dashGap = lineWidth;
|
2467
2468
|
const lineDash = 'dashed' === lineStyle ? [
|
2468
2469
|
dashSegment,
|
2469
2470
|
dashSegment
|
@@ -2485,6 +2486,7 @@ const lineStyle_lineStyle = (spec, context)=>{
|
|
2485
2486
|
return false;
|
2486
2487
|
},
|
2487
2488
|
style: {
|
2489
|
+
visible: lineVisible,
|
2488
2490
|
curveType: curveType,
|
2489
2491
|
strokeOpacity: lineColorOpacity,
|
2490
2492
|
stroke: lineColor,
|
@@ -3032,13 +3034,14 @@ const pivotIndicators_pivotIndicators = (chartPipeline)=>(spec, context)=>{
|
|
3032
3034
|
...spec
|
3033
3035
|
};
|
3034
3036
|
const { advancedVSeed } = context;
|
3035
|
-
const { measures, datasetReshapeInfo, encoding } = advancedVSeed;
|
3037
|
+
const { measures, datasetReshapeInfo, encoding, dataset } = advancedVSeed;
|
3036
3038
|
const colorItems = unique(datasetReshapeInfo.flatMap((d)=>d.unfoldInfo.colorItems));
|
3037
3039
|
const indicators = datasetReshapeInfo.map((reshapeInfo, index)=>{
|
3038
3040
|
const measure = measures?.find((d)=>d.id === reshapeInfo.id);
|
3039
3041
|
const newEncoding = [
|
3040
3042
|
encoding[index]
|
3041
3043
|
];
|
3044
|
+
const newDataset = dataset[index];
|
3042
3045
|
const newDatasetReshapeInfo = [
|
3043
3046
|
{
|
3044
3047
|
...reshapeInfo,
|
@@ -3053,6 +3056,7 @@ const pivotIndicators_pivotIndicators = (chartPipeline)=>(spec, context)=>{
|
|
3053
3056
|
advancedVSeed: {
|
3054
3057
|
...advancedVSeed,
|
3055
3058
|
datasetReshapeInfo: newDatasetReshapeInfo,
|
3059
|
+
dataset: newDataset,
|
3056
3060
|
encoding: newEncoding
|
3057
3061
|
}
|
3058
3062
|
};
|
@@ -3161,7 +3165,8 @@ const pivotDiscreteLegend = (spec, context)=>{
|
|
3161
3165
|
...cur.unfoldInfo.colorIdMap
|
3162
3166
|
}), {});
|
3163
3167
|
const { legend, color } = baseConfig;
|
3164
|
-
const { colorScheme } = color;
|
3168
|
+
const { colorScheme, colorMapping } = color;
|
3169
|
+
const colorSpecified = createSpecifiedForColorMapping(colorMapping, colorIdMap, colorItems);
|
3165
3170
|
const { enable, position = 'bottom', labelFontColor, labelFontSize = 12, labelFontWeight = 400, maxSize = 1, border, shapeType = 'rectRound' } = legend || {};
|
3166
3171
|
const orient = [
|
3167
3172
|
'bottom',
|
@@ -3208,17 +3213,20 @@ const pivotDiscreteLegend = (spec, context)=>{
|
|
3208
3213
|
position: legendPosition,
|
3209
3214
|
maxCol: Math.max(1, maxSize),
|
3210
3215
|
maxRow: Math.max(1, maxSize),
|
3211
|
-
data: colorItems.map((d, index)=>
|
3216
|
+
data: colorItems.map((d, index)=>{
|
3217
|
+
const color = colorSpecified?.[d] ?? colorScheme?.[index % colorScheme.length];
|
3218
|
+
return {
|
3212
3219
|
label: d,
|
3213
3220
|
shape: {
|
3214
3221
|
outerBorder: border ? {
|
3215
|
-
stroke:
|
3222
|
+
stroke: color,
|
3216
3223
|
distance: 3,
|
3217
3224
|
lineWidth: 1
|
3218
3225
|
} : void 0,
|
3219
|
-
fill:
|
3226
|
+
fill: color
|
3220
3227
|
}
|
3221
|
-
}
|
3228
|
+
};
|
3229
|
+
}),
|
3222
3230
|
item: {
|
3223
3231
|
focus: true,
|
3224
3232
|
maxWidth: '30%',
|
@@ -3568,7 +3576,7 @@ const barStyle_barStyle = (spec, context)=>{
|
|
3568
3576
|
barStyle
|
3569
3577
|
];
|
3570
3578
|
const customMap = barStyles.reduce((result, style, index)=>{
|
3571
|
-
const { barBorderColor, barBorderStyle, barBorderWidth = 1, barColor, barColorOpacity, barRadius } = style;
|
3579
|
+
const { barBorderColor, barBorderStyle, barBorderWidth = 1, barColor, barColorOpacity, barRadius, barVisible = true } = style;
|
3572
3580
|
const lineDash = 'dashed' === barBorderStyle ? [
|
3573
3581
|
5,
|
3574
3582
|
2
|
@@ -3588,6 +3596,7 @@ const barStyle_barStyle = (spec, context)=>{
|
|
3588
3596
|
return false;
|
3589
3597
|
},
|
3590
3598
|
style: {
|
3599
|
+
visible: barVisible,
|
3591
3600
|
fill: barColor,
|
3592
3601
|
fillOpacity: barColorOpacity,
|
3593
3602
|
cornerRadius: barRadius,
|
@@ -4566,7 +4575,12 @@ const areaStyle_areaStyle = (spec, context)=>{
|
|
4566
4575
|
const { advancedVSeed } = context;
|
4567
4576
|
const { markStyle, encoding, dataset } = advancedVSeed;
|
4568
4577
|
const { areaStyle } = markStyle;
|
4569
|
-
if (!areaStyle) return
|
4578
|
+
if (!areaStyle) return {
|
4579
|
+
...spec,
|
4580
|
+
area: {
|
4581
|
+
visible: true
|
4582
|
+
}
|
4583
|
+
};
|
4570
4584
|
const result = {
|
4571
4585
|
...spec
|
4572
4586
|
};
|
@@ -4574,19 +4588,20 @@ const areaStyle_areaStyle = (spec, context)=>{
|
|
4574
4588
|
areaStyle
|
4575
4589
|
];
|
4576
4590
|
const group = encoding[0]?.group?.[0];
|
4577
|
-
const
|
4591
|
+
const areaGroups = groupBy(dataset, (d)=>d[group ?? '']);
|
4578
4592
|
const customMap = areaStyles.reduce((result, style, index)=>{
|
4579
|
-
const { areaColor, areaColorOpacity } = style;
|
4593
|
+
const { areaColor, areaColorOpacity, areaVisible = true } = style;
|
4580
4594
|
return {
|
4581
4595
|
...result,
|
4582
4596
|
[`custom${index + 1}`]: {
|
4583
4597
|
level: index + 1,
|
4584
4598
|
filter: (datum)=>{
|
4585
|
-
const lineData =
|
4599
|
+
const lineData = areaGroups[datum[group ?? '']];
|
4586
4600
|
for (const d of lineData)if (selector_selector(d, style.selector)) return true;
|
4587
4601
|
return false;
|
4588
4602
|
},
|
4589
4603
|
style: {
|
4604
|
+
visible: areaVisible,
|
4590
4605
|
fill: areaColor,
|
4591
4606
|
fillOpacity: areaColorOpacity
|
4592
4607
|
}
|
@@ -4596,6 +4611,7 @@ const areaStyle_areaStyle = (spec, context)=>{
|
|
4596
4611
|
return {
|
4597
4612
|
...result,
|
4598
4613
|
area: {
|
4614
|
+
visible: true,
|
4599
4615
|
state: {
|
4600
4616
|
...customMap
|
4601
4617
|
}
|
@@ -6524,7 +6540,7 @@ const pivotDualAxis = [
|
|
6524
6540
|
pivotIndicators_pivotIndicatorsAsRow,
|
6525
6541
|
datasetPivot,
|
6526
6542
|
pivotIndicators_pivotIndicators([
|
6527
|
-
|
6543
|
+
series([
|
6528
6544
|
initDualAxisPrimary,
|
6529
6545
|
dualChartTypePrimary,
|
6530
6546
|
datasetPrimary,
|
@@ -9060,6 +9076,7 @@ const zBarStyle = z.object({
|
|
9060
9076
|
zSelector,
|
9061
9077
|
zSelectors
|
9062
9078
|
]).nullish(),
|
9079
|
+
barVisible: z.boolean().nullish(),
|
9063
9080
|
barColor: z.string().nullish(),
|
9064
9081
|
barColorOpacity: z.number().nullish(),
|
9065
9082
|
barBorderColor: z.string().nullish(),
|
@@ -9079,6 +9096,7 @@ const zPointStyle = z.object({
|
|
9079
9096
|
zSelector,
|
9080
9097
|
zSelectors
|
9081
9098
|
]).nullish(),
|
9099
|
+
pointVisible: z.boolean().nullish(),
|
9082
9100
|
pointSize: z.number().nullish(),
|
9083
9101
|
pointColor: z.string().nullish(),
|
9084
9102
|
pointColorOpacity: z.number().nullish(),
|
@@ -9097,6 +9115,7 @@ const zLineStyle = z.object({
|
|
9097
9115
|
zSelector,
|
9098
9116
|
zSelectors
|
9099
9117
|
]).nullish(),
|
9118
|
+
lineVisible: z.boolean().nullish(),
|
9100
9119
|
lineSmooth: z.boolean().nullish(),
|
9101
9120
|
lineColor: z.string().nullish(),
|
9102
9121
|
lineColorOpacity: z.number().nullish(),
|
@@ -9114,6 +9133,7 @@ const zAreaStyle = z.object({
|
|
9114
9133
|
zSelector,
|
9115
9134
|
zSelectors
|
9116
9135
|
]).nullish(),
|
9136
|
+
areaVisible: z.boolean().nullish(),
|
9117
9137
|
areaColor: z.string().nullish(),
|
9118
9138
|
areaColorOpacity: z.number().nullish()
|
9119
9139
|
});
|