@visactor/vseed 0.5.0 → 0.5.1
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/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/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 +248 -134
- 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
|
|
@@ -9616,57 +9686,6 @@ self.R = R;
|
|
|
9616
9686
|
]
|
|
9617
9687
|
};
|
|
9618
9688
|
};
|
|
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
9689
|
const linearColor = (spec, context)=>{
|
|
9671
9690
|
const result = {
|
|
9672
9691
|
...spec
|
|
@@ -10843,6 +10862,20 @@ self.R = R;
|
|
|
10843
10862
|
...meaContent
|
|
10844
10863
|
];
|
|
10845
10864
|
};
|
|
10865
|
+
const getAnnotationLineDash = (lineStyle, lineDash)=>{
|
|
10866
|
+
if (Array.isArray(lineDash)) return lineDash;
|
|
10867
|
+
if ('dashed' === lineStyle) return [
|
|
10868
|
+
2,
|
|
10869
|
+
2
|
|
10870
|
+
];
|
|
10871
|
+
if ('dotted' === lineStyle) return [
|
|
10872
|
+
2,
|
|
10873
|
+
5
|
|
10874
|
+
];
|
|
10875
|
+
return [
|
|
10876
|
+
0
|
|
10877
|
+
];
|
|
10878
|
+
};
|
|
10846
10879
|
const isSubset = (sub, obj, excludeMeasuresIds)=>Object.entries(sub).every(([key, value])=>{
|
|
10847
10880
|
if (excludeMeasuresIds && excludeMeasuresIds.includes(key)) return false;
|
|
10848
10881
|
if ('string' == typeof value) return obj[key] === value;
|
|
@@ -10924,7 +10957,7 @@ self.R = R;
|
|
|
10924
10957
|
const annotationPointList = Array.isArray(annotationPoint) ? annotationPoint : [
|
|
10925
10958
|
annotationPoint
|
|
10926
10959
|
];
|
|
10927
|
-
const isHorizontalBar =
|
|
10960
|
+
const isHorizontalBar = isBarLikeChart(advancedVSeed);
|
|
10928
10961
|
const defaultStyle = isHorizontalBar ? {
|
|
10929
10962
|
textAlign: 'right',
|
|
10930
10963
|
textBaseline: 'middle'
|
|
@@ -10934,6 +10967,7 @@ self.R = R;
|
|
|
10934
10967
|
};
|
|
10935
10968
|
const markPoint = annotationPointList.flatMap((annotationPoint)=>{
|
|
10936
10969
|
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;
|
|
10970
|
+
const textBackgroundOpacity = theme?.textBackgroundOpacity;
|
|
10937
10971
|
const dataset = advancedVSeed.dataset.flat();
|
|
10938
10972
|
const selectedData = selectorPoint || dynamicFilter ? findSelectedDatas({
|
|
10939
10973
|
dataset,
|
|
@@ -10961,7 +10995,7 @@ self.R = R;
|
|
|
10961
10995
|
visible: textBackgroundVisible,
|
|
10962
10996
|
padding: textBackgroundPadding,
|
|
10963
10997
|
style: {
|
|
10964
|
-
opacity: 0.95,
|
|
10998
|
+
opacity: textBackgroundOpacity ?? 0.95,
|
|
10965
10999
|
cornerRadius: textBackgroundBorderRadius ?? 4,
|
|
10966
11000
|
fill: textBackgroundColor,
|
|
10967
11001
|
stroke: textBackgroundBorderColor,
|
|
@@ -10972,7 +11006,6 @@ self.R = R;
|
|
|
10972
11006
|
}
|
|
10973
11007
|
},
|
|
10974
11008
|
style: {
|
|
10975
|
-
opacity: 0.95,
|
|
10976
11009
|
visible: true,
|
|
10977
11010
|
textAlign: textAlign,
|
|
10978
11011
|
textBaseline: textBaseline,
|
|
@@ -11209,14 +11242,19 @@ self.R = R;
|
|
|
11209
11242
|
if ('percent' === differenceType) return `${(100 * differenceValue).toFixed(2)}%`;
|
|
11210
11243
|
return `${differenceValue}`;
|
|
11211
11244
|
};
|
|
11245
|
+
const inferDifferenceConnectDirection = (vseed, values)=>{
|
|
11246
|
+
const isNegativeSide = values.every((value)=>value < 0);
|
|
11247
|
+
if (isBarLikeChart(vseed)) return isNegativeSide ? 'left' : 'right';
|
|
11248
|
+
return isNegativeSide ? 'bottom' : 'top';
|
|
11249
|
+
};
|
|
11212
11250
|
const DEFAULT_LINE_COLOR = '#BCC1CB';
|
|
11213
11251
|
const DEFAULT_TEXT_COLOR = '#ffffff';
|
|
11214
11252
|
const DEFAULT_TEXT_BACKGROUND_COLOR = '#BCC1CB';
|
|
11215
11253
|
const DEFAULT_TEXT_FONT_SIZE = 12;
|
|
11216
|
-
const DEFAULT_LINE_WIDTH =
|
|
11217
|
-
const DEFAULT_CORNER_RADIUS =
|
|
11254
|
+
const DEFAULT_LINE_WIDTH = 1;
|
|
11255
|
+
const DEFAULT_CORNER_RADIUS = 3;
|
|
11218
11256
|
const DEFAULT_LABEL_PADDING = 4;
|
|
11219
|
-
const DEFAULT_END_SYMBOL_SIZE =
|
|
11257
|
+
const DEFAULT_END_SYMBOL_SIZE = 6;
|
|
11220
11258
|
const DEFAULT_END_SYMBOL_REF_X = -4;
|
|
11221
11259
|
const DEFAULT_GUTTER_BASE_OFFSET = 20;
|
|
11222
11260
|
const DEFAULT_GUTTER_RIGHT_PADDING = 44;
|
|
@@ -11229,6 +11267,7 @@ self.R = R;
|
|
|
11229
11267
|
type: 'percent',
|
|
11230
11268
|
fractionDigits: 2
|
|
11231
11269
|
};
|
|
11270
|
+
const shouldInferDifferenceConnectDirection = (chartType)=>'column' === chartType || 'bar' === chartType || 'columnParallel' === chartType || 'barParallel' === chartType;
|
|
11232
11271
|
const getDifferenceLinePath = (index, total)=>1 === total ? 'annotationDifferenceLine' : `annotationDifferenceLine[${index}]`;
|
|
11233
11272
|
const annotationDifferenceLine_toArray = (value)=>{
|
|
11234
11273
|
if (Array.isArray(value)) return value;
|
|
@@ -11269,21 +11308,45 @@ self.R = R;
|
|
|
11269
11308
|
]
|
|
11270
11309
|
};
|
|
11271
11310
|
};
|
|
11272
|
-
const buildFixedGutterExpandDistance = (
|
|
11311
|
+
const buildFixedGutterExpandDistance = (connectDirection)=>(_markerData, context)=>{
|
|
11273
11312
|
const region = context?.region;
|
|
11274
11313
|
const coordinatePoints = Array.isArray(context?.coordinatePoints) ? context.coordinatePoints : [];
|
|
11275
11314
|
if (!region || 0 === coordinatePoints.length) return 0;
|
|
11276
11315
|
const { x: regionStartX, y: regionStartY } = region.getLayoutStartPoint();
|
|
11277
|
-
const { width } = region.getLayoutRect();
|
|
11278
|
-
if (
|
|
11316
|
+
const { width, height } = region.getLayoutRect();
|
|
11317
|
+
if ('top' === connectDirection) {
|
|
11279
11318
|
const targetY = regionStartY - DEFAULT_GUTTER_BASE_OFFSET;
|
|
11280
11319
|
const minY = Math.min(...coordinatePoints.map((point)=>point.y));
|
|
11281
11320
|
return Math.max(0, minY - targetY);
|
|
11282
11321
|
}
|
|
11322
|
+
if ('bottom' === connectDirection) {
|
|
11323
|
+
const targetY = regionStartY + height + DEFAULT_GUTTER_BASE_OFFSET;
|
|
11324
|
+
const maxY = Math.max(...coordinatePoints.map((point)=>point.y));
|
|
11325
|
+
return Math.max(0, targetY - maxY);
|
|
11326
|
+
}
|
|
11327
|
+
if ('left' === connectDirection) {
|
|
11328
|
+
const targetX = regionStartX - DEFAULT_GUTTER_BASE_OFFSET;
|
|
11329
|
+
const minX = Math.min(...coordinatePoints.map((point)=>point.x));
|
|
11330
|
+
return Math.max(0, minX - targetX);
|
|
11331
|
+
}
|
|
11283
11332
|
const targetX = regionStartX + width + DEFAULT_GUTTER_BASE_OFFSET;
|
|
11284
11333
|
const maxX = Math.max(...coordinatePoints.map((point)=>point.x));
|
|
11285
11334
|
return Math.max(0, targetX - maxX);
|
|
11286
11335
|
};
|
|
11336
|
+
const getDifferenceLinePaddingPatch = (connectDirection)=>{
|
|
11337
|
+
if ('top' === connectDirection) return {
|
|
11338
|
+
top: DEFAULT_GUTTER_TOP_PADDING
|
|
11339
|
+
};
|
|
11340
|
+
if ('bottom' === connectDirection) return {
|
|
11341
|
+
bottom: DEFAULT_GUTTER_TOP_PADDING
|
|
11342
|
+
};
|
|
11343
|
+
if ('left' === connectDirection) return {
|
|
11344
|
+
left: DEFAULT_GUTTER_RIGHT_PADDING
|
|
11345
|
+
};
|
|
11346
|
+
return {
|
|
11347
|
+
right: DEFAULT_GUTTER_RIGHT_PADDING
|
|
11348
|
+
};
|
|
11349
|
+
};
|
|
11287
11350
|
const getAxisFormatter = (spec)=>{
|
|
11288
11351
|
const valueAxisOrient = 'horizontal' === spec.direction ? 'bottom' : 'left';
|
|
11289
11352
|
const formatMethod = spec.axes?.find((axis)=>axis.orient === valueAxisOrient)?.label?.formatMethod;
|
|
@@ -11352,6 +11415,12 @@ self.R = R;
|
|
|
11352
11415
|
const axisFormatter = getAxisFormatter(chartSpec);
|
|
11353
11416
|
const percentFormatter = createFormatter(DEFAULT_PERCENT_DIFFERENCE_FORMAT);
|
|
11354
11417
|
const isHorizontalChart = 'horizontal' === chartSpec.direction;
|
|
11418
|
+
const paddingPatch = {
|
|
11419
|
+
top: 0,
|
|
11420
|
+
right: 0,
|
|
11421
|
+
bottom: 0,
|
|
11422
|
+
left: 0
|
|
11423
|
+
};
|
|
11355
11424
|
const markLine = annotationDifferenceLineList.flatMap((annotationDifferenceLine, index)=>{
|
|
11356
11425
|
try {
|
|
11357
11426
|
assertDifferenceLineConfig(annotationDifferenceLine, getDifferenceLinePath(index, annotationDifferenceLineList.length));
|
|
@@ -11375,11 +11444,23 @@ self.R = R;
|
|
|
11375
11444
|
if (start.mode !== end.mode) return [];
|
|
11376
11445
|
const usesRuntimeStackEnd = useElementStackEnd || ('column' === vseed.chartType || 'bar' === vseed.chartType) && 'element' === start.mode && 'auto' === stackResolveMode;
|
|
11377
11446
|
const useBracketStyle = isBracketChart || ('column' === vseed.chartType || 'bar' === vseed.chartType) && 'element' === start.mode && 'auto' === stackResolveMode;
|
|
11378
|
-
const connectDirection =
|
|
11379
|
-
|
|
11447
|
+
const connectDirection = shouldInferDifferenceConnectDirection(vseed.chartType) ? inferDifferenceConnectDirection(vseed, [
|
|
11448
|
+
start.value,
|
|
11449
|
+
end.value
|
|
11450
|
+
]) : isHorizontalChart ? 'top' : 'right';
|
|
11451
|
+
const expandDistance = buildFixedGutterExpandDistance(connectDirection);
|
|
11452
|
+
const currentPaddingPatch = getDifferenceLinePaddingPatch(connectDirection);
|
|
11453
|
+
paddingPatch.top = Math.max(paddingPatch.top, currentPaddingPatch.top ?? 0);
|
|
11454
|
+
paddingPatch.right = Math.max(paddingPatch.right, currentPaddingPatch.right ?? 0);
|
|
11455
|
+
paddingPatch.bottom = Math.max(paddingPatch.bottom, currentPaddingPatch.bottom ?? 0);
|
|
11456
|
+
paddingPatch.left = Math.max(paddingPatch.left, currentPaddingPatch.left ?? 0);
|
|
11380
11457
|
const lineColor = annotationDifferenceLine.lineColor ?? theme?.lineColor ?? DEFAULT_LINE_COLOR;
|
|
11458
|
+
const lineStyle = annotationDifferenceLine.lineStyle;
|
|
11459
|
+
const themeLineStyle = theme?.lineStyle;
|
|
11460
|
+
const configuredLineDash = lineStyle ? getAnnotationLineDash(lineStyle) : theme?.lineDash ?? (themeLineStyle ? getAnnotationLineDash(themeLineStyle) : void 0);
|
|
11381
11461
|
const textColor = annotationDifferenceLine.textColor ?? theme?.textColor ?? DEFAULT_TEXT_COLOR;
|
|
11382
11462
|
const textBackgroundColor = annotationDifferenceLine.textBackgroundColor ?? theme?.textBackgroundColor ?? DEFAULT_TEXT_BACKGROUND_COLOR;
|
|
11463
|
+
const textBackgroundOpacity = theme?.textBackgroundOpacity;
|
|
11383
11464
|
const textFontSize = annotationDifferenceLine.textFontSize ?? theme?.textFontSize ?? DEFAULT_TEXT_FONT_SIZE;
|
|
11384
11465
|
const differenceType = annotationDifferenceLine.differenceType ?? 'absolute';
|
|
11385
11466
|
const startMeasureId = resolveDifferenceMeasureId(start, annotationDifferenceLine.start.selector, measureIds);
|
|
@@ -11414,6 +11495,7 @@ self.R = R;
|
|
|
11414
11495
|
visible: true,
|
|
11415
11496
|
padding: DEFAULT_LABEL_PADDING,
|
|
11416
11497
|
style: {
|
|
11498
|
+
opacity: textBackgroundOpacity ?? 0.95,
|
|
11417
11499
|
fill: textBackgroundColor,
|
|
11418
11500
|
fillOpacity: 1,
|
|
11419
11501
|
stroke: lineColor,
|
|
@@ -11434,6 +11516,7 @@ self.R = R;
|
|
|
11434
11516
|
visible: true,
|
|
11435
11517
|
padding: DEFAULT_LABEL_PADDING,
|
|
11436
11518
|
style: {
|
|
11519
|
+
opacity: textBackgroundOpacity ?? 0.95,
|
|
11437
11520
|
fill: textBackgroundColor,
|
|
11438
11521
|
fillOpacity: 1,
|
|
11439
11522
|
stroke: lineColor,
|
|
@@ -11477,18 +11560,21 @@ self.R = R;
|
|
|
11477
11560
|
visible: true,
|
|
11478
11561
|
stroke: lineColor,
|
|
11479
11562
|
lineWidth: DEFAULT_LINE_WIDTH,
|
|
11480
|
-
lineDash: DEFAULT_BRACKET_LINE_DASH
|
|
11563
|
+
lineDash: configuredLineDash ?? DEFAULT_BRACKET_LINE_DASH
|
|
11481
11564
|
},
|
|
11482
11565
|
{
|
|
11483
11566
|
visible: true,
|
|
11484
11567
|
stroke: lineColor,
|
|
11485
|
-
lineWidth: DEFAULT_LINE_WIDTH
|
|
11568
|
+
lineWidth: DEFAULT_LINE_WIDTH,
|
|
11569
|
+
...configuredLineDash ? {
|
|
11570
|
+
lineDash: configuredLineDash
|
|
11571
|
+
} : {}
|
|
11486
11572
|
},
|
|
11487
11573
|
{
|
|
11488
11574
|
visible: true,
|
|
11489
11575
|
stroke: lineColor,
|
|
11490
11576
|
lineWidth: DEFAULT_LINE_WIDTH,
|
|
11491
|
-
lineDash: DEFAULT_BRACKET_LINE_DASH
|
|
11577
|
+
lineDash: configuredLineDash ?? DEFAULT_BRACKET_LINE_DASH
|
|
11492
11578
|
}
|
|
11493
11579
|
]
|
|
11494
11580
|
} : {
|
|
@@ -11496,7 +11582,7 @@ self.R = R;
|
|
|
11496
11582
|
visible: true,
|
|
11497
11583
|
stroke: lineColor,
|
|
11498
11584
|
lineWidth: DEFAULT_LINE_WIDTH,
|
|
11499
|
-
lineDash: [
|
|
11585
|
+
lineDash: configuredLineDash ?? [
|
|
11500
11586
|
0
|
|
11501
11587
|
],
|
|
11502
11588
|
cornerRadius: DEFAULT_CORNER_RADIUS
|
|
@@ -11529,11 +11615,7 @@ self.R = R;
|
|
|
11529
11615
|
]
|
|
11530
11616
|
};
|
|
11531
11617
|
if (0 === markLine.length) return nextSpec;
|
|
11532
|
-
return mergeDifferenceLineRegionPadding(nextSpec,
|
|
11533
|
-
top: DEFAULT_GUTTER_TOP_PADDING
|
|
11534
|
-
} : {
|
|
11535
|
-
right: DEFAULT_GUTTER_RIGHT_PADDING
|
|
11536
|
-
});
|
|
11618
|
+
return mergeDifferenceLineRegionPadding(nextSpec, paddingPatch);
|
|
11537
11619
|
};
|
|
11538
11620
|
const annotationVerticalLine_annotationVerticalLine = (spec, context)=>{
|
|
11539
11621
|
const { advancedVSeed, vseed } = context;
|
|
@@ -11553,7 +11635,10 @@ self.R = R;
|
|
|
11553
11635
|
insideEnd: 'insideEndTop'
|
|
11554
11636
|
};
|
|
11555
11637
|
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',
|
|
11638
|
+
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;
|
|
11639
|
+
const lineStyle = annotationVerticalLine.lineStyle ?? theme?.lineStyle ?? 'dashed';
|
|
11640
|
+
const lineDash = getAnnotationLineDash(lineStyle, annotationVerticalLine.lineStyle ? void 0 : theme?.lineDash);
|
|
11641
|
+
const textBackgroundOpacity = theme?.textBackgroundOpacity;
|
|
11557
11642
|
const generateOneMarkLine = (x)=>({
|
|
11558
11643
|
x,
|
|
11559
11644
|
autoRange: true,
|
|
@@ -11564,15 +11649,7 @@ self.R = R;
|
|
|
11564
11649
|
stroke: lineColor,
|
|
11565
11650
|
lineStyle: lineStyle,
|
|
11566
11651
|
lineWidth: lineWidth,
|
|
11567
|
-
lineDash
|
|
11568
|
-
5,
|
|
11569
|
-
2
|
|
11570
|
-
] : 'dotted' === lineStyle ? [
|
|
11571
|
-
2,
|
|
11572
|
-
5
|
|
11573
|
-
] : [
|
|
11574
|
-
0
|
|
11575
|
-
]
|
|
11652
|
+
lineDash
|
|
11576
11653
|
}
|
|
11577
11654
|
},
|
|
11578
11655
|
label: {
|
|
@@ -11580,7 +11657,6 @@ self.R = R;
|
|
|
11580
11657
|
text: text,
|
|
11581
11658
|
position: positionMap[textPosition || 'insideEnd'],
|
|
11582
11659
|
style: {
|
|
11583
|
-
opacity: 0.95,
|
|
11584
11660
|
dx: 5,
|
|
11585
11661
|
visible: true,
|
|
11586
11662
|
stroke: textBackgroundColor,
|
|
@@ -11595,13 +11671,13 @@ self.R = R;
|
|
|
11595
11671
|
visible: textBackgroundVisible,
|
|
11596
11672
|
padding: textBackgroundPadding,
|
|
11597
11673
|
style: {
|
|
11598
|
-
opacity: 0.95,
|
|
11674
|
+
opacity: textBackgroundOpacity ?? 0.95,
|
|
11599
11675
|
dx: 5,
|
|
11600
11676
|
cornerRadius: textBackgroundBorderRadius,
|
|
11601
11677
|
fill: textBackgroundColor,
|
|
11602
|
-
fillOpacity: 1,
|
|
11603
11678
|
stroke: textBackgroundBorderColor,
|
|
11604
|
-
lineWidth: textBackgroundBorderWidth
|
|
11679
|
+
lineWidth: textBackgroundBorderWidth,
|
|
11680
|
+
fillOpacity: 1
|
|
11605
11681
|
}
|
|
11606
11682
|
}
|
|
11607
11683
|
},
|
|
@@ -11665,7 +11741,10 @@ self.R = R;
|
|
|
11665
11741
|
insideEnd: 'insideEndTop'
|
|
11666
11742
|
};
|
|
11667
11743
|
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',
|
|
11744
|
+
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;
|
|
11745
|
+
const lineStyle = annotationHorizontalLine.lineStyle ?? theme?.lineStyle ?? 'dashed';
|
|
11746
|
+
const lineDash = getAnnotationLineDash(lineStyle, annotationHorizontalLine.lineStyle ? void 0 : theme?.lineDash);
|
|
11747
|
+
const textBackgroundOpacity = theme?.textBackgroundOpacity;
|
|
11669
11748
|
const generateOneMarkLine = (y)=>({
|
|
11670
11749
|
y,
|
|
11671
11750
|
autoRange: true,
|
|
@@ -11675,15 +11754,7 @@ self.R = R;
|
|
|
11675
11754
|
visible: lineVisible,
|
|
11676
11755
|
stroke: lineColor,
|
|
11677
11756
|
lineWidth: lineWidth,
|
|
11678
|
-
lineDash
|
|
11679
|
-
5,
|
|
11680
|
-
2
|
|
11681
|
-
] : 'dotted' === lineStyle ? [
|
|
11682
|
-
2,
|
|
11683
|
-
5
|
|
11684
|
-
] : [
|
|
11685
|
-
0
|
|
11686
|
-
]
|
|
11757
|
+
lineDash
|
|
11687
11758
|
}
|
|
11688
11759
|
},
|
|
11689
11760
|
label: {
|
|
@@ -11691,7 +11762,6 @@ self.R = R;
|
|
|
11691
11762
|
text: text,
|
|
11692
11763
|
position: positionMap[textPosition || 'insideEnd'],
|
|
11693
11764
|
style: {
|
|
11694
|
-
opacity: 0.95,
|
|
11695
11765
|
visible: true,
|
|
11696
11766
|
dy: 4,
|
|
11697
11767
|
stroke: textBackgroundColor,
|
|
@@ -11706,7 +11776,7 @@ self.R = R;
|
|
|
11706
11776
|
visible: textBackgroundVisible,
|
|
11707
11777
|
padding: textBackgroundPadding,
|
|
11708
11778
|
style: {
|
|
11709
|
-
opacity: 0.95,
|
|
11779
|
+
opacity: textBackgroundOpacity ?? 0.95,
|
|
11710
11780
|
dy: 4,
|
|
11711
11781
|
cornerRadius: textBackgroundBorderRadius,
|
|
11712
11782
|
fill: textBackgroundColor,
|
|
@@ -11777,9 +11847,10 @@ self.R = R;
|
|
|
11777
11847
|
left: 'insideLeft',
|
|
11778
11848
|
right: 'insideRight'
|
|
11779
11849
|
};
|
|
11780
|
-
const defaultTextPosition =
|
|
11850
|
+
const defaultTextPosition = isBarLikeChart(advancedVSeed) ? 'right' : 'top';
|
|
11781
11851
|
const markArea = annotationAreaList.flatMap((annotationArea)=>{
|
|
11782
11852
|
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;
|
|
11853
|
+
const textBackgroundOpacity = theme?.textBackgroundOpacity;
|
|
11783
11854
|
const dataset = advancedVSeed.dataset.flat();
|
|
11784
11855
|
const selectedData = selectorPoint ? dataset.filter((datum)=>selector_selector(datum, selectorPoint)) : [];
|
|
11785
11856
|
const textPosition = annotationArea.textPosition ?? defaultTextPosition;
|
|
@@ -11850,7 +11921,6 @@ self.R = R;
|
|
|
11850
11921
|
visible: true,
|
|
11851
11922
|
text: text,
|
|
11852
11923
|
style: {
|
|
11853
|
-
opacity: 0.95,
|
|
11854
11924
|
textAlign: textAlign,
|
|
11855
11925
|
textBaseline: textBaseline,
|
|
11856
11926
|
fill: textColor,
|
|
@@ -11863,7 +11933,7 @@ self.R = R;
|
|
|
11863
11933
|
visible: textBackgroundVisible,
|
|
11864
11934
|
padding: textBackgroundPadding,
|
|
11865
11935
|
style: {
|
|
11866
|
-
opacity: 0.95,
|
|
11936
|
+
opacity: textBackgroundOpacity ?? 0.95,
|
|
11867
11937
|
cornerRadius: textBackgroundBorderRadius ?? 4,
|
|
11868
11938
|
fill: textBackgroundColor,
|
|
11869
11939
|
stroke: textBackgroundBorderColor,
|
|
@@ -13639,9 +13709,10 @@ self.R = R;
|
|
|
13639
13709
|
left: 'insideLeft',
|
|
13640
13710
|
right: 'insideRight'
|
|
13641
13711
|
};
|
|
13642
|
-
const defaultTextPosition =
|
|
13712
|
+
const defaultTextPosition = isBarLikeChart(advancedVSeed) ? 'right' : 'top';
|
|
13643
13713
|
const markArea = annotationAreaList.flatMap((annotationArea)=>{
|
|
13644
13714
|
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;
|
|
13715
|
+
const textBackgroundOpacity = theme?.textBackgroundOpacity;
|
|
13645
13716
|
const textPosition = annotationArea.textPosition ?? defaultTextPosition;
|
|
13646
13717
|
const textAlign = annotationArea.textAlign ?? ANNOTATION_AREA_TEXT_STYLE_BY_POSITION[textPosition].textAlign;
|
|
13647
13718
|
const textBaseline = annotationArea.textBaseline ?? ANNOTATION_AREA_TEXT_STYLE_BY_POSITION[textPosition].textBaseline;
|
|
@@ -13725,7 +13796,6 @@ self.R = R;
|
|
|
13725
13796
|
visible: true,
|
|
13726
13797
|
text: text,
|
|
13727
13798
|
style: {
|
|
13728
|
-
opacity: 0.95,
|
|
13729
13799
|
textAlign: textAlign,
|
|
13730
13800
|
textBaseline: textBaseline,
|
|
13731
13801
|
stroke: textBackgroundColor,
|
|
@@ -13738,7 +13808,7 @@ self.R = R;
|
|
|
13738
13808
|
visible: textBackgroundVisible,
|
|
13739
13809
|
padding: textBackgroundPadding,
|
|
13740
13810
|
style: {
|
|
13741
|
-
opacity: 0.95,
|
|
13811
|
+
opacity: textBackgroundOpacity ?? 0.95,
|
|
13742
13812
|
cornerRadius: textBackgroundBorderRadius ?? 4,
|
|
13743
13813
|
fill: textBackgroundColor,
|
|
13744
13814
|
stroke: textBackgroundBorderColor,
|
|
@@ -29940,7 +30010,12 @@ self.R = R;
|
|
|
29940
30010
|
textFontSize: schemas_number().nullish(),
|
|
29941
30011
|
textColor: schemas_string().nullish(),
|
|
29942
30012
|
textBackgroundColor: schemas_string().nullish(),
|
|
29943
|
-
lineColor: schemas_string().nullish()
|
|
30013
|
+
lineColor: schemas_string().nullish(),
|
|
30014
|
+
lineStyle: schemas_enum([
|
|
30015
|
+
'solid',
|
|
30016
|
+
'dashed',
|
|
30017
|
+
'dotted'
|
|
30018
|
+
]).nullish()
|
|
29944
30019
|
});
|
|
29945
30020
|
const zAnnotationHorizontalLine = schemas_object({
|
|
29946
30021
|
yValue: union([
|
|
@@ -30036,7 +30111,9 @@ self.R = R;
|
|
|
30036
30111
|
selector: true,
|
|
30037
30112
|
measureId: true,
|
|
30038
30113
|
text: true
|
|
30039
|
-
}).partial()
|
|
30114
|
+
}).partial().extend({
|
|
30115
|
+
textBackgroundOpacity: schemas_number().nullish()
|
|
30116
|
+
});
|
|
30040
30117
|
const zAnnotationHorizontalLineConfig = zAnnotationHorizontalLine.pick({
|
|
30041
30118
|
lineColor: true,
|
|
30042
30119
|
lineWidth: true,
|
|
@@ -30052,6 +30129,8 @@ self.R = R;
|
|
|
30052
30129
|
textBackgroundBorderRadius: true,
|
|
30053
30130
|
textBackgroundPadding: true
|
|
30054
30131
|
}).extend({
|
|
30132
|
+
lineDash: schemas_array(schemas_number()).nullish(),
|
|
30133
|
+
textBackgroundOpacity: schemas_number().nullish(),
|
|
30055
30134
|
endSymbolVisible: schemas_boolean().nullish(),
|
|
30056
30135
|
endSymbolType: schemas_string().nullish(),
|
|
30057
30136
|
endSymbolSize: schemas_number().nullish(),
|
|
@@ -30077,12 +30156,18 @@ self.R = R;
|
|
|
30077
30156
|
areaBorderRadius: true,
|
|
30078
30157
|
areaLineDash: true,
|
|
30079
30158
|
outerPadding: true
|
|
30159
|
+
}).extend({
|
|
30160
|
+
textBackgroundOpacity: schemas_number().nullish()
|
|
30080
30161
|
}).partial();
|
|
30081
30162
|
const zAnnotationDifferenceLineConfig = zAnnotationDifferenceLine.pick({
|
|
30082
30163
|
lineColor: true,
|
|
30164
|
+
lineStyle: true,
|
|
30083
30165
|
textColor: true,
|
|
30084
30166
|
textFontSize: true,
|
|
30085
30167
|
textBackgroundColor: true
|
|
30168
|
+
}).extend({
|
|
30169
|
+
lineDash: schemas_array(schemas_number()).nullish(),
|
|
30170
|
+
textBackgroundOpacity: schemas_number().nullish()
|
|
30086
30171
|
}).partial();
|
|
30087
30172
|
const zAnnotationConfig = schemas_object({
|
|
30088
30173
|
annotationPoint: zAnnotationPointConfig.nullish(),
|
|
@@ -31810,23 +31895,52 @@ self.R = R;
|
|
|
31810
31895
|
titleColor: tokens.textPrimary
|
|
31811
31896
|
}
|
|
31812
31897
|
});
|
|
31813
|
-
const
|
|
31898
|
+
const getAnnotationLinePatch = (tokens)=>({
|
|
31899
|
+
lineColor: tokens.annotationLineColor,
|
|
31900
|
+
lineStyle: tokens.annotationLineStyle,
|
|
31901
|
+
lineDash: tokens.annotationLineDash,
|
|
31902
|
+
textColor: tokens.annotationTextColor,
|
|
31903
|
+
textBackgroundColor: tokens.annotationTextBackgroundColor,
|
|
31904
|
+
textBackgroundBorderColor: tokens.annotationTextBackgroundColor,
|
|
31905
|
+
textBackgroundOpacity: tokens.annotationTextBackgroundOpacity
|
|
31906
|
+
});
|
|
31907
|
+
const getAnnotationTextPatch = (tokens)=>({
|
|
31908
|
+
textColor: tokens.annotationTextColor,
|
|
31909
|
+
textBackgroundColor: tokens.annotationTextBackgroundColor,
|
|
31910
|
+
textBackgroundBorderColor: tokens.annotationTextBackgroundColor,
|
|
31911
|
+
textBackgroundOpacity: tokens.annotationTextBackgroundOpacity
|
|
31912
|
+
});
|
|
31913
|
+
const getAnnotationPatch = (tokens)=>{
|
|
31914
|
+
const annotationLinePatch = getAnnotationLinePatch(tokens);
|
|
31915
|
+
const annotationTextPatch = getAnnotationTextPatch(tokens);
|
|
31916
|
+
return {
|
|
31814
31917
|
annotationPoint: {
|
|
31815
|
-
textFontSize: tokens.labelFontSize
|
|
31918
|
+
textFontSize: tokens.labelFontSize,
|
|
31919
|
+
...annotationTextPatch
|
|
31816
31920
|
},
|
|
31817
31921
|
annotationHorizontalLine: {
|
|
31818
|
-
textFontSize: tokens.labelFontSize
|
|
31922
|
+
textFontSize: tokens.labelFontSize,
|
|
31923
|
+
...annotationLinePatch
|
|
31819
31924
|
},
|
|
31820
31925
|
annotationVerticalLine: {
|
|
31821
|
-
textFontSize: tokens.labelFontSize
|
|
31926
|
+
textFontSize: tokens.labelFontSize,
|
|
31927
|
+
...annotationLinePatch
|
|
31822
31928
|
},
|
|
31823
31929
|
annotationDifferenceLine: {
|
|
31824
|
-
textFontSize: tokens.labelFontSize
|
|
31930
|
+
textFontSize: tokens.labelFontSize,
|
|
31931
|
+
lineColor: tokens.annotationLineColor,
|
|
31932
|
+
lineStyle: tokens.annotationLineStyle,
|
|
31933
|
+
lineDash: tokens.annotationLineDash,
|
|
31934
|
+
textColor: tokens.annotationTextColor,
|
|
31935
|
+
textBackgroundColor: tokens.annotationTextBackgroundColor,
|
|
31936
|
+
textBackgroundOpacity: tokens.annotationTextBackgroundOpacity
|
|
31825
31937
|
},
|
|
31826
31938
|
annotationArea: {
|
|
31827
|
-
textFontSize: tokens.labelFontSize
|
|
31939
|
+
textFontSize: tokens.labelFontSize,
|
|
31940
|
+
...annotationTextPatch
|
|
31828
31941
|
}
|
|
31829
|
-
}
|
|
31942
|
+
};
|
|
31943
|
+
};
|
|
31830
31944
|
const getRegressionLinePatch = (tokens)=>({
|
|
31831
31945
|
kdeRegressionLine: {
|
|
31832
31946
|
textFontSize: tokens.labelFontSize
|