@visactor/vseed 0.5.0 → 0.5.2
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/cjs/index.cjs +2 -2
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/esm/builder/builder/advanced/colorItems.d.ts +1 -0
- package/dist/esm/builder/builder/advanced/colorItems.js +21 -1
- package/dist/esm/builder/builder/advanced/colorItems.js.map +1 -1
- package/dist/esm/builder/builder/buildSpec.js.map +1 -1
- package/dist/esm/builder/builder/builder.d.ts +4 -0
- package/dist/esm/builder/builder/builder.js +2 -1
- package/dist/esm/builder/builder/builder.js.map +1 -1
- package/dist/esm/dataSelector/selector.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipes/animation/bar.js +1 -1
- package/dist/esm/pipeline/spec/chart/pipes/animation/bar.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipes/animation/lineOrArea.d.ts +4 -0
- package/dist/esm/pipeline/spec/chart/pipes/animation/radar.d.ts +4 -0
- package/dist/esm/pipeline/spec/chart/pipes/animation/utils/index.d.ts +1 -60
- package/dist/esm/pipeline/spec/chart/pipes/animation/utils/index.js +2 -44
- package/dist/esm/pipeline/spec/chart/pipes/animation/utils/index.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipes/animation/utils/pointAtmosphere.d.ts +65 -0
- package/dist/esm/pipeline/spec/chart/pipes/animation/utils/pointAtmosphere.js +56 -0
- package/dist/esm/pipeline/spec/chart/pipes/animation/utils/pointAtmosphere.js.map +1 -0
- package/dist/esm/pipeline/spec/chart/pipes/annotation/annotationArea.js +2 -2
- package/dist/esm/pipeline/spec/chart/pipes/annotation/annotationArea.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipes/annotation/annotationAreaBand.js +2 -2
- package/dist/esm/pipeline/spec/chart/pipes/annotation/annotationAreaBand.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipes/annotation/annotationDifferenceLine.js +63 -18
- package/dist/esm/pipeline/spec/chart/pipes/annotation/annotationDifferenceLine.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipes/annotation/annotationHorizontalLine.js +7 -13
- package/dist/esm/pipeline/spec/chart/pipes/annotation/annotationHorizontalLine.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipes/annotation/annotationPointCommon.js +2 -2
- package/dist/esm/pipeline/spec/chart/pipes/annotation/annotationPointCommon.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipes/annotation/annotationVerticalLine.js +9 -15
- package/dist/esm/pipeline/spec/chart/pipes/annotation/annotationVerticalLine.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipes/annotation/utils.d.ts +2 -0
- package/dist/esm/pipeline/spec/chart/pipes/annotation/utils.js +15 -1
- package/dist/esm/pipeline/spec/chart/pipes/annotation/utils.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipes/stack/stackCornerRadius.js +18 -39
- package/dist/esm/pipeline/spec/chart/pipes/stack/stackCornerRadius.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipes/stack/stackCornerRadiusUtils.d.ts +4 -0
- package/dist/esm/pipeline/spec/chart/pipes/stack/stackCornerRadiusUtils.js +50 -0
- package/dist/esm/pipeline/spec/chart/pipes/stack/stackCornerRadiusUtils.js.map +1 -0
- package/dist/esm/pipeline/utils/sandbox/execute.js.map +1 -1
- package/dist/esm/theme/tokenTheme.d.ts +6 -0
- package/dist/esm/theme/tokenTheme.js +36 -7
- package/dist/esm/theme/tokenTheme.js.map +1 -1
- package/dist/esm/types/builder/builder.d.ts +1 -0
- package/dist/esm/types/builder/builder.js.map +1 -1
- package/dist/esm/types/chartType/area/zArea.d.ts +10 -0
- package/dist/esm/types/chartType/bar/zBar.d.ts +10 -0
- package/dist/esm/types/chartType/barParallel/zBarParallel.d.ts +10 -0
- package/dist/esm/types/chartType/column/zColumn.d.ts +10 -0
- package/dist/esm/types/chartType/columnParallel/zColumnParallel.d.ts +10 -0
- package/dist/esm/types/chartType/line/zLine.d.ts +10 -0
- package/dist/esm/types/properties/annotation/annotation.d.ts +10 -0
- package/dist/esm/types/properties/annotation/annotationDifferenceLine.d.ts +4 -0
- package/dist/esm/types/properties/annotation/zAnnotationDifferenceLine.d.ts +5 -0
- package/dist/esm/types/properties/annotation/zAnnotationDifferenceLine.js +6 -1
- package/dist/esm/types/properties/annotation/zAnnotationDifferenceLine.js.map +1 -1
- package/dist/esm/types/properties/config/annotation/annotation.d.ts +32 -5
- package/dist/esm/types/properties/config/annotation/zAnnotation.d.ts +30 -4
- package/dist/esm/types/properties/config/annotation/zAnnotation.js +11 -1
- package/dist/esm/types/properties/config/annotation/zAnnotation.js.map +1 -1
- package/dist/esm/types/properties/config/area.d.ts +30 -4
- package/dist/esm/types/properties/config/bar.d.ts +45 -6
- package/dist/esm/types/properties/config/boxplot.d.ts +15 -2
- package/dist/esm/types/properties/config/column.d.ts +45 -6
- package/dist/esm/types/properties/config/config.d.ts +285 -38
- package/dist/esm/types/properties/config/dualAxis.d.ts +15 -2
- package/dist/esm/types/properties/config/histogram.d.ts +15 -2
- package/dist/esm/types/properties/config/line.d.ts +15 -2
- package/dist/esm/types/properties/config/race.d.ts +90 -12
- package/dist/esm/types/properties/config/scatter.d.ts +15 -2
- package/dist/esm/types/properties/theme/customTheme.d.ts +570 -76
- package/dist/umd/index.js +332 -184
- package/dist/umd/index.js.map +1 -1
- package/package.json +3 -8
package/dist/umd/index.js
CHANGED
|
@@ -1346,7 +1346,7 @@
|
|
|
1346
1346
|
registerScatter: ()=>registerScatter,
|
|
1347
1347
|
zAreaPercent: ()=>zAreaPercent,
|
|
1348
1348
|
isDimension: ()=>isDimension,
|
|
1349
|
-
isBarLikeChart: ()=>
|
|
1349
|
+
isBarLikeChart: ()=>isBarLikeChart,
|
|
1350
1350
|
columnParallelAdvancedPipeline: ()=>columnParallelAdvancedPipeline,
|
|
1351
1351
|
deleteDimensionTreeByCallback: ()=>deleteDimensionTreeByCallback,
|
|
1352
1352
|
zBarConfig: ()=>zBarConfig,
|
|
@@ -3202,7 +3202,7 @@ self.R = R;
|
|
|
3202
3202
|
const isAreaPercent = (vseed)=>vseed.chartType === ChartTypeEnum.AreaPercent;
|
|
3203
3203
|
const isColumnPercent = (vseed)=>vseed.chartType === ChartTypeEnum.ColumnPercent;
|
|
3204
3204
|
const isBarPercent = (vseed)=>vseed.chartType === ChartTypeEnum.BarPercent;
|
|
3205
|
-
const
|
|
3205
|
+
const isBarLikeChart = (vseed)=>vseed.chartType === ChartTypeEnum.Bar || vseed.chartType === ChartTypeEnum.RaceBar || vseed.chartType === ChartTypeEnum.BarPercent || vseed.chartType === ChartTypeEnum.BarParallel;
|
|
3206
3206
|
const isVTable = (vseed)=>[
|
|
3207
3207
|
'table',
|
|
3208
3208
|
'pivotTable'
|
|
@@ -3279,6 +3279,77 @@ self.R = R;
|
|
|
3279
3279
|
'areaPercent',
|
|
3280
3280
|
'scatter'
|
|
3281
3281
|
].includes(chartType);
|
|
3282
|
+
function colorAdapter(ordinalPipe, linearPipe) {
|
|
3283
|
+
return (spec, context)=>{
|
|
3284
|
+
const { advancedVSeed, vseed } = context;
|
|
3285
|
+
if (isLinearColor(advancedVSeed, vseed)) return linearPipe(spec, context);
|
|
3286
|
+
return ordinalPipe(spec, context);
|
|
3287
|
+
};
|
|
3288
|
+
}
|
|
3289
|
+
const isLinearColor = (advancedVSeed, vseed)=>{
|
|
3290
|
+
const { encoding, chartType } = advancedVSeed;
|
|
3291
|
+
const measureIdList = (vseed.measures || advancedVSeed.measures).map((measure)=>measure.id);
|
|
3292
|
+
const { color = [] } = encoding;
|
|
3293
|
+
return 'heatmap' === chartType ? color.length >= 1 && color.every((c)=>measureIdList.includes(c)) : 1 === color.length && measureIdList.includes(color[0]);
|
|
3294
|
+
};
|
|
3295
|
+
const getColorMeasureId = (advancedVSeed, vseed)=>{
|
|
3296
|
+
if (isLinearColor(advancedVSeed, vseed)) {
|
|
3297
|
+
const { encoding } = advancedVSeed;
|
|
3298
|
+
const { color } = encoding;
|
|
3299
|
+
return color?.[0];
|
|
3300
|
+
}
|
|
3301
|
+
};
|
|
3302
|
+
const color_color = (spec, context)=>{
|
|
3303
|
+
const result = {
|
|
3304
|
+
...spec
|
|
3305
|
+
};
|
|
3306
|
+
const { advancedVSeed } = context;
|
|
3307
|
+
const { datasetReshapeInfo, chartType } = advancedVSeed;
|
|
3308
|
+
const { unfoldInfo } = datasetReshapeInfo[0];
|
|
3309
|
+
const baseConfig = advancedVSeed.config[chartType];
|
|
3310
|
+
if (!baseConfig || !baseConfig.color) return result;
|
|
3311
|
+
const colorItems = unfoldInfo.colorItems;
|
|
3312
|
+
const colorIdMap = unfoldInfo.colorIdMap;
|
|
3313
|
+
const { color } = baseConfig;
|
|
3314
|
+
const { colorScheme, colorMapping } = color;
|
|
3315
|
+
result.color = {
|
|
3316
|
+
type: 'ordinal',
|
|
3317
|
+
domain: colorItems,
|
|
3318
|
+
range: colorScheme,
|
|
3319
|
+
specified: createSpecifiedForColorMapping(colorMapping, colorIdMap, colorItems)
|
|
3320
|
+
};
|
|
3321
|
+
return result;
|
|
3322
|
+
};
|
|
3323
|
+
const createSpecifiedForColorMapping = (colorMapping, colorIdMap, colorItems)=>{
|
|
3324
|
+
if (!colorMapping || !colorIdMap || !colorItems) return;
|
|
3325
|
+
const matchedList = [];
|
|
3326
|
+
const colors = Object.entries(colorMapping).sort((a, b)=>b[0].length - a[0].length);
|
|
3327
|
+
const accurateMap = colors.reduce((prev, cur)=>{
|
|
3328
|
+
const name = cur[0];
|
|
3329
|
+
const colorValue = cur[1];
|
|
3330
|
+
const accurateMatchedList = Object.entries(colorIdMap).filter(([colorKey, colorObj])=>colorKey === name || colorObj.alias === name || colorObj.id === name);
|
|
3331
|
+
accurateMatchedList.forEach((item)=>{
|
|
3332
|
+
prev[item[0]] = colorValue;
|
|
3333
|
+
matchedList.push(name);
|
|
3334
|
+
});
|
|
3335
|
+
return prev;
|
|
3336
|
+
}, {});
|
|
3337
|
+
const fuzzyMap = colors.reduce((prev, cur)=>{
|
|
3338
|
+
const name = cur[0];
|
|
3339
|
+
const colorValue = cur[1];
|
|
3340
|
+
if (matchedList.includes(name)) return prev;
|
|
3341
|
+
const fuzzyMatchedList = Object.entries(colorIdMap).filter(([colorKey, colorObj])=>colorKey.includes(name) || colorObj.alias.includes(name) || colorObj.id.includes(name));
|
|
3342
|
+
fuzzyMatchedList.forEach((item)=>{
|
|
3343
|
+
if (prev[item[0]]) return;
|
|
3344
|
+
prev[item[0]] = colorValue;
|
|
3345
|
+
});
|
|
3346
|
+
return prev;
|
|
3347
|
+
}, {});
|
|
3348
|
+
return {
|
|
3349
|
+
...fuzzyMap,
|
|
3350
|
+
...accurateMap
|
|
3351
|
+
};
|
|
3352
|
+
};
|
|
3282
3353
|
const getColorItems = (builder)=>{
|
|
3283
3354
|
const advancedVSeed = builder.advancedVSeed;
|
|
3284
3355
|
if (!advancedVSeed || isTable(builder.vseed) || isPivotTable(builder.vseed)) return [];
|
|
@@ -3303,6 +3374,24 @@ self.R = R;
|
|
|
3303
3374
|
}), {});
|
|
3304
3375
|
return colorIdMap;
|
|
3305
3376
|
};
|
|
3377
|
+
const getColorValueMap = (builder)=>{
|
|
3378
|
+
const advancedVSeed = builder.advancedVSeed;
|
|
3379
|
+
if (!advancedVSeed || isTable(builder.vseed) || isPivotTable(builder.vseed) || isLinearColor(advancedVSeed, builder.vseed)) return;
|
|
3380
|
+
const { datasetReshapeInfo, chartType } = advancedVSeed;
|
|
3381
|
+
const unfoldInfo = datasetReshapeInfo[0]?.unfoldInfo;
|
|
3382
|
+
const baseConfig = advancedVSeed.config?.[chartType];
|
|
3383
|
+
const colorConfig = baseConfig?.color;
|
|
3384
|
+
if (!unfoldInfo || !colorConfig) return;
|
|
3385
|
+
const colorItems = unfoldInfo.colorItems ?? [];
|
|
3386
|
+
const colorIdMap = unfoldInfo.colorIdMap;
|
|
3387
|
+
const colorScheme = colorConfig.colorScheme ?? [];
|
|
3388
|
+
const specified = createSpecifiedForColorMapping(colorConfig.colorMapping, colorIdMap, colorItems) ?? {};
|
|
3389
|
+
return colorItems.reduce((prev, colorId, index)=>{
|
|
3390
|
+
const colorValue = specified[colorId] ?? colorScheme[index % colorScheme.length];
|
|
3391
|
+
if (colorValue) prev[colorId] = colorValue;
|
|
3392
|
+
return prev;
|
|
3393
|
+
}, {});
|
|
3394
|
+
};
|
|
3306
3395
|
class Builder {
|
|
3307
3396
|
_vseed;
|
|
3308
3397
|
_advancedVSeed = null;
|
|
@@ -3323,6 +3412,7 @@ self.R = R;
|
|
|
3323
3412
|
buildAdvanced = ()=>buildAdvanced(this);
|
|
3324
3413
|
getColorItems = ()=>getColorItems(this);
|
|
3325
3414
|
getColorIdMap = ()=>getColorIdMap(this);
|
|
3415
|
+
getColorValueMap = ()=>getColorValueMap(this);
|
|
3326
3416
|
get vseed() {
|
|
3327
3417
|
return this._vseed;
|
|
3328
3418
|
}
|
|
@@ -5422,26 +5512,6 @@ self.R = R;
|
|
|
5422
5512
|
unfoldInfo
|
|
5423
5513
|
};
|
|
5424
5514
|
};
|
|
5425
|
-
function colorAdapter(ordinalPipe, linearPipe) {
|
|
5426
|
-
return (spec, context)=>{
|
|
5427
|
-
const { advancedVSeed, vseed } = context;
|
|
5428
|
-
if (isLinearColor(advancedVSeed, vseed)) return linearPipe(spec, context);
|
|
5429
|
-
return ordinalPipe(spec, context);
|
|
5430
|
-
};
|
|
5431
|
-
}
|
|
5432
|
-
const isLinearColor = (advancedVSeed, vseed)=>{
|
|
5433
|
-
const { encoding, chartType } = advancedVSeed;
|
|
5434
|
-
const measureIdList = (vseed.measures || advancedVSeed.measures).map((measure)=>measure.id);
|
|
5435
|
-
const { color = [] } = encoding;
|
|
5436
|
-
return 'heatmap' === chartType ? color.length >= 1 && color.every((c)=>measureIdList.includes(c)) : 1 === color.length && measureIdList.includes(color[0]);
|
|
5437
|
-
};
|
|
5438
|
-
const getColorMeasureId = (advancedVSeed, vseed)=>{
|
|
5439
|
-
if (isLinearColor(advancedVSeed, vseed)) {
|
|
5440
|
-
const { encoding } = advancedVSeed;
|
|
5441
|
-
const { color } = encoding;
|
|
5442
|
-
return color?.[0];
|
|
5443
|
-
}
|
|
5444
|
-
};
|
|
5445
5515
|
const reshapeWithEncoding = (advancedVSeed, context)=>{
|
|
5446
5516
|
const result = {
|
|
5447
5517
|
...advancedVSeed
|
|
@@ -5729,48 +5799,6 @@ self.R = R;
|
|
|
5729
5799
|
const effect = effects[effects.length - 1] ?? EFFECT_NONE;
|
|
5730
5800
|
return effect !== EFFECT_NONE;
|
|
5731
5801
|
};
|
|
5732
|
-
const atmospherePoint = (effect)=>{
|
|
5733
|
-
if (effect === EFFECT_NONE) return {};
|
|
5734
|
-
if ('breath' === effect) return {
|
|
5735
|
-
channel: {
|
|
5736
|
-
scaleX: {
|
|
5737
|
-
from: 0.8,
|
|
5738
|
-
to: 1.2
|
|
5739
|
-
},
|
|
5740
|
-
scaleY: {
|
|
5741
|
-
from: 0.8,
|
|
5742
|
-
to: 1.2
|
|
5743
|
-
}
|
|
5744
|
-
}
|
|
5745
|
-
};
|
|
5746
|
-
if ('reveal' === effect) return {
|
|
5747
|
-
channel: {
|
|
5748
|
-
fillOpacity: {
|
|
5749
|
-
from: 0.6,
|
|
5750
|
-
to: 1
|
|
5751
|
-
},
|
|
5752
|
-
strokeOpacity: {
|
|
5753
|
-
from: 0.6,
|
|
5754
|
-
to: 1
|
|
5755
|
-
}
|
|
5756
|
-
}
|
|
5757
|
-
};
|
|
5758
|
-
return {
|
|
5759
|
-
channel: {
|
|
5760
|
-
outerBorder: {
|
|
5761
|
-
from: {
|
|
5762
|
-
distance: 0,
|
|
5763
|
-
strokeOpacity: 1
|
|
5764
|
-
},
|
|
5765
|
-
to: (...args)=>({
|
|
5766
|
-
distance: 16,
|
|
5767
|
-
strokeOpacity: 1e-8,
|
|
5768
|
-
stroke: args[1]?.attribute?.fill
|
|
5769
|
-
})
|
|
5770
|
-
}
|
|
5771
|
-
}
|
|
5772
|
-
};
|
|
5773
|
-
};
|
|
5774
5802
|
class Generator {
|
|
5775
5803
|
static GenAutoIncrementId() {
|
|
5776
5804
|
return Generator.auto_increment_id++;
|
|
@@ -8998,7 +9026,7 @@ self.R = R;
|
|
|
8998
9026
|
if (loopEffect === VScreenAnimationType.highLight && loop) {
|
|
8999
9027
|
const groupDuration = 0.7;
|
|
9000
9028
|
const stopDuration = 0.85;
|
|
9001
|
-
loopDuration = groupDuration * getGroupCountFromSpec(spec).groupCount + stopDuration;
|
|
9029
|
+
loopDuration = loop.duration ?? groupDuration * getGroupCountFromSpec(spec).groupCount + stopDuration;
|
|
9002
9030
|
result.push(...groupHighLightBar(startTime, loop, loopDuration, interval, atmosphereDuration, barMotion_isHorizontalBar(chartType), spec));
|
|
9003
9031
|
} else if (loop) result.push({
|
|
9004
9032
|
...getLoopResult(loopEffect, chartType, spec),
|
|
@@ -9042,6 +9070,57 @@ self.R = R;
|
|
|
9042
9070
|
}
|
|
9043
9071
|
};
|
|
9044
9072
|
};
|
|
9073
|
+
const pointAtmosphere_EFFECT_NONE = VScreenAnimationType.none;
|
|
9074
|
+
const atmospherePoint = (effect)=>{
|
|
9075
|
+
if (effect === pointAtmosphere_EFFECT_NONE) return {};
|
|
9076
|
+
if ('breath' === effect) return {
|
|
9077
|
+
channel: {
|
|
9078
|
+
scaleX: {
|
|
9079
|
+
from: 0.8,
|
|
9080
|
+
to: 2
|
|
9081
|
+
},
|
|
9082
|
+
scaleY: {
|
|
9083
|
+
from: 0.8,
|
|
9084
|
+
to: 2
|
|
9085
|
+
}
|
|
9086
|
+
}
|
|
9087
|
+
};
|
|
9088
|
+
if ('reveal' === effect) return {
|
|
9089
|
+
channel: {
|
|
9090
|
+
fillOpacity: {
|
|
9091
|
+
from: 0.6,
|
|
9092
|
+
to: 1
|
|
9093
|
+
},
|
|
9094
|
+
strokeOpacity: {
|
|
9095
|
+
from: 0.6,
|
|
9096
|
+
to: 1
|
|
9097
|
+
}
|
|
9098
|
+
}
|
|
9099
|
+
};
|
|
9100
|
+
return {
|
|
9101
|
+
channel: {
|
|
9102
|
+
outerBorder: {
|
|
9103
|
+
from: {
|
|
9104
|
+
distance: 0,
|
|
9105
|
+
strokeOpacity: 1
|
|
9106
|
+
},
|
|
9107
|
+
to: (...args)=>({
|
|
9108
|
+
distance: 16,
|
|
9109
|
+
strokeOpacity: 1e-8,
|
|
9110
|
+
stroke: args[1]?.attribute?.fill
|
|
9111
|
+
})
|
|
9112
|
+
}
|
|
9113
|
+
},
|
|
9114
|
+
custom: (ratio, from, to, out, graphic)=>{
|
|
9115
|
+
graphic.attribute.strokeOpacity = ratio * (to.strokeOpacity - from.strokeOpacity) + from.strokeOpacity;
|
|
9116
|
+
graphic.attribute.outerBorder = {
|
|
9117
|
+
distance: ratio * (to.outerBorder.distance - from.outerBorder.distance) + from.outerBorder.distance,
|
|
9118
|
+
strokeOpacity: ratio * (to.outerBorder.strokeOpacity - from.outerBorder.strokeOpacity) + from.outerBorder.strokeOpacity,
|
|
9119
|
+
stroke: to.outerBorder.stroke
|
|
9120
|
+
};
|
|
9121
|
+
}
|
|
9122
|
+
};
|
|
9123
|
+
};
|
|
9045
9124
|
const growthTopLine = ()=>({
|
|
9046
9125
|
type: 'growPointsYIn',
|
|
9047
9126
|
options: {
|
|
@@ -9616,57 +9695,6 @@ self.R = R;
|
|
|
9616
9695
|
]
|
|
9617
9696
|
};
|
|
9618
9697
|
};
|
|
9619
|
-
const color_color = (spec, context)=>{
|
|
9620
|
-
const result = {
|
|
9621
|
-
...spec
|
|
9622
|
-
};
|
|
9623
|
-
const { advancedVSeed } = context;
|
|
9624
|
-
const { datasetReshapeInfo, chartType } = advancedVSeed;
|
|
9625
|
-
const { unfoldInfo } = datasetReshapeInfo[0];
|
|
9626
|
-
const baseConfig = advancedVSeed.config[chartType];
|
|
9627
|
-
if (!baseConfig || !baseConfig.color) return result;
|
|
9628
|
-
const colorItems = unfoldInfo.colorItems;
|
|
9629
|
-
const colorIdMap = unfoldInfo.colorIdMap;
|
|
9630
|
-
const { color } = baseConfig;
|
|
9631
|
-
const { colorScheme, colorMapping } = color;
|
|
9632
|
-
result.color = {
|
|
9633
|
-
type: 'ordinal',
|
|
9634
|
-
domain: colorItems,
|
|
9635
|
-
range: colorScheme,
|
|
9636
|
-
specified: createSpecifiedForColorMapping(colorMapping, colorIdMap, colorItems)
|
|
9637
|
-
};
|
|
9638
|
-
return result;
|
|
9639
|
-
};
|
|
9640
|
-
const createSpecifiedForColorMapping = (colorMapping, colorIdMap, colorItems)=>{
|
|
9641
|
-
if (!colorMapping || !colorIdMap || !colorItems) return;
|
|
9642
|
-
const matchedList = [];
|
|
9643
|
-
const colors = Object.entries(colorMapping).sort((a, b)=>b[0].length - a[0].length);
|
|
9644
|
-
const accurateMap = colors.reduce((prev, cur)=>{
|
|
9645
|
-
const name = cur[0];
|
|
9646
|
-
const colorValue = cur[1];
|
|
9647
|
-
const accurateMatchedList = Object.entries(colorIdMap).filter(([colorKey, colorObj])=>colorKey === name || colorObj.alias === name || colorObj.id === name);
|
|
9648
|
-
accurateMatchedList.forEach((item)=>{
|
|
9649
|
-
prev[item[0]] = colorValue;
|
|
9650
|
-
matchedList.push(name);
|
|
9651
|
-
});
|
|
9652
|
-
return prev;
|
|
9653
|
-
}, {});
|
|
9654
|
-
const fuzzyMap = colors.reduce((prev, cur)=>{
|
|
9655
|
-
const name = cur[0];
|
|
9656
|
-
const colorValue = cur[1];
|
|
9657
|
-
if (matchedList.includes(name)) return prev;
|
|
9658
|
-
const fuzzyMatchedList = Object.entries(colorIdMap).filter(([colorKey, colorObj])=>colorKey.includes(name) || colorObj.alias.includes(name) || colorObj.id.includes(name));
|
|
9659
|
-
fuzzyMatchedList.forEach((item)=>{
|
|
9660
|
-
if (prev[item[0]]) return;
|
|
9661
|
-
prev[item[0]] = colorValue;
|
|
9662
|
-
});
|
|
9663
|
-
return prev;
|
|
9664
|
-
}, {});
|
|
9665
|
-
return {
|
|
9666
|
-
...fuzzyMap,
|
|
9667
|
-
...accurateMap
|
|
9668
|
-
};
|
|
9669
|
-
};
|
|
9670
9698
|
const linearColor = (spec, context)=>{
|
|
9671
9699
|
const result = {
|
|
9672
9700
|
...spec
|
|
@@ -10843,6 +10871,20 @@ self.R = R;
|
|
|
10843
10871
|
...meaContent
|
|
10844
10872
|
];
|
|
10845
10873
|
};
|
|
10874
|
+
const getAnnotationLineDash = (lineStyle, lineDash)=>{
|
|
10875
|
+
if (Array.isArray(lineDash)) return lineDash;
|
|
10876
|
+
if ('dashed' === lineStyle) return [
|
|
10877
|
+
2,
|
|
10878
|
+
2
|
|
10879
|
+
];
|
|
10880
|
+
if ('dotted' === lineStyle) return [
|
|
10881
|
+
2,
|
|
10882
|
+
5
|
|
10883
|
+
];
|
|
10884
|
+
return [
|
|
10885
|
+
0
|
|
10886
|
+
];
|
|
10887
|
+
};
|
|
10846
10888
|
const isSubset = (sub, obj, excludeMeasuresIds)=>Object.entries(sub).every(([key, value])=>{
|
|
10847
10889
|
if (excludeMeasuresIds && excludeMeasuresIds.includes(key)) return false;
|
|
10848
10890
|
if ('string' == typeof value) return obj[key] === value;
|
|
@@ -10924,7 +10966,7 @@ self.R = R;
|
|
|
10924
10966
|
const annotationPointList = Array.isArray(annotationPoint) ? annotationPoint : [
|
|
10925
10967
|
annotationPoint
|
|
10926
10968
|
];
|
|
10927
|
-
const isHorizontalBar =
|
|
10969
|
+
const isHorizontalBar = isBarLikeChart(advancedVSeed);
|
|
10928
10970
|
const defaultStyle = isHorizontalBar ? {
|
|
10929
10971
|
textAlign: 'right',
|
|
10930
10972
|
textBaseline: 'middle'
|
|
@@ -10934,6 +10976,7 @@ self.R = R;
|
|
|
10934
10976
|
};
|
|
10935
10977
|
const markPoint = annotationPointList.flatMap((annotationPoint)=>{
|
|
10936
10978
|
const { selector: selectorPoint, measureId, dynamicFilter, text = '', textColor = theme?.textColor ?? '#ffffff', textFontSize = theme?.textFontSize ?? 12, textFontWeight = theme?.textFontWeight ?? 400, textAlign = defaultStyle.textAlign, textBaseline = defaultStyle.textBaseline, textBackgroundBorderColor = theme?.textBackgroundBorderColor, textBackgroundBorderRadius = theme?.textBackgroundBorderRadius ?? 4, textBackgroundBorderWidth = theme?.textBackgroundBorderWidth ?? 1, textBackgroundColor = theme?.textBackgroundColor ?? '#212121', textBackgroundPadding = theme?.textBackgroundPadding ?? 2, textBackgroundVisible = theme?.textBackgroundVisible ?? true, offsetX = theme?.offsetX ?? 0, offsetY = theme?.offsetY ?? 0 } = annotationPoint;
|
|
10979
|
+
const textBackgroundOpacity = theme?.textBackgroundOpacity;
|
|
10937
10980
|
const dataset = advancedVSeed.dataset.flat();
|
|
10938
10981
|
const selectedData = selectorPoint || dynamicFilter ? findSelectedDatas({
|
|
10939
10982
|
dataset,
|
|
@@ -10961,7 +11004,7 @@ self.R = R;
|
|
|
10961
11004
|
visible: textBackgroundVisible,
|
|
10962
11005
|
padding: textBackgroundPadding,
|
|
10963
11006
|
style: {
|
|
10964
|
-
opacity: 0.95,
|
|
11007
|
+
opacity: textBackgroundOpacity ?? 0.95,
|
|
10965
11008
|
cornerRadius: textBackgroundBorderRadius ?? 4,
|
|
10966
11009
|
fill: textBackgroundColor,
|
|
10967
11010
|
stroke: textBackgroundBorderColor,
|
|
@@ -10972,7 +11015,6 @@ self.R = R;
|
|
|
10972
11015
|
}
|
|
10973
11016
|
},
|
|
10974
11017
|
style: {
|
|
10975
|
-
opacity: 0.95,
|
|
10976
11018
|
visible: true,
|
|
10977
11019
|
textAlign: textAlign,
|
|
10978
11020
|
textBaseline: textBaseline,
|
|
@@ -11209,14 +11251,19 @@ self.R = R;
|
|
|
11209
11251
|
if ('percent' === differenceType) return `${(100 * differenceValue).toFixed(2)}%`;
|
|
11210
11252
|
return `${differenceValue}`;
|
|
11211
11253
|
};
|
|
11254
|
+
const inferDifferenceConnectDirection = (vseed, values)=>{
|
|
11255
|
+
const isNegativeSide = values.every((value)=>value < 0);
|
|
11256
|
+
if (isBarLikeChart(vseed)) return isNegativeSide ? 'left' : 'right';
|
|
11257
|
+
return isNegativeSide ? 'bottom' : 'top';
|
|
11258
|
+
};
|
|
11212
11259
|
const DEFAULT_LINE_COLOR = '#BCC1CB';
|
|
11213
11260
|
const DEFAULT_TEXT_COLOR = '#ffffff';
|
|
11214
11261
|
const DEFAULT_TEXT_BACKGROUND_COLOR = '#BCC1CB';
|
|
11215
11262
|
const DEFAULT_TEXT_FONT_SIZE = 12;
|
|
11216
|
-
const DEFAULT_LINE_WIDTH =
|
|
11217
|
-
const DEFAULT_CORNER_RADIUS =
|
|
11263
|
+
const DEFAULT_LINE_WIDTH = 1;
|
|
11264
|
+
const DEFAULT_CORNER_RADIUS = 3;
|
|
11218
11265
|
const DEFAULT_LABEL_PADDING = 4;
|
|
11219
|
-
const DEFAULT_END_SYMBOL_SIZE =
|
|
11266
|
+
const DEFAULT_END_SYMBOL_SIZE = 6;
|
|
11220
11267
|
const DEFAULT_END_SYMBOL_REF_X = -4;
|
|
11221
11268
|
const DEFAULT_GUTTER_BASE_OFFSET = 20;
|
|
11222
11269
|
const DEFAULT_GUTTER_RIGHT_PADDING = 44;
|
|
@@ -11229,6 +11276,7 @@ self.R = R;
|
|
|
11229
11276
|
type: 'percent',
|
|
11230
11277
|
fractionDigits: 2
|
|
11231
11278
|
};
|
|
11279
|
+
const shouldInferDifferenceConnectDirection = (chartType)=>'column' === chartType || 'bar' === chartType || 'columnParallel' === chartType || 'barParallel' === chartType;
|
|
11232
11280
|
const getDifferenceLinePath = (index, total)=>1 === total ? 'annotationDifferenceLine' : `annotationDifferenceLine[${index}]`;
|
|
11233
11281
|
const annotationDifferenceLine_toArray = (value)=>{
|
|
11234
11282
|
if (Array.isArray(value)) return value;
|
|
@@ -11269,21 +11317,45 @@ self.R = R;
|
|
|
11269
11317
|
]
|
|
11270
11318
|
};
|
|
11271
11319
|
};
|
|
11272
|
-
const buildFixedGutterExpandDistance = (
|
|
11320
|
+
const buildFixedGutterExpandDistance = (connectDirection)=>(_markerData, context)=>{
|
|
11273
11321
|
const region = context?.region;
|
|
11274
11322
|
const coordinatePoints = Array.isArray(context?.coordinatePoints) ? context.coordinatePoints : [];
|
|
11275
11323
|
if (!region || 0 === coordinatePoints.length) return 0;
|
|
11276
11324
|
const { x: regionStartX, y: regionStartY } = region.getLayoutStartPoint();
|
|
11277
|
-
const { width } = region.getLayoutRect();
|
|
11278
|
-
if (
|
|
11325
|
+
const { width, height } = region.getLayoutRect();
|
|
11326
|
+
if ('top' === connectDirection) {
|
|
11279
11327
|
const targetY = regionStartY - DEFAULT_GUTTER_BASE_OFFSET;
|
|
11280
11328
|
const minY = Math.min(...coordinatePoints.map((point)=>point.y));
|
|
11281
11329
|
return Math.max(0, minY - targetY);
|
|
11282
11330
|
}
|
|
11331
|
+
if ('bottom' === connectDirection) {
|
|
11332
|
+
const targetY = regionStartY + height + DEFAULT_GUTTER_BASE_OFFSET;
|
|
11333
|
+
const maxY = Math.max(...coordinatePoints.map((point)=>point.y));
|
|
11334
|
+
return Math.max(0, targetY - maxY);
|
|
11335
|
+
}
|
|
11336
|
+
if ('left' === connectDirection) {
|
|
11337
|
+
const targetX = regionStartX - DEFAULT_GUTTER_BASE_OFFSET;
|
|
11338
|
+
const minX = Math.min(...coordinatePoints.map((point)=>point.x));
|
|
11339
|
+
return Math.max(0, minX - targetX);
|
|
11340
|
+
}
|
|
11283
11341
|
const targetX = regionStartX + width + DEFAULT_GUTTER_BASE_OFFSET;
|
|
11284
11342
|
const maxX = Math.max(...coordinatePoints.map((point)=>point.x));
|
|
11285
11343
|
return Math.max(0, targetX - maxX);
|
|
11286
11344
|
};
|
|
11345
|
+
const getDifferenceLinePaddingPatch = (connectDirection)=>{
|
|
11346
|
+
if ('top' === connectDirection) return {
|
|
11347
|
+
top: DEFAULT_GUTTER_TOP_PADDING
|
|
11348
|
+
};
|
|
11349
|
+
if ('bottom' === connectDirection) return {
|
|
11350
|
+
bottom: DEFAULT_GUTTER_TOP_PADDING
|
|
11351
|
+
};
|
|
11352
|
+
if ('left' === connectDirection) return {
|
|
11353
|
+
left: DEFAULT_GUTTER_RIGHT_PADDING
|
|
11354
|
+
};
|
|
11355
|
+
return {
|
|
11356
|
+
right: DEFAULT_GUTTER_RIGHT_PADDING
|
|
11357
|
+
};
|
|
11358
|
+
};
|
|
11287
11359
|
const getAxisFormatter = (spec)=>{
|
|
11288
11360
|
const valueAxisOrient = 'horizontal' === spec.direction ? 'bottom' : 'left';
|
|
11289
11361
|
const formatMethod = spec.axes?.find((axis)=>axis.orient === valueAxisOrient)?.label?.formatMethod;
|
|
@@ -11352,6 +11424,12 @@ self.R = R;
|
|
|
11352
11424
|
const axisFormatter = getAxisFormatter(chartSpec);
|
|
11353
11425
|
const percentFormatter = createFormatter(DEFAULT_PERCENT_DIFFERENCE_FORMAT);
|
|
11354
11426
|
const isHorizontalChart = 'horizontal' === chartSpec.direction;
|
|
11427
|
+
const paddingPatch = {
|
|
11428
|
+
top: 0,
|
|
11429
|
+
right: 0,
|
|
11430
|
+
bottom: 0,
|
|
11431
|
+
left: 0
|
|
11432
|
+
};
|
|
11355
11433
|
const markLine = annotationDifferenceLineList.flatMap((annotationDifferenceLine, index)=>{
|
|
11356
11434
|
try {
|
|
11357
11435
|
assertDifferenceLineConfig(annotationDifferenceLine, getDifferenceLinePath(index, annotationDifferenceLineList.length));
|
|
@@ -11375,11 +11453,23 @@ self.R = R;
|
|
|
11375
11453
|
if (start.mode !== end.mode) return [];
|
|
11376
11454
|
const usesRuntimeStackEnd = useElementStackEnd || ('column' === vseed.chartType || 'bar' === vseed.chartType) && 'element' === start.mode && 'auto' === stackResolveMode;
|
|
11377
11455
|
const useBracketStyle = isBracketChart || ('column' === vseed.chartType || 'bar' === vseed.chartType) && 'element' === start.mode && 'auto' === stackResolveMode;
|
|
11378
|
-
const connectDirection =
|
|
11379
|
-
|
|
11456
|
+
const connectDirection = shouldInferDifferenceConnectDirection(vseed.chartType) ? inferDifferenceConnectDirection(vseed, [
|
|
11457
|
+
start.value,
|
|
11458
|
+
end.value
|
|
11459
|
+
]) : isHorizontalChart ? 'top' : 'right';
|
|
11460
|
+
const expandDistance = buildFixedGutterExpandDistance(connectDirection);
|
|
11461
|
+
const currentPaddingPatch = getDifferenceLinePaddingPatch(connectDirection);
|
|
11462
|
+
paddingPatch.top = Math.max(paddingPatch.top, currentPaddingPatch.top ?? 0);
|
|
11463
|
+
paddingPatch.right = Math.max(paddingPatch.right, currentPaddingPatch.right ?? 0);
|
|
11464
|
+
paddingPatch.bottom = Math.max(paddingPatch.bottom, currentPaddingPatch.bottom ?? 0);
|
|
11465
|
+
paddingPatch.left = Math.max(paddingPatch.left, currentPaddingPatch.left ?? 0);
|
|
11380
11466
|
const lineColor = annotationDifferenceLine.lineColor ?? theme?.lineColor ?? DEFAULT_LINE_COLOR;
|
|
11467
|
+
const lineStyle = annotationDifferenceLine.lineStyle;
|
|
11468
|
+
const themeLineStyle = theme?.lineStyle;
|
|
11469
|
+
const configuredLineDash = lineStyle ? getAnnotationLineDash(lineStyle) : theme?.lineDash ?? (themeLineStyle ? getAnnotationLineDash(themeLineStyle) : void 0);
|
|
11381
11470
|
const textColor = annotationDifferenceLine.textColor ?? theme?.textColor ?? DEFAULT_TEXT_COLOR;
|
|
11382
11471
|
const textBackgroundColor = annotationDifferenceLine.textBackgroundColor ?? theme?.textBackgroundColor ?? DEFAULT_TEXT_BACKGROUND_COLOR;
|
|
11472
|
+
const textBackgroundOpacity = theme?.textBackgroundOpacity;
|
|
11383
11473
|
const textFontSize = annotationDifferenceLine.textFontSize ?? theme?.textFontSize ?? DEFAULT_TEXT_FONT_SIZE;
|
|
11384
11474
|
const differenceType = annotationDifferenceLine.differenceType ?? 'absolute';
|
|
11385
11475
|
const startMeasureId = resolveDifferenceMeasureId(start, annotationDifferenceLine.start.selector, measureIds);
|
|
@@ -11414,6 +11504,7 @@ self.R = R;
|
|
|
11414
11504
|
visible: true,
|
|
11415
11505
|
padding: DEFAULT_LABEL_PADDING,
|
|
11416
11506
|
style: {
|
|
11507
|
+
opacity: textBackgroundOpacity ?? 0.95,
|
|
11417
11508
|
fill: textBackgroundColor,
|
|
11418
11509
|
fillOpacity: 1,
|
|
11419
11510
|
stroke: lineColor,
|
|
@@ -11434,6 +11525,7 @@ self.R = R;
|
|
|
11434
11525
|
visible: true,
|
|
11435
11526
|
padding: DEFAULT_LABEL_PADDING,
|
|
11436
11527
|
style: {
|
|
11528
|
+
opacity: textBackgroundOpacity ?? 0.95,
|
|
11437
11529
|
fill: textBackgroundColor,
|
|
11438
11530
|
fillOpacity: 1,
|
|
11439
11531
|
stroke: lineColor,
|
|
@@ -11477,18 +11569,21 @@ self.R = R;
|
|
|
11477
11569
|
visible: true,
|
|
11478
11570
|
stroke: lineColor,
|
|
11479
11571
|
lineWidth: DEFAULT_LINE_WIDTH,
|
|
11480
|
-
lineDash: DEFAULT_BRACKET_LINE_DASH
|
|
11572
|
+
lineDash: configuredLineDash ?? DEFAULT_BRACKET_LINE_DASH
|
|
11481
11573
|
},
|
|
11482
11574
|
{
|
|
11483
11575
|
visible: true,
|
|
11484
11576
|
stroke: lineColor,
|
|
11485
|
-
lineWidth: DEFAULT_LINE_WIDTH
|
|
11577
|
+
lineWidth: DEFAULT_LINE_WIDTH,
|
|
11578
|
+
...configuredLineDash ? {
|
|
11579
|
+
lineDash: configuredLineDash
|
|
11580
|
+
} : {}
|
|
11486
11581
|
},
|
|
11487
11582
|
{
|
|
11488
11583
|
visible: true,
|
|
11489
11584
|
stroke: lineColor,
|
|
11490
11585
|
lineWidth: DEFAULT_LINE_WIDTH,
|
|
11491
|
-
lineDash: DEFAULT_BRACKET_LINE_DASH
|
|
11586
|
+
lineDash: configuredLineDash ?? DEFAULT_BRACKET_LINE_DASH
|
|
11492
11587
|
}
|
|
11493
11588
|
]
|
|
11494
11589
|
} : {
|
|
@@ -11496,7 +11591,7 @@ self.R = R;
|
|
|
11496
11591
|
visible: true,
|
|
11497
11592
|
stroke: lineColor,
|
|
11498
11593
|
lineWidth: DEFAULT_LINE_WIDTH,
|
|
11499
|
-
lineDash: [
|
|
11594
|
+
lineDash: configuredLineDash ?? [
|
|
11500
11595
|
0
|
|
11501
11596
|
],
|
|
11502
11597
|
cornerRadius: DEFAULT_CORNER_RADIUS
|
|
@@ -11529,11 +11624,7 @@ self.R = R;
|
|
|
11529
11624
|
]
|
|
11530
11625
|
};
|
|
11531
11626
|
if (0 === markLine.length) return nextSpec;
|
|
11532
|
-
return mergeDifferenceLineRegionPadding(nextSpec,
|
|
11533
|
-
top: DEFAULT_GUTTER_TOP_PADDING
|
|
11534
|
-
} : {
|
|
11535
|
-
right: DEFAULT_GUTTER_RIGHT_PADDING
|
|
11536
|
-
});
|
|
11627
|
+
return mergeDifferenceLineRegionPadding(nextSpec, paddingPatch);
|
|
11537
11628
|
};
|
|
11538
11629
|
const annotationVerticalLine_annotationVerticalLine = (spec, context)=>{
|
|
11539
11630
|
const { advancedVSeed, vseed } = context;
|
|
@@ -11553,7 +11644,10 @@ self.R = R;
|
|
|
11553
11644
|
insideEnd: 'insideEndTop'
|
|
11554
11645
|
};
|
|
11555
11646
|
const markLine = annotationVerticalLineList.flatMap((annotationVerticalLine)=>{
|
|
11556
|
-
const { xValue, dynamicFilter, text = '', textPosition = 'insideEnd', textColor = theme?.textColor ?? '#ffffff', textFontSize = theme?.textFontSize ?? 12, textFontWeight = theme?.textFontWeight ?? 400, textAlign = 'center', textBaseline = 'top', lineColor = theme?.lineColor ?? '#212121',
|
|
11647
|
+
const { xValue, dynamicFilter, text = '', textPosition = 'insideEnd', textColor = theme?.textColor ?? '#ffffff', textFontSize = theme?.textFontSize ?? 12, textFontWeight = theme?.textFontWeight ?? 400, textAlign = 'center', textBaseline = 'top', lineColor = theme?.lineColor ?? '#212121', lineVisible = theme?.lineStyle ?? true, lineWidth = theme?.lineWidth ?? 1, textBackgroundVisible = theme?.textBackgroundVisible ?? true, textBackgroundColor = theme?.textBackgroundColor ?? '#212121', textBackgroundBorderColor = theme?.textBackgroundBorderColor ?? '#212121', textBackgroundBorderRadius = theme?.textBackgroundBorderRadius ?? 4, textBackgroundBorderWidth = theme?.textBackgroundBorderWidth ?? 1, textBackgroundPadding = theme?.textBackgroundPadding ?? 2 } = annotationVerticalLine;
|
|
11648
|
+
const lineStyle = annotationVerticalLine.lineStyle ?? theme?.lineStyle ?? 'dashed';
|
|
11649
|
+
const lineDash = getAnnotationLineDash(lineStyle, annotationVerticalLine.lineStyle ? void 0 : theme?.lineDash);
|
|
11650
|
+
const textBackgroundOpacity = theme?.textBackgroundOpacity;
|
|
11557
11651
|
const generateOneMarkLine = (x)=>({
|
|
11558
11652
|
x,
|
|
11559
11653
|
autoRange: true,
|
|
@@ -11564,15 +11658,7 @@ self.R = R;
|
|
|
11564
11658
|
stroke: lineColor,
|
|
11565
11659
|
lineStyle: lineStyle,
|
|
11566
11660
|
lineWidth: lineWidth,
|
|
11567
|
-
lineDash
|
|
11568
|
-
5,
|
|
11569
|
-
2
|
|
11570
|
-
] : 'dotted' === lineStyle ? [
|
|
11571
|
-
2,
|
|
11572
|
-
5
|
|
11573
|
-
] : [
|
|
11574
|
-
0
|
|
11575
|
-
]
|
|
11661
|
+
lineDash
|
|
11576
11662
|
}
|
|
11577
11663
|
},
|
|
11578
11664
|
label: {
|
|
@@ -11580,7 +11666,6 @@ self.R = R;
|
|
|
11580
11666
|
text: text,
|
|
11581
11667
|
position: positionMap[textPosition || 'insideEnd'],
|
|
11582
11668
|
style: {
|
|
11583
|
-
opacity: 0.95,
|
|
11584
11669
|
dx: 5,
|
|
11585
11670
|
visible: true,
|
|
11586
11671
|
stroke: textBackgroundColor,
|
|
@@ -11595,13 +11680,13 @@ self.R = R;
|
|
|
11595
11680
|
visible: textBackgroundVisible,
|
|
11596
11681
|
padding: textBackgroundPadding,
|
|
11597
11682
|
style: {
|
|
11598
|
-
opacity: 0.95,
|
|
11683
|
+
opacity: textBackgroundOpacity ?? 0.95,
|
|
11599
11684
|
dx: 5,
|
|
11600
11685
|
cornerRadius: textBackgroundBorderRadius,
|
|
11601
11686
|
fill: textBackgroundColor,
|
|
11602
|
-
fillOpacity: 1,
|
|
11603
11687
|
stroke: textBackgroundBorderColor,
|
|
11604
|
-
lineWidth: textBackgroundBorderWidth
|
|
11688
|
+
lineWidth: textBackgroundBorderWidth,
|
|
11689
|
+
fillOpacity: 1
|
|
11605
11690
|
}
|
|
11606
11691
|
}
|
|
11607
11692
|
},
|
|
@@ -11665,7 +11750,10 @@ self.R = R;
|
|
|
11665
11750
|
insideEnd: 'insideEndTop'
|
|
11666
11751
|
};
|
|
11667
11752
|
const markLine = annotationHorizontalLineList.flatMap((annotationHorizontalLine)=>{
|
|
11668
|
-
const { yValue, dynamicFilter, text = '', textPosition = 'insideEnd', textColor = theme?.textColor ?? '#ffffff', textFontSize = theme?.textFontSize ?? 12, textFontWeight = theme?.textFontWeight ?? 400, textAlign = 'right', textBaseline = 'bottom', lineColor = theme?.lineColor ?? '#212121',
|
|
11753
|
+
const { yValue, dynamicFilter, text = '', textPosition = 'insideEnd', textColor = theme?.textColor ?? '#ffffff', textFontSize = theme?.textFontSize ?? 12, textFontWeight = theme?.textFontWeight ?? 400, textAlign = 'right', textBaseline = 'bottom', lineColor = theme?.lineColor ?? '#212121', lineVisible = theme?.lineStyle ?? true, lineWidth = theme?.lineWidth ?? 1, textBackgroundVisible = theme?.textBackgroundVisible ?? true, textBackgroundColor = theme?.textBackgroundColor ?? '#212121', textBackgroundBorderColor = theme?.textBackgroundBorderColor ?? '#212121', textBackgroundBorderRadius = theme?.textBackgroundBorderRadius ?? 4, textBackgroundBorderWidth = theme?.textBackgroundBorderWidth ?? 1, textBackgroundPadding = theme?.textBackgroundPadding ?? 2 } = annotationHorizontalLine;
|
|
11754
|
+
const lineStyle = annotationHorizontalLine.lineStyle ?? theme?.lineStyle ?? 'dashed';
|
|
11755
|
+
const lineDash = getAnnotationLineDash(lineStyle, annotationHorizontalLine.lineStyle ? void 0 : theme?.lineDash);
|
|
11756
|
+
const textBackgroundOpacity = theme?.textBackgroundOpacity;
|
|
11669
11757
|
const generateOneMarkLine = (y)=>({
|
|
11670
11758
|
y,
|
|
11671
11759
|
autoRange: true,
|
|
@@ -11675,15 +11763,7 @@ self.R = R;
|
|
|
11675
11763
|
visible: lineVisible,
|
|
11676
11764
|
stroke: lineColor,
|
|
11677
11765
|
lineWidth: lineWidth,
|
|
11678
|
-
lineDash
|
|
11679
|
-
5,
|
|
11680
|
-
2
|
|
11681
|
-
] : 'dotted' === lineStyle ? [
|
|
11682
|
-
2,
|
|
11683
|
-
5
|
|
11684
|
-
] : [
|
|
11685
|
-
0
|
|
11686
|
-
]
|
|
11766
|
+
lineDash
|
|
11687
11767
|
}
|
|
11688
11768
|
},
|
|
11689
11769
|
label: {
|
|
@@ -11691,7 +11771,6 @@ self.R = R;
|
|
|
11691
11771
|
text: text,
|
|
11692
11772
|
position: positionMap[textPosition || 'insideEnd'],
|
|
11693
11773
|
style: {
|
|
11694
|
-
opacity: 0.95,
|
|
11695
11774
|
visible: true,
|
|
11696
11775
|
dy: 4,
|
|
11697
11776
|
stroke: textBackgroundColor,
|
|
@@ -11706,7 +11785,7 @@ self.R = R;
|
|
|
11706
11785
|
visible: textBackgroundVisible,
|
|
11707
11786
|
padding: textBackgroundPadding,
|
|
11708
11787
|
style: {
|
|
11709
|
-
opacity: 0.95,
|
|
11788
|
+
opacity: textBackgroundOpacity ?? 0.95,
|
|
11710
11789
|
dy: 4,
|
|
11711
11790
|
cornerRadius: textBackgroundBorderRadius,
|
|
11712
11791
|
fill: textBackgroundColor,
|
|
@@ -11777,9 +11856,10 @@ self.R = R;
|
|
|
11777
11856
|
left: 'insideLeft',
|
|
11778
11857
|
right: 'insideRight'
|
|
11779
11858
|
};
|
|
11780
|
-
const defaultTextPosition =
|
|
11859
|
+
const defaultTextPosition = isBarLikeChart(advancedVSeed) ? 'right' : 'top';
|
|
11781
11860
|
const markArea = annotationAreaList.flatMap((annotationArea)=>{
|
|
11782
11861
|
const { selector: selectorPoint, text = '', textColor = theme?.textColor ?? '#ffffff', textFontSize = theme?.textFontSize ?? 12, textFontWeight = theme?.textFontWeight ?? 400, textBackgroundVisible = theme?.textBackgroundVisible ?? true, textBackgroundColor = theme?.textBackgroundColor ?? '#191d24', textBackgroundBorderColor = theme?.textBackgroundBorderColor ?? '#191d24', textBackgroundBorderWidth = theme?.textBackgroundBorderWidth ?? 1, textBackgroundBorderRadius = theme?.textBackgroundBorderRadius ?? 4, textBackgroundPadding = theme?.textBackgroundPadding ?? 4, areaColor = theme?.areaColor ?? '#888888', areaColorOpacity = theme?.areaColorOpacity ?? 0.15, areaBorderColor = theme?.areaBorderColor ?? '#888888', areaBorderRadius = theme?.areaBorderRadius ?? 4, areaBorderWidth = theme?.areaBorderWidth ?? 1, areaLineDash = theme?.areaLineDash, outerPadding = theme?.outerPadding ?? 4 } = annotationArea;
|
|
11862
|
+
const textBackgroundOpacity = theme?.textBackgroundOpacity;
|
|
11783
11863
|
const dataset = advancedVSeed.dataset.flat();
|
|
11784
11864
|
const selectedData = selectorPoint ? dataset.filter((datum)=>selector_selector(datum, selectorPoint)) : [];
|
|
11785
11865
|
const textPosition = annotationArea.textPosition ?? defaultTextPosition;
|
|
@@ -11850,7 +11930,6 @@ self.R = R;
|
|
|
11850
11930
|
visible: true,
|
|
11851
11931
|
text: text,
|
|
11852
11932
|
style: {
|
|
11853
|
-
opacity: 0.95,
|
|
11854
11933
|
textAlign: textAlign,
|
|
11855
11934
|
textBaseline: textBaseline,
|
|
11856
11935
|
fill: textColor,
|
|
@@ -11863,7 +11942,7 @@ self.R = R;
|
|
|
11863
11942
|
visible: textBackgroundVisible,
|
|
11864
11943
|
padding: textBackgroundPadding,
|
|
11865
11944
|
style: {
|
|
11866
|
-
opacity: 0.95,
|
|
11945
|
+
opacity: textBackgroundOpacity ?? 0.95,
|
|
11867
11946
|
cornerRadius: textBackgroundBorderRadius ?? 4,
|
|
11868
11947
|
fill: textBackgroundColor,
|
|
11869
11948
|
stroke: textBackgroundBorderColor,
|
|
@@ -13466,20 +13545,45 @@ self.R = R;
|
|
|
13466
13545
|
if (hasNegativePart) return reverseStackCornerRadius(cornerRadius);
|
|
13467
13546
|
return 0;
|
|
13468
13547
|
};
|
|
13548
|
+
const createStackCornerRadius = (cornerRadius)=>(_, datum)=>{
|
|
13549
|
+
const stackRangeCornerRadius = getStackRangeCornerRadius(cornerRadius, datum);
|
|
13550
|
+
if (void 0 !== stackRangeCornerRadius) return stackRangeCornerRadius;
|
|
13551
|
+
const value = datum?.[datum?.[FoldMeasureId]];
|
|
13552
|
+
if (value > 0) return cornerRadius;
|
|
13553
|
+
if (value < 0) return reverseStackCornerRadius(cornerRadius);
|
|
13554
|
+
return 0;
|
|
13555
|
+
};
|
|
13556
|
+
const hasMoveInAnimation = (animation)=>{
|
|
13557
|
+
if (!animation) return false;
|
|
13558
|
+
if (Array.isArray(animation)) return animation.some(hasMoveInAnimation);
|
|
13559
|
+
if ('object' != typeof animation) return false;
|
|
13560
|
+
const animationRecord = animation;
|
|
13561
|
+
return 'moveIn' === animationRecord.type || Object.values(animationRecord).some(hasMoveInAnimation);
|
|
13562
|
+
};
|
|
13563
|
+
const hasBarMoveInAnimation = (spec)=>[
|
|
13564
|
+
spec.animationAppear,
|
|
13565
|
+
spec.animationNormal,
|
|
13566
|
+
spec.animationEnter,
|
|
13567
|
+
spec.animationUpdate
|
|
13568
|
+
].some(hasMoveInAnimation);
|
|
13469
13569
|
const stackCornerRadius_stackCornerRadius = (spec, context)=>{
|
|
13470
13570
|
const { advancedVSeed, vseed } = context;
|
|
13471
13571
|
const { chartType } = vseed;
|
|
13472
13572
|
const stackCornerRadius = advancedVSeed.config?.[chartType]?.stackCornerRadius;
|
|
13473
13573
|
if ('dualAxis' === chartType && 'bar' !== spec.type) return spec;
|
|
13574
|
+
const stackCornerRadiusCallback = createStackCornerRadius(stackCornerRadius);
|
|
13575
|
+
if (!hasBarMoveInAnimation(spec)) return {
|
|
13576
|
+
...spec,
|
|
13577
|
+
stackCornerRadius: stackCornerRadiusCallback
|
|
13578
|
+
};
|
|
13474
13579
|
return {
|
|
13475
13580
|
...spec,
|
|
13476
|
-
|
|
13477
|
-
|
|
13478
|
-
|
|
13479
|
-
|
|
13480
|
-
|
|
13481
|
-
|
|
13482
|
-
return 0;
|
|
13581
|
+
bar: {
|
|
13582
|
+
...spec.bar,
|
|
13583
|
+
style: {
|
|
13584
|
+
...spec.bar?.style,
|
|
13585
|
+
cornerRadius: stackCornerRadiusCallback
|
|
13586
|
+
}
|
|
13483
13587
|
}
|
|
13484
13588
|
};
|
|
13485
13589
|
};
|
|
@@ -13639,9 +13743,10 @@ self.R = R;
|
|
|
13639
13743
|
left: 'insideLeft',
|
|
13640
13744
|
right: 'insideRight'
|
|
13641
13745
|
};
|
|
13642
|
-
const defaultTextPosition =
|
|
13746
|
+
const defaultTextPosition = isBarLikeChart(advancedVSeed) ? 'right' : 'top';
|
|
13643
13747
|
const markArea = annotationAreaList.flatMap((annotationArea)=>{
|
|
13644
13748
|
const { selector: selectorPoint, text = '', textColor = theme?.textColor ?? '#ffffff', textFontSize = theme?.textFontSize ?? 12, textFontWeight = theme?.textFontWeight ?? 400, textBackgroundVisible = theme?.textBackgroundVisible ?? true, textBackgroundColor = theme?.textBackgroundColor ?? '#191d24', textBackgroundBorderColor = theme?.textBackgroundBorderColor ?? '#191d24', textBackgroundBorderWidth = theme?.textBackgroundBorderWidth ?? 1, textBackgroundBorderRadius = theme?.textBackgroundBorderRadius ?? 4, textBackgroundPadding = theme?.textBackgroundPadding ?? 4, areaColor = theme?.areaColor ?? '#888888', areaColorOpacity = theme?.areaColorOpacity ?? 0.15, areaBorderColor = theme?.areaBorderColor ?? '#888888', areaBorderRadius = theme?.areaBorderRadius ?? 4, areaBorderWidth = theme?.areaBorderWidth ?? 1, areaLineDash = theme?.areaLineDash, outerPadding = theme?.outerPadding ?? 4 } = annotationArea;
|
|
13749
|
+
const textBackgroundOpacity = theme?.textBackgroundOpacity;
|
|
13645
13750
|
const textPosition = annotationArea.textPosition ?? defaultTextPosition;
|
|
13646
13751
|
const textAlign = annotationArea.textAlign ?? ANNOTATION_AREA_TEXT_STYLE_BY_POSITION[textPosition].textAlign;
|
|
13647
13752
|
const textBaseline = annotationArea.textBaseline ?? ANNOTATION_AREA_TEXT_STYLE_BY_POSITION[textPosition].textBaseline;
|
|
@@ -13725,7 +13830,6 @@ self.R = R;
|
|
|
13725
13830
|
visible: true,
|
|
13726
13831
|
text: text,
|
|
13727
13832
|
style: {
|
|
13728
|
-
opacity: 0.95,
|
|
13729
13833
|
textAlign: textAlign,
|
|
13730
13834
|
textBaseline: textBaseline,
|
|
13731
13835
|
stroke: textBackgroundColor,
|
|
@@ -13738,7 +13842,7 @@ self.R = R;
|
|
|
13738
13842
|
visible: textBackgroundVisible,
|
|
13739
13843
|
padding: textBackgroundPadding,
|
|
13740
13844
|
style: {
|
|
13741
|
-
opacity: 0.95,
|
|
13845
|
+
opacity: textBackgroundOpacity ?? 0.95,
|
|
13742
13846
|
cornerRadius: textBackgroundBorderRadius ?? 4,
|
|
13743
13847
|
fill: textBackgroundColor,
|
|
13744
13848
|
stroke: textBackgroundBorderColor,
|
|
@@ -29940,7 +30044,12 @@ self.R = R;
|
|
|
29940
30044
|
textFontSize: schemas_number().nullish(),
|
|
29941
30045
|
textColor: schemas_string().nullish(),
|
|
29942
30046
|
textBackgroundColor: schemas_string().nullish(),
|
|
29943
|
-
lineColor: schemas_string().nullish()
|
|
30047
|
+
lineColor: schemas_string().nullish(),
|
|
30048
|
+
lineStyle: schemas_enum([
|
|
30049
|
+
'solid',
|
|
30050
|
+
'dashed',
|
|
30051
|
+
'dotted'
|
|
30052
|
+
]).nullish()
|
|
29944
30053
|
});
|
|
29945
30054
|
const zAnnotationHorizontalLine = schemas_object({
|
|
29946
30055
|
yValue: union([
|
|
@@ -30036,7 +30145,9 @@ self.R = R;
|
|
|
30036
30145
|
selector: true,
|
|
30037
30146
|
measureId: true,
|
|
30038
30147
|
text: true
|
|
30039
|
-
}).partial()
|
|
30148
|
+
}).partial().extend({
|
|
30149
|
+
textBackgroundOpacity: schemas_number().nullish()
|
|
30150
|
+
});
|
|
30040
30151
|
const zAnnotationHorizontalLineConfig = zAnnotationHorizontalLine.pick({
|
|
30041
30152
|
lineColor: true,
|
|
30042
30153
|
lineWidth: true,
|
|
@@ -30052,6 +30163,8 @@ self.R = R;
|
|
|
30052
30163
|
textBackgroundBorderRadius: true,
|
|
30053
30164
|
textBackgroundPadding: true
|
|
30054
30165
|
}).extend({
|
|
30166
|
+
lineDash: schemas_array(schemas_number()).nullish(),
|
|
30167
|
+
textBackgroundOpacity: schemas_number().nullish(),
|
|
30055
30168
|
endSymbolVisible: schemas_boolean().nullish(),
|
|
30056
30169
|
endSymbolType: schemas_string().nullish(),
|
|
30057
30170
|
endSymbolSize: schemas_number().nullish(),
|
|
@@ -30077,12 +30190,18 @@ self.R = R;
|
|
|
30077
30190
|
areaBorderRadius: true,
|
|
30078
30191
|
areaLineDash: true,
|
|
30079
30192
|
outerPadding: true
|
|
30193
|
+
}).extend({
|
|
30194
|
+
textBackgroundOpacity: schemas_number().nullish()
|
|
30080
30195
|
}).partial();
|
|
30081
30196
|
const zAnnotationDifferenceLineConfig = zAnnotationDifferenceLine.pick({
|
|
30082
30197
|
lineColor: true,
|
|
30198
|
+
lineStyle: true,
|
|
30083
30199
|
textColor: true,
|
|
30084
30200
|
textFontSize: true,
|
|
30085
30201
|
textBackgroundColor: true
|
|
30202
|
+
}).extend({
|
|
30203
|
+
lineDash: schemas_array(schemas_number()).nullish(),
|
|
30204
|
+
textBackgroundOpacity: schemas_number().nullish()
|
|
30086
30205
|
}).partial();
|
|
30087
30206
|
const zAnnotationConfig = schemas_object({
|
|
30088
30207
|
annotationPoint: zAnnotationPointConfig.nullish(),
|
|
@@ -31810,23 +31929,52 @@ self.R = R;
|
|
|
31810
31929
|
titleColor: tokens.textPrimary
|
|
31811
31930
|
}
|
|
31812
31931
|
});
|
|
31813
|
-
const
|
|
31932
|
+
const getAnnotationLinePatch = (tokens)=>({
|
|
31933
|
+
lineColor: tokens.annotationLineColor,
|
|
31934
|
+
lineStyle: tokens.annotationLineStyle,
|
|
31935
|
+
lineDash: tokens.annotationLineDash,
|
|
31936
|
+
textColor: tokens.annotationTextColor,
|
|
31937
|
+
textBackgroundColor: tokens.annotationTextBackgroundColor,
|
|
31938
|
+
textBackgroundBorderColor: tokens.annotationTextBackgroundColor,
|
|
31939
|
+
textBackgroundOpacity: tokens.annotationTextBackgroundOpacity
|
|
31940
|
+
});
|
|
31941
|
+
const getAnnotationTextPatch = (tokens)=>({
|
|
31942
|
+
textColor: tokens.annotationTextColor,
|
|
31943
|
+
textBackgroundColor: tokens.annotationTextBackgroundColor,
|
|
31944
|
+
textBackgroundBorderColor: tokens.annotationTextBackgroundColor,
|
|
31945
|
+
textBackgroundOpacity: tokens.annotationTextBackgroundOpacity
|
|
31946
|
+
});
|
|
31947
|
+
const getAnnotationPatch = (tokens)=>{
|
|
31948
|
+
const annotationLinePatch = getAnnotationLinePatch(tokens);
|
|
31949
|
+
const annotationTextPatch = getAnnotationTextPatch(tokens);
|
|
31950
|
+
return {
|
|
31814
31951
|
annotationPoint: {
|
|
31815
|
-
textFontSize: tokens.labelFontSize
|
|
31952
|
+
textFontSize: tokens.labelFontSize,
|
|
31953
|
+
...annotationTextPatch
|
|
31816
31954
|
},
|
|
31817
31955
|
annotationHorizontalLine: {
|
|
31818
|
-
textFontSize: tokens.labelFontSize
|
|
31956
|
+
textFontSize: tokens.labelFontSize,
|
|
31957
|
+
...annotationLinePatch
|
|
31819
31958
|
},
|
|
31820
31959
|
annotationVerticalLine: {
|
|
31821
|
-
textFontSize: tokens.labelFontSize
|
|
31960
|
+
textFontSize: tokens.labelFontSize,
|
|
31961
|
+
...annotationLinePatch
|
|
31822
31962
|
},
|
|
31823
31963
|
annotationDifferenceLine: {
|
|
31824
|
-
textFontSize: tokens.labelFontSize
|
|
31964
|
+
textFontSize: tokens.labelFontSize,
|
|
31965
|
+
lineColor: tokens.annotationLineColor,
|
|
31966
|
+
lineStyle: tokens.annotationLineStyle,
|
|
31967
|
+
lineDash: tokens.annotationLineDash,
|
|
31968
|
+
textColor: tokens.annotationTextColor,
|
|
31969
|
+
textBackgroundColor: tokens.annotationTextBackgroundColor,
|
|
31970
|
+
textBackgroundOpacity: tokens.annotationTextBackgroundOpacity
|
|
31825
31971
|
},
|
|
31826
31972
|
annotationArea: {
|
|
31827
|
-
textFontSize: tokens.labelFontSize
|
|
31973
|
+
textFontSize: tokens.labelFontSize,
|
|
31974
|
+
...annotationTextPatch
|
|
31828
31975
|
}
|
|
31829
|
-
}
|
|
31976
|
+
};
|
|
31977
|
+
};
|
|
31830
31978
|
const getRegressionLinePatch = (tokens)=>({
|
|
31831
31979
|
kdeRegressionLine: {
|
|
31832
31980
|
textFontSize: tokens.labelFontSize
|