@visactor/vseed 0.0.38 → 0.0.40
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 +56 -22
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +56 -22
- 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 +56 -22
- package/dist/umd/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
@@ -1244,6 +1244,7 @@ const foldMeasures = (dataset, measures, measureId = FoldMeasureId, measureName
|
|
1244
1244
|
const unfoldDimensions = (dataset, dimensions, measures, unfoldStartIndex = 0, unfoldGroupName = UnfoldDimensionGroup, unfoldGroupId = UnfoldDimensionGroupId, foldMeasureId = FoldMeasureId, dimensionsSeparator = Separator)=>{
|
1245
1245
|
if (unfoldStartIndex < 0 || unfoldStartIndex >= dimensions.length) throw new Error('unfoldStartIndex is out of range');
|
1246
1246
|
const dimensionsToBeUnfolded = dimensions.slice(unfoldStartIndex);
|
1247
|
+
const dimensionsToBeRemain = dimensions.slice(0, unfoldStartIndex);
|
1247
1248
|
const unfoldInfo = {
|
1248
1249
|
groupName: unfoldGroupName,
|
1249
1250
|
groupId: unfoldGroupId,
|
@@ -1272,6 +1273,10 @@ const unfoldDimensions = (dataset, dimensions, measures, unfoldStartIndex = 0, u
|
|
1272
1273
|
datum[unfoldGroupId] = colorId;
|
1273
1274
|
colorItems.push(colorId);
|
1274
1275
|
colorMap[colorId] = colorName;
|
1276
|
+
if (dimensionsToBeRemain.length > 0) for (const dim of dimensionsToBeRemain){
|
1277
|
+
const dimValue = datum[dim.id];
|
1278
|
+
if ('number' == typeof dimValue) datum[dim.id] = String(dimValue);
|
1279
|
+
}
|
1275
1280
|
}
|
1276
1281
|
unfoldInfo.colorItems = unique(colorItems);
|
1277
1282
|
unfoldInfo.colorIdMap = colorMap;
|
@@ -2357,7 +2362,7 @@ const pointStyle_pointStyle = (spec, context)=>{
|
|
2357
2362
|
pointStyle
|
2358
2363
|
];
|
2359
2364
|
const customMap = pointStyles.reduce((result, style, index)=>{
|
2360
|
-
const { pointBorderColor, pointBorderStyle, pointBorderWidth = 1, pointColor, pointColorOpacity, pointSize } = style;
|
2365
|
+
const { pointBorderColor, pointBorderStyle, pointBorderWidth = 1, pointColor, pointColorOpacity, pointSize, pointVisible = true } = style;
|
2361
2366
|
const lineDash = 'dashed' === pointBorderStyle ? [
|
2362
2367
|
5,
|
2363
2368
|
2
|
@@ -2377,6 +2382,7 @@ const pointStyle_pointStyle = (spec, context)=>{
|
|
2377
2382
|
return false;
|
2378
2383
|
},
|
2379
2384
|
style: {
|
2385
|
+
visible: pointVisible,
|
2380
2386
|
size: pointSize,
|
2381
2387
|
fill: pointColor,
|
2382
2388
|
fillOpacity: pointColorOpacity,
|
@@ -2461,9 +2467,9 @@ const lineStyle_lineStyle = (spec, context)=>{
|
|
2461
2467
|
const group = encoding[0]?.group?.[0];
|
2462
2468
|
const lineGroups = groupBy(dataset, (d)=>d[group ?? '']);
|
2463
2469
|
const customMap = lineStyles.reduce((result, style, index)=>{
|
2464
|
-
const { lineColor, lineColorOpacity, lineSmooth, lineStyle, lineWidth } = style;
|
2465
|
-
const dashSegment =
|
2466
|
-
const dashGap = lineWidth
|
2470
|
+
const { lineColor, lineColorOpacity, lineSmooth, lineStyle, lineWidth = 2, lineVisible = true } = style;
|
2471
|
+
const dashSegment = 2 * lineWidth;
|
2472
|
+
const dashGap = lineWidth;
|
2467
2473
|
const lineDash = 'dashed' === lineStyle ? [
|
2468
2474
|
dashSegment,
|
2469
2475
|
dashSegment
|
@@ -2485,6 +2491,7 @@ const lineStyle_lineStyle = (spec, context)=>{
|
|
2485
2491
|
return false;
|
2486
2492
|
},
|
2487
2493
|
style: {
|
2494
|
+
visible: lineVisible,
|
2488
2495
|
curveType: curveType,
|
2489
2496
|
strokeOpacity: lineColorOpacity,
|
2490
2497
|
stroke: lineColor,
|
@@ -3032,13 +3039,14 @@ const pivotIndicators_pivotIndicators = (chartPipeline)=>(spec, context)=>{
|
|
3032
3039
|
...spec
|
3033
3040
|
};
|
3034
3041
|
const { advancedVSeed } = context;
|
3035
|
-
const { measures, datasetReshapeInfo, encoding } = advancedVSeed;
|
3042
|
+
const { measures, datasetReshapeInfo, encoding, dataset } = advancedVSeed;
|
3036
3043
|
const colorItems = unique(datasetReshapeInfo.flatMap((d)=>d.unfoldInfo.colorItems));
|
3037
3044
|
const indicators = datasetReshapeInfo.map((reshapeInfo, index)=>{
|
3038
3045
|
const measure = measures?.find((d)=>d.id === reshapeInfo.id);
|
3039
3046
|
const newEncoding = [
|
3040
3047
|
encoding[index]
|
3041
3048
|
];
|
3049
|
+
const newDataset = dataset[index];
|
3042
3050
|
const newDatasetReshapeInfo = [
|
3043
3051
|
{
|
3044
3052
|
...reshapeInfo,
|
@@ -3053,6 +3061,7 @@ const pivotIndicators_pivotIndicators = (chartPipeline)=>(spec, context)=>{
|
|
3053
3061
|
advancedVSeed: {
|
3054
3062
|
...advancedVSeed,
|
3055
3063
|
datasetReshapeInfo: newDatasetReshapeInfo,
|
3064
|
+
dataset: newDataset,
|
3056
3065
|
encoding: newEncoding
|
3057
3066
|
}
|
3058
3067
|
};
|
@@ -3161,7 +3170,8 @@ const pivotDiscreteLegend = (spec, context)=>{
|
|
3161
3170
|
...cur.unfoldInfo.colorIdMap
|
3162
3171
|
}), {});
|
3163
3172
|
const { legend, color } = baseConfig;
|
3164
|
-
const { colorScheme } = color;
|
3173
|
+
const { colorScheme, colorMapping } = color;
|
3174
|
+
const colorSpecified = createSpecifiedForColorMapping(colorMapping, colorIdMap, colorItems);
|
3165
3175
|
const { enable, position = 'bottom', labelFontColor, labelFontSize = 12, labelFontWeight = 400, maxSize = 1, border, shapeType = 'rectRound' } = legend || {};
|
3166
3176
|
const orient = [
|
3167
3177
|
'bottom',
|
@@ -3208,17 +3218,20 @@ const pivotDiscreteLegend = (spec, context)=>{
|
|
3208
3218
|
position: legendPosition,
|
3209
3219
|
maxCol: Math.max(1, maxSize),
|
3210
3220
|
maxRow: Math.max(1, maxSize),
|
3211
|
-
data: colorItems.map((d, index)=>
|
3221
|
+
data: colorItems.map((d, index)=>{
|
3222
|
+
const color = colorSpecified?.[d] ?? colorScheme?.[index % colorScheme.length];
|
3223
|
+
return {
|
3212
3224
|
label: d,
|
3213
3225
|
shape: {
|
3214
3226
|
outerBorder: border ? {
|
3215
|
-
stroke:
|
3227
|
+
stroke: color,
|
3216
3228
|
distance: 3,
|
3217
3229
|
lineWidth: 1
|
3218
3230
|
} : void 0,
|
3219
|
-
fill:
|
3231
|
+
fill: color
|
3220
3232
|
}
|
3221
|
-
}
|
3233
|
+
};
|
3234
|
+
}),
|
3222
3235
|
item: {
|
3223
3236
|
focus: true,
|
3224
3237
|
maxWidth: '30%',
|
@@ -3568,7 +3581,7 @@ const barStyle_barStyle = (spec, context)=>{
|
|
3568
3581
|
barStyle
|
3569
3582
|
];
|
3570
3583
|
const customMap = barStyles.reduce((result, style, index)=>{
|
3571
|
-
const { barBorderColor, barBorderStyle, barBorderWidth = 1, barColor, barColorOpacity, barRadius } = style;
|
3584
|
+
const { barBorderColor, barBorderStyle, barBorderWidth = 1, barColor, barColorOpacity, barRadius, barVisible = true } = style;
|
3572
3585
|
const lineDash = 'dashed' === barBorderStyle ? [
|
3573
3586
|
5,
|
3574
3587
|
2
|
@@ -3588,6 +3601,7 @@ const barStyle_barStyle = (spec, context)=>{
|
|
3588
3601
|
return false;
|
3589
3602
|
},
|
3590
3603
|
style: {
|
3604
|
+
visible: barVisible,
|
3591
3605
|
fill: barColor,
|
3592
3606
|
fillOpacity: barColorOpacity,
|
3593
3607
|
cornerRadius: barRadius,
|
@@ -3816,12 +3830,15 @@ const initColumnParallel = (spec, context)=>{
|
|
3816
3830
|
...spec
|
3817
3831
|
};
|
3818
3832
|
const { advancedVSeed } = context;
|
3819
|
-
const { encoding, datasetReshapeInfo } = advancedVSeed;
|
3833
|
+
const { encoding, datasetReshapeInfo, dimensions } = advancedVSeed;
|
3820
3834
|
const { unfoldInfo } = datasetReshapeInfo[0];
|
3821
3835
|
if (!encoding[0].y || !encoding[0].x || !encoding[0].group) return result;
|
3836
|
+
const sameDimensionsMode = dimensions.length > 1 && dimensions.every((dim)=>dim.id === dimensions[0].id);
|
3822
3837
|
result.type = 'bar';
|
3823
3838
|
result.direction = 'vertical';
|
3824
|
-
result.xField = [
|
3839
|
+
result.xField = sameDimensionsMode ? [
|
3840
|
+
encoding[0].x[0]
|
3841
|
+
] : [
|
3825
3842
|
encoding[0].x[0],
|
3826
3843
|
unfoldInfo.groupId
|
3827
3844
|
];
|
@@ -4381,12 +4398,15 @@ const initBarParallel = (spec, context)=>{
|
|
4381
4398
|
...spec
|
4382
4399
|
};
|
4383
4400
|
const { advancedVSeed } = context;
|
4384
|
-
const { encoding, datasetReshapeInfo } = advancedVSeed;
|
4401
|
+
const { encoding, datasetReshapeInfo, dimensions } = advancedVSeed;
|
4385
4402
|
const { unfoldInfo } = datasetReshapeInfo[0];
|
4386
4403
|
if (!encoding[0].y || !encoding[0].x || !encoding[0].group) return result;
|
4404
|
+
const sameDimensionsMode = dimensions.length > 1 && dimensions.every((dim)=>dim.id === dimensions[0].id);
|
4387
4405
|
result.type = 'bar';
|
4388
4406
|
result.direction = 'horizontal';
|
4389
|
-
result.yField = [
|
4407
|
+
result.yField = sameDimensionsMode ? [
|
4408
|
+
encoding[0].y[0]
|
4409
|
+
] : [
|
4390
4410
|
encoding[0].y[0],
|
4391
4411
|
unfoldInfo.groupId
|
4392
4412
|
];
|
@@ -4566,7 +4586,12 @@ const areaStyle_areaStyle = (spec, context)=>{
|
|
4566
4586
|
const { advancedVSeed } = context;
|
4567
4587
|
const { markStyle, encoding, dataset } = advancedVSeed;
|
4568
4588
|
const { areaStyle } = markStyle;
|
4569
|
-
if (!areaStyle) return
|
4589
|
+
if (!areaStyle) return {
|
4590
|
+
...spec,
|
4591
|
+
area: {
|
4592
|
+
visible: true
|
4593
|
+
}
|
4594
|
+
};
|
4570
4595
|
const result = {
|
4571
4596
|
...spec
|
4572
4597
|
};
|
@@ -4574,19 +4599,20 @@ const areaStyle_areaStyle = (spec, context)=>{
|
|
4574
4599
|
areaStyle
|
4575
4600
|
];
|
4576
4601
|
const group = encoding[0]?.group?.[0];
|
4577
|
-
const
|
4602
|
+
const areaGroups = groupBy(dataset, (d)=>d[group ?? '']);
|
4578
4603
|
const customMap = areaStyles.reduce((result, style, index)=>{
|
4579
|
-
const { areaColor, areaColorOpacity } = style;
|
4604
|
+
const { areaColor, areaColorOpacity, areaVisible = true } = style;
|
4580
4605
|
return {
|
4581
4606
|
...result,
|
4582
4607
|
[`custom${index + 1}`]: {
|
4583
4608
|
level: index + 1,
|
4584
4609
|
filter: (datum)=>{
|
4585
|
-
const lineData =
|
4610
|
+
const lineData = areaGroups[datum[group ?? '']];
|
4586
4611
|
for (const d of lineData)if (selector_selector(d, style.selector)) return true;
|
4587
4612
|
return false;
|
4588
4613
|
},
|
4589
4614
|
style: {
|
4615
|
+
visible: areaVisible,
|
4590
4616
|
fill: areaColor,
|
4591
4617
|
fillOpacity: areaColorOpacity
|
4592
4618
|
}
|
@@ -4596,6 +4622,7 @@ const areaStyle_areaStyle = (spec, context)=>{
|
|
4596
4622
|
return {
|
4597
4623
|
...result,
|
4598
4624
|
area: {
|
4625
|
+
visible: true,
|
4599
4626
|
state: {
|
4600
4627
|
...customMap
|
4601
4628
|
}
|
@@ -6524,7 +6551,7 @@ const pivotDualAxis = [
|
|
6524
6551
|
pivotIndicators_pivotIndicatorsAsRow,
|
6525
6552
|
datasetPivot,
|
6526
6553
|
pivotIndicators_pivotIndicators([
|
6527
|
-
|
6554
|
+
series([
|
6528
6555
|
initDualAxisPrimary,
|
6529
6556
|
dualChartTypePrimary,
|
6530
6557
|
datasetPrimary,
|
@@ -7143,11 +7170,14 @@ const initRoseParallel = (spec, context)=>{
|
|
7143
7170
|
...spec
|
7144
7171
|
};
|
7145
7172
|
const { advancedVSeed } = context;
|
7146
|
-
const { encoding, datasetReshapeInfo, dataset } = advancedVSeed;
|
7173
|
+
const { encoding, datasetReshapeInfo, dataset, dimensions } = advancedVSeed;
|
7147
7174
|
const { unfoldInfo, foldInfo } = datasetReshapeInfo[0];
|
7148
7175
|
if (!encoding[0].radius || !encoding[0].angle || !encoding[0].group) return result;
|
7176
|
+
const sameDimensionsMode = dimensions.length > 1 && dimensions.every((dim)=>dim.id === dimensions[0].id);
|
7149
7177
|
result.type = 'rose';
|
7150
|
-
result.categoryField = [
|
7178
|
+
result.categoryField = sameDimensionsMode ? [
|
7179
|
+
encoding[0].angle[0]
|
7180
|
+
] : [
|
7151
7181
|
encoding[0].angle[0],
|
7152
7182
|
unfoldInfo.groupId
|
7153
7183
|
];
|
@@ -9060,6 +9090,7 @@ const zBarStyle = z.object({
|
|
9060
9090
|
zSelector,
|
9061
9091
|
zSelectors
|
9062
9092
|
]).nullish(),
|
9093
|
+
barVisible: z.boolean().nullish(),
|
9063
9094
|
barColor: z.string().nullish(),
|
9064
9095
|
barColorOpacity: z.number().nullish(),
|
9065
9096
|
barBorderColor: z.string().nullish(),
|
@@ -9079,6 +9110,7 @@ const zPointStyle = z.object({
|
|
9079
9110
|
zSelector,
|
9080
9111
|
zSelectors
|
9081
9112
|
]).nullish(),
|
9113
|
+
pointVisible: z.boolean().nullish(),
|
9082
9114
|
pointSize: z.number().nullish(),
|
9083
9115
|
pointColor: z.string().nullish(),
|
9084
9116
|
pointColorOpacity: z.number().nullish(),
|
@@ -9097,6 +9129,7 @@ const zLineStyle = z.object({
|
|
9097
9129
|
zSelector,
|
9098
9130
|
zSelectors
|
9099
9131
|
]).nullish(),
|
9132
|
+
lineVisible: z.boolean().nullish(),
|
9100
9133
|
lineSmooth: z.boolean().nullish(),
|
9101
9134
|
lineColor: z.string().nullish(),
|
9102
9135
|
lineColorOpacity: z.number().nullish(),
|
@@ -9114,6 +9147,7 @@ const zAreaStyle = z.object({
|
|
9114
9147
|
zSelector,
|
9115
9148
|
zSelectors
|
9116
9149
|
]).nullish(),
|
9150
|
+
areaVisible: z.boolean().nullish(),
|
9117
9151
|
areaColor: z.string().nullish(),
|
9118
9152
|
areaColorOpacity: z.number().nullish()
|
9119
9153
|
});
|