@visactor/vseed 0.4.28 → 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/advanced/chart/pipes/config/column.js +2 -1
- package/dist/esm/pipeline/advanced/chart/pipes/config/column.js.map +1 -1
- package/dist/esm/pipeline/advanced/chart/pipes/config/line.js +2 -1
- package/dist/esm/pipeline/advanced/chart/pipes/config/line.js.map +1 -1
- package/dist/esm/pipeline/advanced/chart/pipes/config/pie.js +2 -1
- package/dist/esm/pipeline/advanced/chart/pipes/config/pie.js.map +1 -1
- package/dist/esm/pipeline/advanced/chart/pipes/config/scatter.js +2 -1
- package/dist/esm/pipeline/advanced/chart/pipes/config/scatter.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipeline/area.js +3 -1
- package/dist/esm/pipeline/spec/chart/pipeline/area.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipeline/areaPercent.js +3 -1
- package/dist/esm/pipeline/spec/chart/pipeline/areaPercent.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipeline/bar.js +3 -1
- package/dist/esm/pipeline/spec/chart/pipeline/bar.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipeline/barParallel.js +3 -1
- package/dist/esm/pipeline/spec/chart/pipeline/barParallel.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipeline/barPercent.js +3 -1
- package/dist/esm/pipeline/spec/chart/pipeline/barPercent.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipeline/column.js +3 -1
- package/dist/esm/pipeline/spec/chart/pipeline/column.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipeline/columnParallel.js +3 -1
- package/dist/esm/pipeline/spec/chart/pipeline/columnParallel.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipeline/columnPercent.js +3 -1
- package/dist/esm/pipeline/spec/chart/pipeline/columnPercent.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipeline/donut.js +3 -1
- package/dist/esm/pipeline/spec/chart/pipeline/donut.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipeline/line.js +3 -1
- package/dist/esm/pipeline/spec/chart/pipeline/line.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipeline/pie.js +3 -1
- package/dist/esm/pipeline/spec/chart/pipeline/pie.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipeline/radar.js +3 -1
- package/dist/esm/pipeline/spec/chart/pipeline/radar.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipeline/rose.js +3 -1
- package/dist/esm/pipeline/spec/chart/pipeline/rose.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipeline/roseParallel.js +3 -1
- package/dist/esm/pipeline/spec/chart/pipeline/roseParallel.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipeline/scatter.js +3 -1
- package/dist/esm/pipeline/spec/chart/pipeline/scatter.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipes/animation/animation.d.ts +15 -0
- package/dist/esm/pipeline/spec/chart/pipes/animation/animation.js +94 -0
- package/dist/esm/pipeline/spec/chart/pipes/animation/animation.js.map +1 -0
- package/dist/esm/pipeline/spec/chart/pipes/animation/bar.d.ts +77 -0
- package/dist/esm/pipeline/spec/chart/pipes/animation/bar.js +88 -0
- package/dist/esm/pipeline/spec/chart/pipes/animation/bar.js.map +1 -0
- package/dist/esm/pipeline/spec/chart/pipes/animation/index.d.ts +2 -0
- package/dist/esm/pipeline/spec/chart/pipes/animation/index.js +2 -0
- package/dist/esm/pipeline/spec/chart/pipes/animation/lineOrArea.d.ts +254 -0
- package/dist/esm/pipeline/spec/chart/pipes/animation/lineOrArea.js +138 -0
- package/dist/esm/pipeline/spec/chart/pipes/animation/lineOrArea.js.map +1 -0
- package/dist/esm/pipeline/spec/chart/pipes/animation/pie.d.ts +71 -0
- package/dist/esm/pipeline/spec/chart/pipes/animation/pie.js +176 -0
- package/dist/esm/pipeline/spec/chart/pipes/animation/pie.js.map +1 -0
- package/dist/esm/pipeline/spec/chart/pipes/animation/radar.d.ts +131 -0
- package/dist/esm/pipeline/spec/chart/pipes/animation/radar.js +46 -0
- package/dist/esm/pipeline/spec/chart/pipes/animation/radar.js.map +1 -0
- package/dist/esm/pipeline/spec/chart/pipes/animation/scatter.d.ts +102 -0
- package/dist/esm/pipeline/spec/chart/pipes/animation/scatter.js +57 -0
- package/dist/esm/pipeline/spec/chart/pipes/animation/scatter.js.map +1 -0
- package/dist/esm/pipeline/spec/chart/pipes/animation/types.d.ts +130 -0
- package/dist/esm/pipeline/spec/chart/pipes/animation/types.js +19 -0
- package/dist/esm/pipeline/spec/chart/pipes/animation/types.js.map +1 -0
- package/dist/esm/pipeline/spec/chart/pipes/animation/utils/bar.d.ts +11 -0
- package/dist/esm/pipeline/spec/chart/pipes/animation/utils/bar.js +13 -0
- package/dist/esm/pipeline/spec/chart/pipes/animation/utils/bar.js.map +1 -0
- package/dist/esm/pipeline/spec/chart/pipes/animation/utils/barColor.d.ts +52 -0
- package/dist/esm/pipeline/spec/chart/pipes/animation/utils/barColor.js +51 -0
- package/dist/esm/pipeline/spec/chart/pipes/animation/utils/barColor.js.map +1 -0
- package/dist/esm/pipeline/spec/chart/pipes/animation/utils/barGroup.d.ts +102 -0
- package/dist/esm/pipeline/spec/chart/pipes/animation/utils/barGroup.js +84 -0
- package/dist/esm/pipeline/spec/chart/pipes/animation/utils/barGroup.js.map +1 -0
- package/dist/esm/pipeline/spec/chart/pipes/animation/utils/barMotion.d.ts +66 -0
- package/dist/esm/pipeline/spec/chart/pipes/animation/utils/barMotion.js +72 -0
- package/dist/esm/pipeline/spec/chart/pipes/animation/utils/barMotion.js.map +1 -0
- package/dist/esm/pipeline/spec/chart/pipes/animation/utils/index.d.ts +86 -0
- package/dist/esm/pipeline/spec/chart/pipes/animation/utils/index.js +60 -0
- package/dist/esm/pipeline/spec/chart/pipes/animation/utils/index.js.map +1 -0
- package/dist/esm/pipeline/spec/chart/pipes/animation/utils/lineOrArea.d.ts +29 -0
- package/dist/esm/pipeline/spec/chart/pipes/animation/utils/lineOrArea.js +20 -0
- package/dist/esm/pipeline/spec/chart/pipes/animation/utils/lineOrArea.js.map +1 -0
- package/dist/esm/pipeline/spec/chart/pipes/animation/utils/pie.d.ts +14 -0
- package/dist/esm/pipeline/spec/chart/pipes/animation/utils/pie.js +9 -0
- package/dist/esm/pipeline/spec/chart/pipes/animation/utils/pie.js.map +1 -0
- package/dist/esm/pipeline/spec/chart/pipes/animation/utils/scatter.d.ts +69 -0
- package/dist/esm/pipeline/spec/chart/pipes/animation/utils/scatter.js +59 -0
- package/dist/esm/pipeline/spec/chart/pipes/animation/utils/scatter.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/index.d.ts +1 -0
- package/dist/esm/pipeline/spec/chart/pipes/index.js +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/area.d.ts +6 -1
- package/dist/esm/types/chartType/area/zArea.d.ts +50 -0
- package/dist/esm/types/chartType/area/zArea.js +2 -1
- package/dist/esm/types/chartType/area/zArea.js.map +1 -1
- package/dist/esm/types/chartType/areaPercent/areaPercent.d.ts +6 -1
- package/dist/esm/types/chartType/areaPercent/zAreaPercent.d.ts +40 -0
- package/dist/esm/types/chartType/areaPercent/zAreaPercent.js +2 -1
- package/dist/esm/types/chartType/areaPercent/zAreaPercent.js.map +1 -1
- package/dist/esm/types/chartType/bar/bar.d.ts +6 -1
- package/dist/esm/types/chartType/bar/zBar.d.ts +50 -0
- package/dist/esm/types/chartType/bar/zBar.js +2 -1
- package/dist/esm/types/chartType/bar/zBar.js.map +1 -1
- package/dist/esm/types/chartType/barParallel/barParallel.d.ts +6 -1
- package/dist/esm/types/chartType/barParallel/zBarParallel.d.ts +50 -0
- package/dist/esm/types/chartType/barParallel/zBarParallel.js +2 -1
- package/dist/esm/types/chartType/barParallel/zBarParallel.js.map +1 -1
- package/dist/esm/types/chartType/barPercent/barPercent.d.ts +6 -1
- package/dist/esm/types/chartType/barPercent/zBarPercent.d.ts +40 -0
- package/dist/esm/types/chartType/barPercent/zBarPercent.js +2 -1
- package/dist/esm/types/chartType/barPercent/zBarPercent.js.map +1 -1
- package/dist/esm/types/chartType/column/column.d.ts +6 -1
- package/dist/esm/types/chartType/column/zColumn.d.ts +50 -0
- package/dist/esm/types/chartType/column/zColumn.js +2 -1
- package/dist/esm/types/chartType/column/zColumn.js.map +1 -1
- package/dist/esm/types/chartType/columnParallel/columnParallel.d.ts +6 -1
- package/dist/esm/types/chartType/columnParallel/zColumnParallel.d.ts +50 -0
- package/dist/esm/types/chartType/columnParallel/zColumnParallel.js +2 -1
- package/dist/esm/types/chartType/columnParallel/zColumnParallel.js.map +1 -1
- package/dist/esm/types/chartType/columnPercent/columnPercent.d.ts +6 -1
- package/dist/esm/types/chartType/columnPercent/zColumnPercent.d.ts +40 -0
- package/dist/esm/types/chartType/columnPercent/zColumnPercent.js +2 -1
- package/dist/esm/types/chartType/columnPercent/zColumnPercent.js.map +1 -1
- package/dist/esm/types/chartType/donut/donut.d.ts +6 -1
- package/dist/esm/types/chartType/donut/zDonut.d.ts +40 -0
- package/dist/esm/types/chartType/donut/zDonut.js +2 -1
- package/dist/esm/types/chartType/donut/zDonut.js.map +1 -1
- package/dist/esm/types/chartType/line/line.d.ts +6 -1
- package/dist/esm/types/chartType/line/zLine.d.ts +50 -0
- package/dist/esm/types/chartType/line/zLine.js +2 -1
- package/dist/esm/types/chartType/line/zLine.js.map +1 -1
- package/dist/esm/types/chartType/pie/pie.d.ts +6 -1
- package/dist/esm/types/chartType/pie/zPie.d.ts +40 -0
- package/dist/esm/types/chartType/pie/zPie.js +2 -1
- package/dist/esm/types/chartType/pie/zPie.js.map +1 -1
- package/dist/esm/types/chartType/radar/radar.d.ts +6 -1
- package/dist/esm/types/chartType/radar/zRadar.d.ts +40 -0
- package/dist/esm/types/chartType/radar/zRadar.js +2 -1
- package/dist/esm/types/chartType/radar/zRadar.js.map +1 -1
- package/dist/esm/types/chartType/rose/rose.d.ts +6 -1
- package/dist/esm/types/chartType/rose/zRose.d.ts +40 -0
- package/dist/esm/types/chartType/rose/zRose.js +2 -1
- package/dist/esm/types/chartType/rose/zRose.js.map +1 -1
- package/dist/esm/types/chartType/roseParallel/roseParallel.d.ts +6 -1
- package/dist/esm/types/chartType/roseParallel/zRoseParallel.d.ts +40 -0
- package/dist/esm/types/chartType/roseParallel/zRoseParallel.js +2 -1
- package/dist/esm/types/chartType/roseParallel/zRoseParallel.js.map +1 -1
- package/dist/esm/types/chartType/scatter/scatter.d.ts +6 -1
- package/dist/esm/types/chartType/scatter/zScatter.d.ts +40 -0
- package/dist/esm/types/chartType/scatter/zScatter.js +2 -1
- package/dist/esm/types/chartType/scatter/zScatter.js.map +1 -1
- 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/animation/animation.d.ts +72 -0
- package/dist/esm/types/properties/config/animation/animation.js +0 -0
- package/dist/esm/types/properties/config/animation/animationAtmosphere.d.ts +15 -0
- package/dist/esm/types/properties/config/animation/animationAtmosphere.js +0 -0
- package/dist/esm/types/properties/config/animation/animationConfig.d.ts +2 -0
- package/dist/esm/types/properties/config/animation/animationConfig.js +0 -0
- package/dist/esm/types/properties/config/animation/animationEffect.d.ts +72 -0
- package/dist/esm/types/properties/config/animation/animationEffect.js +0 -0
- package/dist/esm/types/properties/config/animation/animationLoop.d.ts +49 -0
- package/dist/esm/types/properties/config/animation/animationLoop.js +0 -0
- package/dist/esm/types/properties/config/animation/index.d.ts +6 -0
- package/dist/esm/types/properties/config/animation/index.js +1 -0
- package/dist/esm/types/properties/config/animation/zAnimation.d.ts +201 -0
- package/dist/esm/types/properties/config/animation/zAnimation.js +114 -0
- package/dist/esm/types/properties/config/animation/zAnimation.js.map +1 -0
- 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 +110 -4
- package/dist/esm/types/properties/config/area.js +3 -1
- package/dist/esm/types/properties/config/area.js.map +1 -1
- package/dist/esm/types/properties/config/bar.d.ts +165 -6
- package/dist/esm/types/properties/config/bar.js +3 -1
- package/dist/esm/types/properties/config/bar.js.map +1 -1
- package/dist/esm/types/properties/config/boxplot.d.ts +15 -2
- package/dist/esm/types/properties/config/column.d.ts +165 -6
- package/dist/esm/types/properties/config/column.js +3 -1
- package/dist/esm/types/properties/config/column.js.map +1 -1
- package/dist/esm/types/properties/config/config.d.ts +1125 -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/index.d.ts +1 -0
- package/dist/esm/types/properties/config/index.js +1 -0
- package/dist/esm/types/properties/config/line.d.ts +55 -2
- package/dist/esm/types/properties/config/line.js +3 -1
- package/dist/esm/types/properties/config/line.js.map +1 -1
- package/dist/esm/types/properties/config/pie.d.ts +120 -0
- package/dist/esm/types/properties/config/pie.js +6 -2
- package/dist/esm/types/properties/config/pie.js.map +1 -1
- package/dist/esm/types/properties/config/race.d.ts +330 -12
- package/dist/esm/types/properties/config/rose.d.ts +80 -0
- package/dist/esm/types/properties/config/rose.js +3 -1
- package/dist/esm/types/properties/config/rose.js.map +1 -1
- package/dist/esm/types/properties/config/scatter.d.ts +55 -2
- package/dist/esm/types/properties/config/scatter.js +3 -1
- package/dist/esm/types/properties/config/scatter.js.map +1 -1
- package/dist/esm/types/properties/theme/customTheme.d.ts +2250 -76
- package/dist/umd/index.js +5152 -689
- package/dist/umd/index.js.map +1 -1
- package/package.json +4 -9
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { ChartTypeEnum } from "../../../../../utils/index.js";
|
|
2
|
+
const horizontalTypes = [
|
|
3
|
+
ChartTypeEnum.Bar,
|
|
4
|
+
ChartTypeEnum.BarParallel,
|
|
5
|
+
ChartTypeEnum.BarPercent
|
|
6
|
+
];
|
|
7
|
+
const isHorizontalBar = (chartType)=>horizontalTypes.includes(chartType);
|
|
8
|
+
const getBarGrowOptions = (isHorizontal)=>(_datum, _element, _opt, context)=>{
|
|
9
|
+
const overall = context.vchart.getChart().getComponentsByType('cartesianAxis-linear')[0]._scale.range()[0];
|
|
10
|
+
return isHorizontal ? {
|
|
11
|
+
overall
|
|
12
|
+
} : {
|
|
13
|
+
orient: 'negative',
|
|
14
|
+
overall
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
const growBar = (chartType)=>{
|
|
18
|
+
const isHorizontal = isHorizontalBar(chartType);
|
|
19
|
+
return {
|
|
20
|
+
type: isHorizontal ? 'growWidthIn' : 'growHeightIn',
|
|
21
|
+
oneByOne: false,
|
|
22
|
+
options: getBarGrowOptions(isHorizontal),
|
|
23
|
+
controlOptions: {
|
|
24
|
+
immediatelyApply: true
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
const fadeInBar = ()=>({
|
|
29
|
+
type: 'fadeIn',
|
|
30
|
+
oneByOne: true
|
|
31
|
+
});
|
|
32
|
+
const setRandomDataKey = (spec)=>{
|
|
33
|
+
if (!spec?.data?.[0]?.values) return;
|
|
34
|
+
const dataKey = 'dataKey';
|
|
35
|
+
spec.data[0].values.forEach((datum)=>datum[dataKey] = Math.random());
|
|
36
|
+
spec.dataKey = dataKey;
|
|
37
|
+
if ('common' === spec.type && Array.isArray(spec.series)) spec.series.forEach((series)=>series.dataKey = dataKey);
|
|
38
|
+
};
|
|
39
|
+
const getBarMoveOptions = (chartType, orient)=>{
|
|
40
|
+
const direction = isHorizontalBar(chartType) ? 'y' : 'x';
|
|
41
|
+
const size = 'x' === direction ? 'width' : 'height';
|
|
42
|
+
const offsetSign = 'in' === orient ? 1 : -1;
|
|
43
|
+
return {
|
|
44
|
+
direction,
|
|
45
|
+
orient: 'negative',
|
|
46
|
+
point: (_datum, element, opt)=>({
|
|
47
|
+
[direction]: element.getGraphicAttribute(direction) + offsetSign * opt[size]
|
|
48
|
+
})
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
const moveInBar = (chartType, spec, isUpdate = false)=>{
|
|
52
|
+
if (!isUpdate && spec) setRandomDataKey(spec);
|
|
53
|
+
const excludeChannels = isHorizontalBar(chartType) ? [
|
|
54
|
+
'x'
|
|
55
|
+
] : [
|
|
56
|
+
'y'
|
|
57
|
+
];
|
|
58
|
+
return {
|
|
59
|
+
type: 'moveIn',
|
|
60
|
+
options: {
|
|
61
|
+
...getBarMoveOptions(chartType, 'in'),
|
|
62
|
+
excludeChannels
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
const moveOutBar = (chartType)=>({
|
|
67
|
+
type: 'moveOut',
|
|
68
|
+
options: getBarMoveOptions(chartType, 'out')
|
|
69
|
+
});
|
|
70
|
+
export { fadeInBar, growBar, isHorizontalBar, moveInBar, moveOutBar };
|
|
71
|
+
|
|
72
|
+
//# sourceMappingURL=barMotion.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pipeline/spec/chart/pipes/animation/utils/barMotion.js","sources":["../../../../../../../../src/pipeline/spec/chart/pipes/animation/utils/barMotion.ts"],"sourcesContent":["import { ChartTypeEnum } from 'src/pipeline/utils'\n\nconst horizontalTypes = [ChartTypeEnum.Bar, ChartTypeEnum.BarParallel, ChartTypeEnum.BarPercent]\n\n/**\n * @description 判断当前柱图类型是否为横向柱图。\n * @param chartType 图表类型。\n * @returns 是否为横向柱图。\n */\nexport const isHorizontalBar = (chartType: string): boolean => horizontalTypes.includes(chartType as any)\n\n/**\n * @description 生成柱图增长动画的 options,横向按宽度增长,纵向按高度反向增长。\n * @param isHorizontal 是否为横向柱图。\n * @returns 柱图增长动画 options 生成函数。\n */\nconst getBarGrowOptions = (isHorizontal: boolean) => (_datum: any, _element: any, _opt: any, context: any) => {\n const overall = context.vchart.getChart().getComponentsByType('cartesianAxis-linear')[0]._scale.range()[0]\n return isHorizontal ? { overall } : { orient: 'negative', overall }\n}\n\n/**\n * @description 生成柱图增长入场动画配置。\n * @param chartType 图表类型。\n * @returns 柱图增长入场动画配置。\n */\nexport const growBar = (chartType: string) => {\n const isHorizontal = isHorizontalBar(chartType)\n return {\n type: isHorizontal ? 'growWidthIn' : 'growHeightIn',\n oneByOne: false,\n options: getBarGrowOptions(isHorizontal),\n controlOptions: { immediatelyApply: true },\n }\n}\n\n/**\n * @description 生成柱图逐个淡入的动画配置。\n * @returns 柱图淡入动画配置。\n */\nexport const fadeInBar = () => ({ type: 'fadeIn', oneByOne: true })\n\n/**\n * @description 为柱图数据补充随机 dataKey,确保每根柱子按独立图元执行动画。\n * @param spec 当前 VChart spec。\n * @returns 无返回值,直接修改 spec。\n */\nconst setRandomDataKey = (spec: any) => {\n if (!spec?.data?.[0]?.values) return\n const dataKey = 'dataKey'\n spec.data[0].values.forEach((datum: any) => (datum[dataKey] = Math.random()))\n spec.dataKey = dataKey\n if (spec.type === 'common' && Array.isArray(spec.series)) {\n spec.series.forEach((series: any) => (series.dataKey = dataKey))\n }\n}\n\n/**\n * @description 生成柱图移入/移出的方向、位移点和通道配置。\n * @param chartType 图表类型。\n * @param orient 移动方向,in 表示移入,out 表示移出。\n * @returns 柱图移动动画 options。\n */\nconst getBarMoveOptions = (chartType: string, orient: 'in' | 'out') => {\n const direction = isHorizontalBar(chartType) ? 'y' : 'x'\n const size = direction === 'x' ? 'width' : 'height'\n const offsetSign = orient === 'in' ? 1 : -1\n\n return {\n direction,\n orient: 'negative',\n point: (_datum: any, element: any, opt: any) => ({\n [direction]: element.getGraphicAttribute(direction) + offsetSign * opt[size],\n }),\n }\n}\n\n/**\n * @description 生成柱图从画布外移入的动画配置。\n * @param chartType 图表类型。\n * @param spec 当前 VChart spec。\n * @param isUpdate 是否为 update 阶段动画。\n * @returns 柱图移入动画配置。\n */\nexport const moveInBar = (chartType: string, spec?: any, isUpdate = false) => {\n if (!isUpdate && spec) setRandomDataKey(spec)\n const excludeChannels = isHorizontalBar(chartType) ? ['x'] : ['y']\n return { type: 'moveIn', options: { ...getBarMoveOptions(chartType, 'in'), excludeChannels } }\n}\n\n/**\n * @description 生成柱图移出画布的动画配置。\n * @param chartType 图表类型。\n * @returns 柱图移出动画配置。\n */\nexport const moveOutBar = (chartType: string) => ({ type: 'moveOut', options: getBarMoveOptions(chartType, 'out') })\n"],"names":["horizontalTypes","ChartTypeEnum","isHorizontalBar","chartType","getBarGrowOptions","isHorizontal","_datum","_element","_opt","context","overall","growBar","fadeInBar","setRandomDataKey","spec","dataKey","datum","Math","Array","series","getBarMoveOptions","orient","direction","size","offsetSign","element","opt","moveInBar","isUpdate","excludeChannels","moveOutBar"],"mappings":";AAEA,MAAMA,kBAAkB;IAACC,cAAc,GAAG;IAAEA,cAAc,WAAW;IAAEA,cAAc,UAAU;CAAC;AAOzF,MAAMC,kBAAkB,CAACC,YAA+BH,gBAAgB,QAAQ,CAACG;AAOxF,MAAMC,oBAAoB,CAACC,eAA0B,CAACC,QAAaC,UAAeC,MAAWC;QAC3F,MAAMC,UAAUD,QAAQ,MAAM,CAAC,QAAQ,GAAG,mBAAmB,CAAC,uBAAuB,CAAC,EAAE,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,EAAE;QAC1G,OAAOJ,eAAe;YAAEK;QAAQ,IAAI;YAAE,QAAQ;YAAYA;QAAQ;IACpE;AAOO,MAAMC,UAAU,CAACR;IACtB,MAAME,eAAeH,gBAAgBC;IACrC,O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W,SAASiB,kBAAkBjB,WAAW;IAAO"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { type AnimationEffect, type AnimationEffectConfig } from '../types';
|
|
2
|
+
export declare const EFFECT_NONE: "none";
|
|
3
|
+
/**
|
|
4
|
+
* @description 将秒转换为 VChart 动画使用的毫秒。
|
|
5
|
+
* @param seconds 秒数。
|
|
6
|
+
* @returns 毫秒数。
|
|
7
|
+
*/
|
|
8
|
+
export declare const toMs: (seconds?: number) => number;
|
|
9
|
+
/**
|
|
10
|
+
* @description 获取配置中的首个动画效果;未配置时返回 none。
|
|
11
|
+
* @param config 动画效果配置。
|
|
12
|
+
* @returns 首个动画效果。
|
|
13
|
+
*/
|
|
14
|
+
export declare const getPrimaryEffect: (config?: AnimationEffectConfig) => AnimationEffect;
|
|
15
|
+
/**
|
|
16
|
+
* @description 判断通用动画配置是否开启且首个效果不是 none。
|
|
17
|
+
* @param config 动画效果配置。
|
|
18
|
+
* @returns 是否允许执行动画。
|
|
19
|
+
*/
|
|
20
|
+
export declare const allowAnimation: (config?: AnimationEffectConfig) => boolean;
|
|
21
|
+
/**
|
|
22
|
+
* @description 判断折线/面积动画是否开启;这类图表以最后一个效果作为有效性判断。
|
|
23
|
+
* @param config 动画效果配置。
|
|
24
|
+
* @returns 是否允许执行折线/面积动画。
|
|
25
|
+
*/
|
|
26
|
+
export declare const allowLineOrAreaAnimation: (config?: AnimationEffectConfig) => boolean;
|
|
27
|
+
/**
|
|
28
|
+
* @description 获取图元最终属性,优先读取动画后的 finalAttribute。
|
|
29
|
+
* @param mark VChart 图元对象。
|
|
30
|
+
* @returns 图元最终属性。
|
|
31
|
+
*/
|
|
32
|
+
export declare const getFinalAttribute: (mark: any) => Record<string, any>;
|
|
33
|
+
/**
|
|
34
|
+
* @description 生成点图元氛围动画配置,复用于折线、面积、散点和雷达图。
|
|
35
|
+
* @param effect 氛围动画效果。
|
|
36
|
+
* @returns 点图元氛围动画配置。
|
|
37
|
+
*/
|
|
38
|
+
export declare const atmospherePoint: (effect?: AnimationEffect) => {
|
|
39
|
+
channel?: undefined;
|
|
40
|
+
} | {
|
|
41
|
+
channel: {
|
|
42
|
+
scaleX: {
|
|
43
|
+
from: number;
|
|
44
|
+
to: number;
|
|
45
|
+
};
|
|
46
|
+
scaleY: {
|
|
47
|
+
from: number;
|
|
48
|
+
to: number;
|
|
49
|
+
};
|
|
50
|
+
fillOpacity?: undefined;
|
|
51
|
+
strokeOpacity?: undefined;
|
|
52
|
+
outerBorder?: undefined;
|
|
53
|
+
};
|
|
54
|
+
} | {
|
|
55
|
+
channel: {
|
|
56
|
+
fillOpacity: {
|
|
57
|
+
from: number;
|
|
58
|
+
to: number;
|
|
59
|
+
};
|
|
60
|
+
strokeOpacity: {
|
|
61
|
+
from: number;
|
|
62
|
+
to: number;
|
|
63
|
+
};
|
|
64
|
+
scaleX?: undefined;
|
|
65
|
+
scaleY?: undefined;
|
|
66
|
+
outerBorder?: undefined;
|
|
67
|
+
};
|
|
68
|
+
} | {
|
|
69
|
+
channel: {
|
|
70
|
+
outerBorder: {
|
|
71
|
+
from: {
|
|
72
|
+
distance: number;
|
|
73
|
+
strokeOpacity: number;
|
|
74
|
+
};
|
|
75
|
+
to: (...args: any[]) => {
|
|
76
|
+
distance: number;
|
|
77
|
+
strokeOpacity: number;
|
|
78
|
+
stroke: any;
|
|
79
|
+
};
|
|
80
|
+
};
|
|
81
|
+
scaleX?: undefined;
|
|
82
|
+
scaleY?: undefined;
|
|
83
|
+
fillOpacity?: undefined;
|
|
84
|
+
strokeOpacity?: undefined;
|
|
85
|
+
};
|
|
86
|
+
};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { VScreenAnimationType } from "../types.js";
|
|
2
|
+
const EFFECT_NONE = VScreenAnimationType.none;
|
|
3
|
+
const toMs = (seconds)=>(seconds ?? 0) * 1000;
|
|
4
|
+
const getPrimaryEffect = (config)=>config?.effects?.[0] ?? EFFECT_NONE;
|
|
5
|
+
const allowAnimation = (config)=>{
|
|
6
|
+
if (!config?.enable) return false;
|
|
7
|
+
return getPrimaryEffect(config) !== EFFECT_NONE;
|
|
8
|
+
};
|
|
9
|
+
const allowLineOrAreaAnimation = (config)=>{
|
|
10
|
+
if (!config?.enable) return false;
|
|
11
|
+
const effects = config.effects ?? [];
|
|
12
|
+
const effect = effects[effects.length - 1] ?? EFFECT_NONE;
|
|
13
|
+
return effect !== EFFECT_NONE;
|
|
14
|
+
};
|
|
15
|
+
const getFinalAttribute = (mark)=>mark?.finalAttribute ?? mark?.attribute ?? {};
|
|
16
|
+
const atmospherePoint = (effect)=>{
|
|
17
|
+
if (effect === EFFECT_NONE) return {};
|
|
18
|
+
if ('breath' === effect) return {
|
|
19
|
+
channel: {
|
|
20
|
+
scaleX: {
|
|
21
|
+
from: 0.8,
|
|
22
|
+
to: 1.2
|
|
23
|
+
},
|
|
24
|
+
scaleY: {
|
|
25
|
+
from: 0.8,
|
|
26
|
+
to: 1.2
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
if ('reveal' === effect) return {
|
|
31
|
+
channel: {
|
|
32
|
+
fillOpacity: {
|
|
33
|
+
from: 0.6,
|
|
34
|
+
to: 1
|
|
35
|
+
},
|
|
36
|
+
strokeOpacity: {
|
|
37
|
+
from: 0.6,
|
|
38
|
+
to: 1
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
return {
|
|
43
|
+
channel: {
|
|
44
|
+
outerBorder: {
|
|
45
|
+
from: {
|
|
46
|
+
distance: 0,
|
|
47
|
+
strokeOpacity: 1
|
|
48
|
+
},
|
|
49
|
+
to: (...args)=>({
|
|
50
|
+
distance: 16,
|
|
51
|
+
strokeOpacity: 1e-8,
|
|
52
|
+
stroke: args[1]?.attribute?.fill
|
|
53
|
+
})
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
export { EFFECT_NONE, allowAnimation, allowLineOrAreaAnimation, atmospherePoint, getFinalAttribute, getPrimaryEffect, toMs };
|
|
59
|
+
|
|
60
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pipeline/spec/chart/pipes/animation/utils/index.js","sources":["../../../../../../../../src/pipeline/spec/chart/pipes/animation/utils/index.ts"],"sourcesContent":["import { VScreenAnimationType, type AnimationEffect, type AnimationEffectConfig } from '../types'\n\nexport const EFFECT_NONE = VScreenAnimationType.none\n\n/**\n * @description 将秒转换为 VChart 动画使用的毫秒。\n * @param seconds 秒数。\n * @returns 毫秒数。\n */\nexport const toMs = (seconds?: number): number => (seconds ?? 0) * 1000\n\n/**\n * @description 获取配置中的首个动画效果;未配置时返回 none。\n * @param config 动画效果配置。\n * @returns 首个动画效果。\n */\nexport const getPrimaryEffect = (config?: AnimationEffectConfig): AnimationEffect => config?.effects?.[0] ?? EFFECT_NONE\n\n/**\n * @description 判断通用动画配置是否开启且首个效果不是 none。\n * @param config 动画效果配置。\n * @returns 是否允许执行动画。\n */\nexport const allowAnimation = (config?: AnimationEffectConfig): boolean => {\n if (!config?.enable) {\n return false\n }\n return getPrimaryEffect(config) !== EFFECT_NONE\n}\n\n/**\n * @description 判断折线/面积动画是否开启;这类图表以最后一个效果作为有效性判断。\n * @param config 动画效果配置。\n * @returns 是否允许执行折线/面积动画。\n */\nexport const allowLineOrAreaAnimation = (config?: AnimationEffectConfig): boolean => {\n if (!config?.enable) {\n return false\n }\n const effects = config.effects ?? []\n const effect = effects[effects.length - 1] ?? EFFECT_NONE\n return effect !== EFFECT_NONE\n}\n\n/**\n * @description 获取图元最终属性,优先读取动画后的 finalAttribute。\n * @param mark VChart 图元对象。\n * @returns 图元最终属性。\n */\nexport const getFinalAttribute = (mark: any): Record<string, any> => {\n return mark?.finalAttribute ?? mark?.attribute ?? {}\n}\n\n/**\n * @description 生成点图元氛围动画配置,复用于折线、面积、散点和雷达图。\n * @param effect 氛围动画效果。\n * @returns 点图元氛围动画配置。\n */\nexport const atmospherePoint = (effect?: AnimationEffect) => {\n if (effect === EFFECT_NONE) {\n return {}\n }\n if (effect === 'breath') {\n return {\n channel: {\n scaleX: { from: 0.8, to: 1.2 },\n scaleY: { from: 0.8, to: 1.2 },\n },\n }\n }\n if (effect === 'reveal') {\n return {\n channel: {\n fillOpacity: { from: 0.6, to: 1 },\n strokeOpacity: { from: 0.6, to: 1 },\n },\n }\n }\n return {\n channel: {\n outerBorder: {\n from: { distance: 0, strokeOpacity: 1 },\n // 波纹描边沿用图元填充色,避免自定义配色下出现突兀色值。\n to: (...args: any[]) => ({\n distance: 16,\n strokeOpacity: 1e-8,\n stroke: args[1]?.attribute?.fill,\n }),\n },\n },\n }\n}\n"],"names":["EFFECT_NONE","VScreenAnimationType","toMs","seconds","getPrimaryEffect","config","allowAnimation","allowLineOrAreaAnimation","effects","effect","getFinalAttribute","mark","atmospherePoint","args"],"mappings":";AAEO,MAAMA,cAAcC,qBAAqB,IAAI;AAO7C,MAAMC,OAAO,CAACC,UAA8BA,AAAAA,CAAAA,WAAW,KAAK;AAO5D,MAAMC,mBAAmB,CAACC,SAAoDA,QAAQ,SAAS,CAAC,EAAE,IAAIL;AAOtG,MAAMM,iBAAiB,CAACD;IAC7B,IAAI,CAACA,QAAQ,QACX,OAAO;IAET,OAAOD,iBAAiBC,YAAYL;AACtC;AAOO,MAAMO,2BAA2B,CAACF;IACvC,IAAI,CAACA,QAAQ,QACX,OAAO;IAET,MAAMG,UAAUH,OAAO,OAAO,IAAI,EAAE;IACpC,MAAMI,SAASD,OAAO,CAACA,QAAQ,MAAM,GAAG,EAAE,IAAIR;IAC9C,OAAOS,WAAWT;AACpB;AAOO,MAAMU,oBAAoB,CAACC,OACzBA,MAAM,kBAAkBA,MAAM,aAAa,CAAC;AAQ9C,MAAMC,kBAAkB,CAACH;IAC9B,IAAIA,WAAWT,aACb,OAAO,CAAC;IAEV,IAAIS,AAAW,aAAXA,QACF,OAAO;QACL,SAAS;YACP,QAAQ;gBAAE,MAAM;gBAAK,IAAI;YAAI;YAC7B,QAAQ;gBAAE,MAAM;gBAAK,IAAI;YAAI;QAC/B;IACF;IAEF,IAAIA,AAAW,aAAXA,QACF,OAAO;QACL,SAAS;YACP,aAAa;gBAAE,MAAM;gBAAK,IAAI;YAAE;YAChC,eAAe;gBAAE,MAAM;gBAAK,IAAI;YAAE;QACpC;IACF;IAEF,OAAO;QACL,SAAS;YACP,aAAa;gBACX,MAAM;oBAAE,UAAU;oBAAG,eAAe;gBAAE;gBAEtC,IAAI,CAAC,GAAGI,OAAiB;wBACvB,UAAU;wBACV,eAAe;wBACf,QAAQA,IAAI,CAAC,EAAE,EAAE,WAAW;oBAC9B;YACF;QACF;IACF;AACF"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description 生成折线/面积路径从顶部增长进入的动画配置。
|
|
3
|
+
* @returns 折线/面积路径增长动画配置。
|
|
4
|
+
*/
|
|
5
|
+
export declare const growthTopLine: () => {
|
|
6
|
+
type: string;
|
|
7
|
+
options: {
|
|
8
|
+
orient: string;
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* @description 生成折线/面积点图元从顶部移入的动画配置。
|
|
13
|
+
* @returns 折线/面积点图元移入动画配置。
|
|
14
|
+
*/
|
|
15
|
+
export declare const growthTopPoint: () => {
|
|
16
|
+
type: string;
|
|
17
|
+
options: {
|
|
18
|
+
direction: string;
|
|
19
|
+
orient: string;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* @description 生成曲线整体裁剪进入的动画配置,用于 load 效果。
|
|
24
|
+
* @returns 曲线整体裁剪进入的动画配置。
|
|
25
|
+
*/
|
|
26
|
+
export declare const clipInLine: () => {
|
|
27
|
+
type: string;
|
|
28
|
+
oneByOne: boolean;
|
|
29
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
const growthTopLine = ()=>({
|
|
2
|
+
type: 'growPointsYIn',
|
|
3
|
+
options: {
|
|
4
|
+
orient: 'negative'
|
|
5
|
+
}
|
|
6
|
+
});
|
|
7
|
+
const growthTopPoint = ()=>({
|
|
8
|
+
type: 'moveIn',
|
|
9
|
+
options: {
|
|
10
|
+
direction: 'y',
|
|
11
|
+
orient: 'negative'
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
const clipInLine = ()=>({
|
|
15
|
+
type: 'clipIn',
|
|
16
|
+
oneByOne: false
|
|
17
|
+
});
|
|
18
|
+
export { clipInLine, growthTopLine, growthTopPoint };
|
|
19
|
+
|
|
20
|
+
//# sourceMappingURL=lineOrArea.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pipeline/spec/chart/pipes/animation/utils/lineOrArea.js","sources":["../../../../../../../../src/pipeline/spec/chart/pipes/animation/utils/lineOrArea.ts"],"sourcesContent":["/**\n * @description 生成折线/面积路径从顶部增长进入的动画配置。\n * @returns 折线/面积路径增长动画配置。\n */\nexport const growthTopLine = () => ({ type: 'growPointsYIn', options: { orient: 'negative' } })\n\n/**\n * @description 生成折线/面积点图元从顶部移入的动画配置。\n * @returns 折线/面积点图元移入动画配置。\n */\nexport const growthTopPoint = () => ({ type: 'moveIn', options: { direction: 'y', orient: 'negative' } })\n\n/**\n * @description 生成曲线整体裁剪进入的动画配置,用于 load 效果。\n * @returns 曲线整体裁剪进入的动画配置。\n */\nexport const clipInLine = () => ({ type: 'clipIn', oneByOne: false })\n"],"names":["growthTopLine","growthTopPoint","clipInLine"],"mappings":"AAIO,MAAMA,gBAAgB,IAAO;QAAE,MAAM;QAAiB,SAAS;YAAE,QAAQ;QAAW;IAAE;AAMtF,MAAMC,iBAAiB,IAAO;QAAE,MAAM;QAAU,SAAS;YAAE,WAAW;YAAK,QAAQ;QAAW;IAAE;AAMhG,MAAMC,aAAa,IAAO;QAAE,MAAM;QAAU,UAAU;IAAM"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description 生成饼图/玫瑰图按角度展开的入场动画配置。
|
|
3
|
+
* @returns 饼图/玫瑰图角度展开动画配置。
|
|
4
|
+
*/
|
|
5
|
+
export declare const radialPie: () => {
|
|
6
|
+
type: string;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* @description 生成饼图/玫瑰图按半径展开的入场动画配置。
|
|
10
|
+
* @returns 饼图/玫瑰图半径展开动画配置。
|
|
11
|
+
*/
|
|
12
|
+
export declare const scalePie: () => {
|
|
13
|
+
type: string;
|
|
14
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pipeline/spec/chart/pipes/animation/utils/pie.js","sources":["../../../../../../../../src/pipeline/spec/chart/pipes/animation/utils/pie.ts"],"sourcesContent":["/**\n * @description 生成饼图/玫瑰图按角度展开的入场动画配置。\n * @returns 饼图/玫瑰图角度展开动画配置。\n */\nexport const radialPie = () => ({ type: 'growAngleIn' })\n\n/**\n * @description 生成饼图/玫瑰图按半径展开的入场动画配置。\n * @returns 饼图/玫瑰图半径展开动画配置。\n */\nexport const scalePie = () => ({ type: 'growRadiusIn' })\n"],"names":["radialPie","scalePie"],"mappings":"AAIO,MAAMA,YAAY,IAAO;QAAE,MAAM;IAAc;AAM/C,MAAMC,WAAW,IAAO;QAAE,MAAM;IAAe"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description 生成散点飞入动画,同时恢复透明度和尺寸。
|
|
3
|
+
* @param duration 动画总时长,单位毫秒。
|
|
4
|
+
* @param easing 缓动函数名称。
|
|
5
|
+
* @param loop 是否循环播放。
|
|
6
|
+
* @param startTime 循环时间线起始时间,单位毫秒。
|
|
7
|
+
* @param delayAfter 单次动画结束后的等待时间,单位毫秒。
|
|
8
|
+
* @returns 散点飞入动画配置。
|
|
9
|
+
*/
|
|
10
|
+
export declare const flyInScatter: (duration: number, easing?: string, loop?: boolean, startTime?: number, delayAfter?: number) => ({
|
|
11
|
+
loop: boolean;
|
|
12
|
+
startTime: number;
|
|
13
|
+
duration: number;
|
|
14
|
+
easing: string | undefined;
|
|
15
|
+
type: string;
|
|
16
|
+
delayAfter: number;
|
|
17
|
+
options: {
|
|
18
|
+
direction: string;
|
|
19
|
+
orient: string;
|
|
20
|
+
};
|
|
21
|
+
controlOptions: {
|
|
22
|
+
immediatelyApply: boolean;
|
|
23
|
+
};
|
|
24
|
+
channel?: undefined;
|
|
25
|
+
} | {
|
|
26
|
+
loop: boolean;
|
|
27
|
+
startTime: number;
|
|
28
|
+
duration: number;
|
|
29
|
+
easing: string | undefined;
|
|
30
|
+
delayAfter: number;
|
|
31
|
+
channel: {
|
|
32
|
+
fillOpacity: {
|
|
33
|
+
from: number;
|
|
34
|
+
};
|
|
35
|
+
size: {
|
|
36
|
+
from: (...args: any[]) => any;
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
controlOptions: {
|
|
40
|
+
immediatelyApply: boolean;
|
|
41
|
+
};
|
|
42
|
+
type?: undefined;
|
|
43
|
+
options?: undefined;
|
|
44
|
+
})[];
|
|
45
|
+
/**
|
|
46
|
+
* @description 生成散点缩放进入动画,保持点中心不变并从 0 过渡到最终尺寸。
|
|
47
|
+
* @param duration 动画时长,单位毫秒。
|
|
48
|
+
* @param easing 缓动函数名称。
|
|
49
|
+
* @param loop 是否循环播放。
|
|
50
|
+
* @param startTime 循环时间线起始时间,单位毫秒。
|
|
51
|
+
* @param delayAfter 单次动画结束后的等待时间,单位毫秒。
|
|
52
|
+
* @returns 散点缩放动画配置。
|
|
53
|
+
*/
|
|
54
|
+
export declare const scaleInScatter: (duration: number, easing?: string, loop?: boolean, startTime?: number, delayAfter?: number) => {
|
|
55
|
+
loop: boolean;
|
|
56
|
+
startTime: number;
|
|
57
|
+
duration: number;
|
|
58
|
+
easing: string | undefined;
|
|
59
|
+
delayAfter: number;
|
|
60
|
+
channel: {
|
|
61
|
+
size: {
|
|
62
|
+
from: number;
|
|
63
|
+
to: (...args: any[]) => any;
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
controlOptions: {
|
|
67
|
+
immediatelyApply: boolean;
|
|
68
|
+
};
|
|
69
|
+
}[];
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
const flyInScatter = (duration, easing, loop = false, startTime = 0, delayAfter = 0)=>{
|
|
2
|
+
const half = duration / 2;
|
|
3
|
+
return [
|
|
4
|
+
{
|
|
5
|
+
loop,
|
|
6
|
+
startTime,
|
|
7
|
+
duration: half,
|
|
8
|
+
easing,
|
|
9
|
+
type: 'moveIn',
|
|
10
|
+
delayAfter,
|
|
11
|
+
options: {
|
|
12
|
+
direction: 'y',
|
|
13
|
+
orient: 'negative'
|
|
14
|
+
},
|
|
15
|
+
controlOptions: {
|
|
16
|
+
immediatelyApply: false
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
loop,
|
|
21
|
+
startTime,
|
|
22
|
+
duration: half,
|
|
23
|
+
easing,
|
|
24
|
+
delayAfter,
|
|
25
|
+
channel: {
|
|
26
|
+
fillOpacity: {
|
|
27
|
+
from: 0.5
|
|
28
|
+
},
|
|
29
|
+
size: {
|
|
30
|
+
from: (...args)=>args[1]?.attribute?.size
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
controlOptions: {
|
|
34
|
+
immediatelyApply: false
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
];
|
|
38
|
+
};
|
|
39
|
+
const scaleInScatter = (duration, easing, loop = false, startTime = 0, delayAfter = 0)=>[
|
|
40
|
+
{
|
|
41
|
+
loop,
|
|
42
|
+
startTime,
|
|
43
|
+
duration,
|
|
44
|
+
easing,
|
|
45
|
+
delayAfter,
|
|
46
|
+
channel: {
|
|
47
|
+
size: {
|
|
48
|
+
from: 0,
|
|
49
|
+
to: (...args)=>args[1]?.attribute?.size
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
controlOptions: {
|
|
53
|
+
immediatelyApply: false
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
];
|
|
57
|
+
export { flyInScatter, scaleInScatter };
|
|
58
|
+
|
|
59
|
+
//# sourceMappingURL=scatter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pipeline/spec/chart/pipes/animation/utils/scatter.js","sources":["../../../../../../../../src/pipeline/spec/chart/pipes/animation/utils/scatter.ts"],"sourcesContent":["/**\n * @description 生成散点飞入动画,同时恢复透明度和尺寸。\n * @param duration 动画总时长,单位毫秒。\n * @param easing 缓动函数名称。\n * @param loop 是否循环播放。\n * @param startTime 循环时间线起始时间,单位毫秒。\n * @param delayAfter 单次动画结束后的等待时间,单位毫秒。\n * @returns 散点飞入动画配置。\n */\nexport const flyInScatter = (duration: number, easing?: string, loop = false, startTime = 0, delayAfter = 0) => {\n const half = duration / 2\n return [\n {\n loop,\n startTime,\n duration: half,\n easing,\n type: 'moveIn',\n delayAfter,\n options: { direction: 'y', orient: 'negative' },\n controlOptions: { immediatelyApply: false },\n },\n {\n loop,\n startTime,\n duration: half,\n easing,\n delayAfter,\n channel: { fillOpacity: { from: 0.5 }, size: { from: (...args: any[]) => args[1]?.attribute?.size } },\n controlOptions: { immediatelyApply: false },\n },\n ]\n}\n\n/**\n * @description 生成散点缩放进入动画,保持点中心不变并从 0 过渡到最终尺寸。\n * @param duration 动画时长,单位毫秒。\n * @param easing 缓动函数名称。\n * @param loop 是否循环播放。\n * @param startTime 循环时间线起始时间,单位毫秒。\n * @param delayAfter 单次动画结束后的等待时间,单位毫秒。\n * @returns 散点缩放动画配置。\n */\nexport const scaleInScatter = (duration: number, easing?: string, loop = false, startTime = 0, delayAfter = 0) => [\n {\n loop,\n startTime,\n duration,\n easing,\n delayAfter,\n channel: { size: { from: 0, to: (...args: any[]) => args[1]?.attribute?.size } },\n controlOptions: { immediatelyApply: false },\n },\n]\n"],"names":["flyInScatter","duration","easing","loop","startTime","delayAfter","half","args","scaleInScatter"],"mappings":"AASO,MAAMA,eAAe,CAACC,UAAkBC,QAAiBC,OAAO,KAAK,EAAEC,YAAY,CAAC,EAAEC,aAAa,CAAC;IACzG,MAAMC,OAAOL,WAAW;IACxB,OAAO;QACL;YACEE;YACAC;YACA,UAAUE;YACVJ;YACA,MAAM;YACNG;YACA,SAAS;gBAAE,WAAW;gBAAK,QAAQ;YAAW;YAC9C,gBAAgB;gBAAE,kBAAkB;YAAM;QAC5C;QACA;YACEF;YACAC;YACA,UAAUE;YACVJ;YACAG;YACA,SAAS;gBAAE,aAAa;oBAAE,MAAM;gBAAI;gBAAG,MAAM;oBAAE,MAAM,CAAC,GAAGE,OAAgBA,IAAI,CAAC,EAAE,EAAE,WAAW;gBAAK;YAAE;YACpG,gBAAgB;gBAAE,kBAAkB;YAAM;QAC5C;KACD;AACH;AAWO,MAAMC,iBAAiB,CAACP,UAAkBC,QAAiBC,OAAO,KAAK,EAAEC,YAAY,CAAC,EAAEC,aAAa,CAAC,GAAK;QAChH;YACEF;YACAC;YACAH;YACAC;YACAG;YACA,SAAS;gBAAE,MAAM;oBAAE,MAAM;oBAAG,IAAI,CAAC,GAAGE,OAAgBA,IAAI,CAAC,EAAE,EAAE,WAAW;gBAAK;YAAE;YAC/E,gBAAgB;gBAAE,kBAAkB;YAAM;QAC5C;KACD"}
|
|
@@ -24,6 +24,7 @@ const annotationArea_annotationArea = (spec, context)=>{
|
|
|
24
24
|
const defaultTextPosition = isBarLikeChart(advancedVSeed) ? 'right' : 'top';
|
|
25
25
|
const markArea = annotationAreaList.flatMap((annotationArea)=>{
|
|
26
26
|
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;
|
|
27
|
+
const textBackgroundOpacity = theme?.textBackgroundOpacity;
|
|
27
28
|
const dataset = advancedVSeed.dataset.flat();
|
|
28
29
|
const selectedData = selectorPoint ? dataset.filter((datum)=>selector(datum, selectorPoint)) : [];
|
|
29
30
|
const textPosition = annotationArea.textPosition ?? defaultTextPosition;
|
|
@@ -94,7 +95,6 @@ const annotationArea_annotationArea = (spec, context)=>{
|
|
|
94
95
|
visible: true,
|
|
95
96
|
text: text,
|
|
96
97
|
style: {
|
|
97
|
-
opacity: 0.95,
|
|
98
98
|
textAlign: textAlign,
|
|
99
99
|
textBaseline: textBaseline,
|
|
100
100
|
fill: textColor,
|
|
@@ -107,7 +107,7 @@ const annotationArea_annotationArea = (spec, context)=>{
|
|
|
107
107
|
visible: textBackgroundVisible,
|
|
108
108
|
padding: textBackgroundPadding,
|
|
109
109
|
style: {
|
|
110
|
-
opacity: 0.95,
|
|
110
|
+
opacity: textBackgroundOpacity ?? 0.95,
|
|
111
111
|
cornerRadius: textBackgroundBorderRadius ?? 4,
|
|
112
112
|
fill: textBackgroundColor,
|
|
113
113
|
stroke: textBackgroundBorderColor,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pipeline/spec/chart/pipes/annotation/annotationArea.js","sources":["../../../../../../../src/pipeline/spec/chart/pipes/annotation/annotationArea.ts"],"sourcesContent":["/**\n * @description 适用于线图、面积图等的区块标注,计算标注区块的时候,只考虑点的大小\n */\nimport type { ICartesianSeries, ILineChartSpec } from '@visactor/vchart'\nimport { selector } from '../../../../../dataSelector'\nimport type { Datum, VChartSpecPipe, VSeed } from 'src/types'\nimport { ANNOTATION_AREA_TEXT_STYLE_BY_POSITION, isSubset } from './utils'\nimport { ANNOTATION_Z_INDEX } from '../../../../utils/constant'\nimport { isBarLikeChart } from 'src/pipeline/utils/chatType'\n\nexport const annotationArea: VChartSpecPipe = (spec, context) => {\n const { advancedVSeed, vseed } = context\n const { annotation, config } = advancedVSeed\n\n if (!annotation || !annotation.annotationArea) {\n return spec\n }\n\n const theme = config?.[vseed.chartType as 'column']?.annotation?.annotationArea\n const { annotationArea } = annotation\n const annotationAreaList = Array.isArray(annotationArea) ? annotationArea : [annotationArea]\n\n const positionMap = {\n top: 'insideTop',\n topRight: 'insideTopRight',\n topLeft: 'insideTopLeft',\n bottom: 'insideBottom',\n bottomLeft: 'insideBottomLeft',\n bottomRight: 'insideBottomRight',\n left: 'insideLeft',\n right: 'insideRight',\n }\n const defaultTextPosition = isBarLikeChart(advancedVSeed as VSeed) ? 'right' : 'top'\n\n const markArea = annotationAreaList.flatMap((annotationArea) => {\n const {\n selector: selectorPoint,\n text = '',\n textColor = theme?.textColor ?? '#ffffff',\n textFontSize = theme?.textFontSize ?? 12,\n textFontWeight = theme?.textFontWeight ?? 400,\n\n textBackgroundVisible = theme?.textBackgroundVisible ?? true,\n textBackgroundColor = theme?.textBackgroundColor ?? '#191d24',\n textBackgroundBorderColor = theme?.textBackgroundBorderColor ?? '#191d24',\n textBackgroundBorderWidth = theme?.textBackgroundBorderWidth ?? 1,\n textBackgroundBorderRadius = theme?.textBackgroundBorderRadius ?? 4,\n textBackgroundPadding = theme?.textBackgroundPadding ?? 4,\n\n areaColor = theme?.areaColor ?? '#888888',\n areaColorOpacity = theme?.areaColorOpacity ?? 0.15,\n areaBorderColor = theme?.areaBorderColor ?? '#888888',\n areaBorderRadius = theme?.areaBorderRadius ?? 4,\n areaBorderWidth = theme?.areaBorderWidth ?? 1,\n areaLineDash = theme?.areaLineDash,\n\n outerPadding = theme?.outerPadding ?? 4,\n } = annotationArea\n\n const dataset = advancedVSeed.dataset.flat()\n const selectedData = selectorPoint ? dataset.filter((datum) => selector(datum, selectorPoint)) : []\n const textPosition: string = annotationArea.textPosition ?? defaultTextPosition\n const textAlign =\n annotationArea.textAlign ??\n ANNOTATION_AREA_TEXT_STYLE_BY_POSITION[textPosition as keyof typeof ANNOTATION_AREA_TEXT_STYLE_BY_POSITION]\n .textAlign\n const textBaseline =\n annotationArea.textBaseline ??\n ANNOTATION_AREA_TEXT_STYLE_BY_POSITION[textPosition as keyof typeof ANNOTATION_AREA_TEXT_STYLE_BY_POSITION]\n .textBaseline\n\n return {\n zIndex: ANNOTATION_Z_INDEX,\n regionRelative: true,\n positions: (data: Datum[], context: ICartesianSeries) => {\n const positionData = data.filter((item) => selectedData.some((datum) => isSubset(datum, item)))\n const xyList = positionData.map((datum) => context.dataToPosition(datum) as { x: number; y: number })\n\n const yAxisHelper = context.getYAxisHelper() as unknown as {\n getBandwidth: (depth?: number) => number\n getScale: () => {\n range: () => number[]\n }\n }\n const xAxisHelper = context.getXAxisHelper() as unknown as {\n getBandwidth: (depth?: number) => number\n getScale: () => {\n range: () => number[]\n }\n }\n\n if (typeof xAxisHelper?.getBandwidth === 'function') {\n const regionRect = context.getRegion().getLayoutRect()\n\n const minX = Math.min(...xyList.map((item) => item.x)) - (outerPadding || 4)\n const maxX = Math.max(...xyList.map((item) => item.x)) + (outerPadding || 4)\n const minY = 0\n const maxY = regionRect.height\n return [\n // 左上\n {\n x: minX,\n y: minY,\n },\n // 右上\n {\n x: maxX,\n y: minY,\n },\n // 右下\n {\n x: maxX,\n y: maxY,\n },\n // 左下\n {\n x: minX,\n y: maxY,\n },\n ]\n }\n\n if (typeof yAxisHelper?.getBandwidth === 'function') {\n const regionRect = context.getRegion().getLayoutRect()\n\n const minY = Math.min(...xyList.map((item) => item.y)) - (outerPadding || 4)\n const maxY = Math.max(...xyList.map((item) => item.y)) + (outerPadding || 4)\n const minX = 0\n const maxX = regionRect.width\n\n return [\n // 左上\n {\n x: minX,\n y: minY,\n },\n // 右上\n {\n x: maxX,\n y: minY,\n },\n // 右下\n {\n x: maxX,\n y: maxY,\n },\n // 左下\n {\n x: minX,\n y: maxY,\n },\n ]\n }\n\n return []\n },\n label: {\n position: (positionMap as any)[textPosition],\n visible: true,\n text: text,\n style: {\n opacity: 0.95,\n textAlign: textAlign,\n textBaseline: textBaseline,\n fill: textColor,\n stroke: textBackgroundColor,\n lineWidth: 1,\n fontSize: textFontSize,\n fontWeight: textFontWeight,\n },\n\n labelBackground: {\n visible: textBackgroundVisible,\n padding: textBackgroundPadding,\n style: {\n opacity: 0.95,\n cornerRadius: textBackgroundBorderRadius ?? 4,\n fill: textBackgroundColor,\n stroke: textBackgroundBorderColor,\n lineWidth: textBackgroundBorderWidth,\n fillOpacity: 1,\n },\n },\n },\n area: {\n style: {\n visible: true,\n fill: areaColor,\n fillOpacity: areaColorOpacity,\n stroke: areaBorderColor,\n lineWidth: areaBorderWidth,\n cornerRadius: areaBorderRadius,\n lineDash: areaLineDash,\n },\n },\n }\n }) as ILineChartSpec['markArea']\n\n return {\n ...spec,\n markArea: markArea,\n }\n}\n"],"names":["annotationArea","spec","context","advancedVSeed","vseed","annotation","config","theme","annotationAreaList","Array","positionMap","defaultTextPosition","isBarLikeChart","markArea","selectorPoint","text","textColor","textFontSize","textFontWeight","textBackgroundVisible","textBackgroundColor","textBackgroundBorderColor","textBackgroundBorderWidth","textBackgroundBorderRadius","textBackgroundPadding","areaColor","areaColorOpacity","areaBorderColor","areaBorderRadius","areaBorderWidth","areaLineDash","outerPadding","dataset","selectedData","datum","selector","textPosition","textAlign","ANNOTATION_AREA_TEXT_STYLE_BY_POSITION","textBaseline","ANNOTATION_Z_INDEX","data","positionData","item","isSubset","xyList","yAxisHelper","xAxisHelper","regionRect","minX","Math","maxX","minY","maxY"],"mappings":";;;;AAUO,MAAMA,gCAAiC,CAACC,MAAMC;IACnD,MAAM,EAAEC,aAAa,EAAEC,KAAK,EAAE,GAA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AEpD,MAAMkD,OAAOF,KAAK,GAAG,IAAIL,OAAO,GAAG,CAAC,CAACF,OAASA,KAAK,CAAC,KAAMZ,CAAAA,gBAAgB;oBAC1E,MAAMsB,OAAOH,KAAK,GAAG,IAAIL,OAAO,GAAG,CAAC,CAACF,OAASA,KAAK,CAAC,KAAMZ,CAAAA,gBAAgB;oBAC1E,MAAMkB,OAAO;oBACb,MAAME,OAAOH,WAAW,KAAK;oBAE7B,OAAO;wBAEL;4BACE,GAAGC;4BACH,GAAGG;wBACL;wBAEA;4BACE,GAAGD;4BACH,GAAGC;wBACL;wBAEA;4BACE,GAAGD;4BACH,GAAGE;wBACL;wBAEA;4BACE,GAAGJ;4BACH,GAAGI;wBACL;qBACD;gBACH;gBAEA,OAAO,EAAE;YACX;YACA,OAAO;gBACL,UAAW3C,WAAmB,CAAC0B,aAAa;gBAC5C,SAAS;gBACT,MAAMrB;gBACN,OAAO;oBACL,SAAS;oBACT,WAAWsB;oBACX,cAAcE;oBACd,MAAMvB;oBACN,QAAQI;oBACR,WAAW;oBACX,UAAUH;oBACV,YAAYC;gBACd;gBAEA,iBAAiB;oBACf,SAASC;oBACT,SAASK;oBACT,OAAO;wBACL,SAAS;wBACT,cAAcD,8BAA8B;wBAC5C,MAAMH;wBACN,QAAQC;wBACR,WAAWC;wBACX,aAAa;oBACf;gBACF;YACF;YACA,MAAM;gBACJ,OAAO;oBACL,SAAS;oBACT,MAAMG;oBACN,aAAaC;oBACb,QAAQC;oBACR,WAAWE;oBACX,cAAcD;oBACd,UAAUE;gBACZ;YACF;QACF;IACF;IAEA,OAAO;QACL,GAAG7B,IAAI;QACP,UAAUY;IACZ;AACF"}
|
|
1
|
+
{"version":3,"file":"pipeline/spec/chart/pipes/annotation/annotationArea.js","sources":["../../../../../../../src/pipeline/spec/chart/pipes/annotation/annotationArea.ts"],"sourcesContent":["/**\n * @description 适用于线图、面积图等的区块标注,计算标注区块的时候,只考虑点的大小\n */\nimport type { ICartesianSeries, ILineChartSpec } from '@visactor/vchart'\nimport { selector } from '../../../../../dataSelector'\nimport type { Datum, VChartSpecPipe, VSeed } from 'src/types'\nimport { ANNOTATION_AREA_TEXT_STYLE_BY_POSITION, isSubset } from './utils'\nimport { ANNOTATION_Z_INDEX } from '../../../../utils/constant'\nimport { isBarLikeChart } from 'src/pipeline/utils/chatType'\n\nexport const annotationArea: VChartSpecPipe = (spec, context) => {\n const { advancedVSeed, vseed } = context\n const { annotation, config } = advancedVSeed\n\n if (!annotation || !annotation.annotationArea) {\n return spec\n }\n\n const theme = config?.[vseed.chartType as 'column']?.annotation?.annotationArea\n const { annotationArea } = annotation\n const annotationAreaList = Array.isArray(annotationArea) ? annotationArea : [annotationArea]\n\n const positionMap = {\n top: 'insideTop',\n topRight: 'insideTopRight',\n topLeft: 'insideTopLeft',\n bottom: 'insideBottom',\n bottomLeft: 'insideBottomLeft',\n bottomRight: 'insideBottomRight',\n left: 'insideLeft',\n right: 'insideRight',\n }\n const defaultTextPosition = isBarLikeChart(advancedVSeed as VSeed) ? 'right' : 'top'\n\n const markArea = annotationAreaList.flatMap((annotationArea) => {\n const {\n selector: selectorPoint,\n text = '',\n textColor = theme?.textColor ?? '#ffffff',\n textFontSize = theme?.textFontSize ?? 12,\n textFontWeight = theme?.textFontWeight ?? 400,\n\n textBackgroundVisible = theme?.textBackgroundVisible ?? true,\n textBackgroundColor = theme?.textBackgroundColor ?? '#191d24',\n textBackgroundBorderColor = theme?.textBackgroundBorderColor ?? '#191d24',\n textBackgroundBorderWidth = theme?.textBackgroundBorderWidth ?? 1,\n textBackgroundBorderRadius = theme?.textBackgroundBorderRadius ?? 4,\n textBackgroundPadding = theme?.textBackgroundPadding ?? 4,\n\n areaColor = theme?.areaColor ?? '#888888',\n areaColorOpacity = theme?.areaColorOpacity ?? 0.15,\n areaBorderColor = theme?.areaBorderColor ?? '#888888',\n areaBorderRadius = theme?.areaBorderRadius ?? 4,\n areaBorderWidth = theme?.areaBorderWidth ?? 1,\n areaLineDash = theme?.areaLineDash,\n\n outerPadding = theme?.outerPadding ?? 4,\n } = annotationArea\n const textBackgroundOpacity = theme?.textBackgroundOpacity\n\n const dataset = advancedVSeed.dataset.flat()\n const selectedData = selectorPoint ? dataset.filter((datum) => selector(datum, selectorPoint)) : []\n const textPosition: string = annotationArea.textPosition ?? defaultTextPosition\n const textAlign =\n annotationArea.textAlign ??\n ANNOTATION_AREA_TEXT_STYLE_BY_POSITION[textPosition as keyof typeof ANNOTATION_AREA_TEXT_STYLE_BY_POSITION]\n .textAlign\n const textBaseline =\n annotationArea.textBaseline ??\n ANNOTATION_AREA_TEXT_STYLE_BY_POSITION[textPosition as keyof typeof ANNOTATION_AREA_TEXT_STYLE_BY_POSITION]\n .textBaseline\n\n return {\n zIndex: ANNOTATION_Z_INDEX,\n regionRelative: true,\n positions: (data: Datum[], context: ICartesianSeries) => {\n const positionData = data.filter((item) => selectedData.some((datum) => isSubset(datum, item)))\n const xyList = positionData.map((datum) => context.dataToPosition(datum) as { x: number; y: number })\n\n const yAxisHelper = context.getYAxisHelper() as unknown as {\n getBandwidth: (depth?: number) => number\n getScale: () => {\n range: () => number[]\n }\n }\n const xAxisHelper = context.getXAxisHelper() as unknown as {\n getBandwidth: (depth?: number) => number\n getScale: () => {\n range: () => number[]\n }\n }\n\n if (typeof xAxisHelper?.getBandwidth === 'function') {\n const regionRect = context.getRegion().getLayoutRect()\n\n const minX = Math.min(...xyList.map((item) => item.x)) - (outerPadding || 4)\n const maxX = Math.max(...xyList.map((item) => item.x)) + (outerPadding || 4)\n const minY = 0\n const maxY = regionRect.height\n return [\n // 左上\n {\n x: minX,\n y: minY,\n },\n // 右上\n {\n x: maxX,\n y: minY,\n },\n // 右下\n {\n x: maxX,\n y: maxY,\n },\n // 左下\n {\n x: minX,\n y: maxY,\n },\n ]\n }\n\n if (typeof yAxisHelper?.getBandwidth === 'function') {\n const regionRect = context.getRegion().getLayoutRect()\n\n const minY = Math.min(...xyList.map((item) => item.y)) - (outerPadding || 4)\n const maxY = Math.max(...xyList.map((item) => item.y)) + (outerPadding || 4)\n const minX = 0\n const maxX = regionRect.width\n\n return [\n // 左上\n {\n x: minX,\n y: minY,\n },\n // 右上\n {\n x: maxX,\n y: minY,\n },\n // 右下\n {\n x: maxX,\n y: maxY,\n },\n // 左下\n {\n x: minX,\n y: maxY,\n },\n ]\n }\n\n return []\n },\n label: {\n position: (positionMap as any)[textPosition],\n visible: true,\n text: text,\n style: {\n textAlign: textAlign,\n textBaseline: textBaseline,\n fill: textColor,\n stroke: textBackgroundColor,\n lineWidth: 1,\n fontSize: textFontSize,\n fontWeight: textFontWeight,\n },\n\n labelBackground: {\n visible: textBackgroundVisible,\n padding: textBackgroundPadding,\n style: {\n opacity: textBackgroundOpacity ?? 0.95,\n cornerRadius: textBackgroundBorderRadius ?? 4,\n fill: textBackgroundColor,\n stroke: textBackgroundBorderColor,\n lineWidth: textBackgroundBorderWidth,\n fillOpacity: 1,\n },\n },\n },\n area: {\n style: {\n visible: true,\n fill: areaColor,\n fillOpacity: areaColorOpacity,\n stroke: areaBorderColor,\n lineWidth: areaBorderWidth,\n cornerRadius: areaBorderRadius,\n lineDash: areaLineDash,\n },\n },\n }\n }) as ILineChartSpec['markArea']\n\n return {\n ...spec,\n markArea: markArea,\n }\n}\n"],"names":["annotationArea","spec","context","advancedVSeed","vseed","annotation","config","theme","annotationAreaList","Array","positionMap","defaultTextPosition","isBarLikeChart","markArea","selectorPoint","text","textColor","textFontSize","textFontWeight","textBackgroundVisible","textBackgroundColor","textBackgroundBorderColor","textBackgroundBorderWidth","textBackgroundBorderRadius","textBackgroundPadding","areaColor","areaColorOpacity","areaBorderColor","areaBorderRadius","areaBorderWidth","areaLineDash","outerPadding","textBackgroundOpacity","dataset","selectedData","datum","selector","textPosition","textAlign","ANNOTATION_AREA_TEXT_STYLE_BY_POSITION","textBaseline","ANNOTATION_Z_INDEX","data","positionData","item","isSubset","xyList","yAxisHelper","xAxisHelper","regionRect","minX","Math","maxX","minY","maxY"],"mappings":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;wBACL;qBACD;gBACH;gBAEA,IAAI,AAAqC,cAArC,OAAOP,aAAa,cAA6B;oBACnD,MAAME,aAAa/C,QAAQ,SAAS,GAAG,aAAa;oBAEpD,MAAMmD,OAAOF,KAAK,GAAG,IAAIL,OAAO,GAAG,CAAC,CAACF,OAASA,KAAK,CAAC,KAAMb,CAAAA,gBAAgB;oBAC1E,MAAMuB,OAAOH,KAAK,GAAG,IAAIL,OAAO,GAAG,CAAC,CAACF,OAASA,KAAK,CAAC,KAAMb,CAAAA,gBAAgB;oBAC1E,MAAMmB,OAAO;oBACb,MAAME,OAAOH,WAAW,KAAK;oBAE7B,OAAO;wBAEL;4BACE,GAAGC;4BACH,GAAGG;wBACL;wBAEA;4BACE,GAAGD;4BACH,GAAGC;wBACL;wBAEA;4BACE,GAAGD;4BACH,GAAGE;wBACL;wBAEA;4BACE,GAAGJ;4BACH,GAAGI;wBACL;qBACD;gBACH;gBAEA,OAAO,EAAE;YACX;YACA,OAAO;gBACL,UAAW5C,WAAmB,CAAC2B,aAAa;gBAC5C,SAAS;gBACT,MAAMtB;gBACN,OAAO;oBACL,WAAWuB;oBACX,cAAcE;oBACd,MAAMxB;oBACN,QAAQI;oBACR,WAAW;oBACX,UAAUH;oBACV,YAAYC;gBACd;gBAEA,iBAAiB;oBACf,SAASC;oBACT,SAASK;oBACT,OAAO;wBACL,SAASQ,yBAAyB;wBAClC,cAAcT,8BAA8B;wBAC5C,MAAMH;wBACN,QAAQC;wBACR,WAAWC;wBACX,aAAa;oBACf;gBACF;YACF;YACA,MAAM;gBACJ,OAAO;oBACL,SAAS;oBACT,MAAMG;oBACN,aAAaC;oBACb,QAAQC;oBACR,WAAWE;oBACX,cAAcD;oBACd,UAAUE;gBACZ;YACF;QACF;IACF;IAEA,OAAO;QACL,GAAG7B,IAAI;QACP,UAAUY;IACZ;AACF"}
|
|
@@ -24,6 +24,7 @@ const annotationAreaBand = (spec, context)=>{
|
|
|
24
24
|
const defaultTextPosition = isBarLikeChart(advancedVSeed) ? 'right' : 'top';
|
|
25
25
|
const markArea = annotationAreaList.flatMap((annotationArea)=>{
|
|
26
26
|
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;
|
|
27
|
+
const textBackgroundOpacity = theme?.textBackgroundOpacity;
|
|
27
28
|
const textPosition = annotationArea.textPosition ?? defaultTextPosition;
|
|
28
29
|
const textAlign = annotationArea.textAlign ?? ANNOTATION_AREA_TEXT_STYLE_BY_POSITION[textPosition].textAlign;
|
|
29
30
|
const textBaseline = annotationArea.textBaseline ?? ANNOTATION_AREA_TEXT_STYLE_BY_POSITION[textPosition].textBaseline;
|
|
@@ -107,7 +108,6 @@ const annotationAreaBand = (spec, context)=>{
|
|
|
107
108
|
visible: true,
|
|
108
109
|
text: text,
|
|
109
110
|
style: {
|
|
110
|
-
opacity: 0.95,
|
|
111
111
|
textAlign: textAlign,
|
|
112
112
|
textBaseline: textBaseline,
|
|
113
113
|
stroke: textBackgroundColor,
|
|
@@ -120,7 +120,7 @@ const annotationAreaBand = (spec, context)=>{
|
|
|
120
120
|
visible: textBackgroundVisible,
|
|
121
121
|
padding: textBackgroundPadding,
|
|
122
122
|
style: {
|
|
123
|
-
opacity: 0.95,
|
|
123
|
+
opacity: textBackgroundOpacity ?? 0.95,
|
|
124
124
|
cornerRadius: textBackgroundBorderRadius ?? 4,
|
|
125
125
|
fill: textBackgroundColor,
|
|
126
126
|
stroke: textBackgroundBorderColor,
|