@antv/g2plot 2.4.5 → 2.4.9
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/CHANGELOG.md +64 -0
- package/README.md +1 -1
- package/dist/g2plot.min.js +4 -4
- package/dist/g2plot.min.js.map +1 -1
- package/esm/core/plot.d.ts +2 -2
- package/esm/core/plot.js +4 -3
- package/esm/core/plot.js.map +1 -1
- package/esm/index.d.ts +2 -2
- package/esm/index.js +2 -2
- package/esm/index.js.map +1 -1
- package/esm/plots/area/constants.js +1 -0
- package/esm/plots/area/constants.js.map +1 -1
- package/esm/plots/area/types.d.ts +35 -10
- package/esm/plots/area/types.js.map +1 -1
- package/esm/plots/bar/constants.js +3 -0
- package/esm/plots/bar/constants.js.map +1 -1
- package/esm/plots/bar/types.d.ts +16 -3
- package/esm/plots/bar/types.js.map +1 -1
- package/esm/plots/bidirectional-bar/types.d.ts +21 -6
- package/esm/plots/bidirectional-bar/types.js.map +1 -1
- package/esm/plots/box/types.d.ts +20 -6
- package/esm/plots/box/types.js.map +1 -1
- package/esm/plots/bullet/types.d.ts +36 -9
- package/esm/plots/bullet/types.js.map +1 -1
- package/esm/plots/chord/types.d.ts +14 -10
- package/esm/plots/chord/types.js.map +1 -1
- package/esm/plots/circle-packing/types.d.ts +25 -8
- package/esm/plots/circle-packing/types.js.map +1 -1
- package/esm/plots/column/constants.js +3 -0
- package/esm/plots/column/constants.js.map +1 -1
- package/esm/plots/column/types.d.ts +57 -16
- package/esm/plots/column/types.js.map +1 -1
- package/esm/plots/dual-axes/types.d.ts +31 -6
- package/esm/plots/dual-axes/types.js.map +1 -1
- package/esm/plots/dual-axes/util/render-sider.js +1 -1
- package/esm/plots/dual-axes/util/render-sider.js.map +1 -1
- package/esm/plots/facet/types.d.ts +54 -34
- package/esm/plots/facet/types.js.map +1 -1
- package/esm/plots/funnel/types.d.ts +40 -11
- package/esm/plots/funnel/types.js.map +1 -1
- package/esm/plots/gauge/adaptor.js +1 -0
- package/esm/plots/gauge/adaptor.js.map +1 -1
- package/esm/plots/gauge/types.d.ts +83 -21
- package/esm/plots/gauge/types.js.map +1 -1
- package/esm/plots/heatmap/types.d.ts +47 -12
- package/esm/plots/heatmap/types.js.map +1 -1
- package/esm/plots/histogram/types.d.ts +17 -6
- package/esm/plots/histogram/types.js.map +1 -1
- package/esm/plots/line/adaptor.js +2 -2
- package/esm/plots/line/adaptor.js.map +1 -1
- package/esm/plots/line/constants.js +1 -0
- package/esm/plots/line/constants.js.map +1 -1
- package/esm/plots/line/types.d.ts +42 -12
- package/esm/plots/line/types.js.map +1 -1
- package/esm/plots/liquid/adaptor.js +2 -1
- package/esm/plots/liquid/adaptor.js.map +1 -1
- package/esm/plots/liquid/index.d.ts +1 -0
- package/esm/plots/liquid/index.js +1 -0
- package/esm/plots/liquid/index.js.map +1 -1
- package/esm/plots/liquid/shapes/liquid.d.ts +16 -1
- package/esm/plots/liquid/shapes/liquid.js +17 -10
- package/esm/plots/liquid/shapes/liquid.js.map +1 -1
- package/esm/plots/liquid/types.d.ts +57 -16
- package/esm/plots/liquid/types.js.map +1 -1
- package/esm/plots/mix/types.d.ts +31 -22
- package/esm/plots/mix/types.js.map +1 -1
- package/esm/plots/pie/adaptor.js +2 -0
- package/esm/plots/pie/adaptor.js.map +1 -1
- package/esm/plots/pie/contants.js +1 -0
- package/esm/plots/pie/contants.js.map +1 -1
- package/esm/plots/pie/types.d.ts +27 -10
- package/esm/plots/pie/types.js.map +1 -1
- package/esm/plots/progress/adaptor.js +1 -0
- package/esm/plots/progress/adaptor.js.map +1 -1
- package/esm/plots/progress/types.d.ts +13 -4
- package/esm/plots/progress/types.js.map +1 -1
- package/esm/plots/radar/types.d.ts +39 -12
- package/esm/plots/radar/types.js.map +1 -1
- package/esm/plots/radial-bar/types.d.ts +39 -12
- package/esm/plots/radial-bar/types.js.map +1 -1
- package/esm/plots/ring-progress/types.d.ts +18 -6
- package/esm/plots/ring-progress/types.js.map +1 -1
- package/esm/plots/rose/constant.js +1 -0
- package/esm/plots/rose/constant.js.map +1 -1
- package/esm/plots/rose/types.d.ts +32 -12
- package/esm/plots/rose/types.js.map +1 -1
- package/esm/plots/sankey/adaptor.js +31 -2
- package/esm/plots/sankey/adaptor.js.map +1 -1
- package/esm/plots/sankey/types.d.ts +57 -30
- package/esm/plots/sankey/types.js.map +1 -1
- package/esm/plots/scatter/adaptor.d.ts +1 -1
- package/esm/plots/scatter/adaptor.js +2 -2
- package/esm/plots/scatter/adaptor.js.map +1 -1
- package/esm/plots/scatter/types.d.ts +76 -22
- package/esm/plots/scatter/types.js.map +1 -1
- package/esm/plots/stock/types.d.ts +20 -7
- package/esm/plots/stock/types.js.map +1 -1
- package/esm/plots/sunburst/types.d.ts +40 -12
- package/esm/plots/sunburst/types.js.map +1 -1
- package/esm/plots/tiny-area/types.d.ts +16 -5
- package/esm/plots/tiny-area/types.js.map +1 -1
- package/esm/plots/tiny-column/types.d.ts +10 -3
- package/esm/plots/tiny-column/types.js.map +1 -1
- package/esm/plots/tiny-line/types.d.ts +17 -5
- package/esm/plots/tiny-line/types.js.map +1 -1
- package/esm/plots/treemap/types.d.ts +17 -6
- package/esm/plots/treemap/types.js.map +1 -1
- package/esm/plots/venn/types.d.ts +20 -6
- package/esm/plots/venn/types.js.map +1 -1
- package/esm/plots/violin/types.d.ts +52 -17
- package/esm/plots/violin/types.js.map +1 -1
- package/esm/plots/waterfall/types.d.ts +42 -10
- package/esm/plots/waterfall/types.js.map +1 -1
- package/esm/plots/word-cloud/types.d.ts +91 -44
- package/esm/plots/word-cloud/types.js.map +1 -1
- package/esm/types/button.d.ts +8 -4
- package/esm/types/button.js.map +1 -1
- package/esm/types/common.d.ts +145 -33
- package/esm/types/common.js.map +1 -1
- package/esm/types/drill-down.d.ts +28 -7
- package/esm/types/drill-down.js.map +1 -1
- package/esm/types/interaction.d.ts +26 -6
- package/esm/types/interaction.js.map +1 -1
- package/esm/types/label.d.ts +11 -3
- package/esm/types/label.js.map +1 -1
- package/esm/types/meta.d.ts +4 -7
- package/esm/types/meta.js.map +1 -1
- package/esm/types/pattern.d.ts +58 -18
- package/esm/types/pattern.js.map +1 -1
- package/esm/types/state.d.ts +11 -3
- package/esm/types/state.js.map +1 -1
- package/esm/types/statistic.d.ts +38 -6
- package/esm/types/statistic.js.map +1 -1
- package/esm/types/tooltip.d.ts +7 -2
- package/esm/types/tooltip.js.map +1 -1
- package/esm/utils/transform/percent.js +2 -2
- package/esm/utils/transform/percent.js.map +1 -1
- package/lib/core/plot.d.ts +2 -2
- package/lib/core/plot.js +4 -3
- package/lib/core/plot.js.map +1 -1
- package/lib/index.d.ts +2 -2
- package/lib/index.js +2 -1
- package/lib/index.js.map +1 -1
- package/lib/plots/area/constants.js +1 -0
- package/lib/plots/area/constants.js.map +1 -1
- package/lib/plots/area/types.d.ts +35 -10
- package/lib/plots/area/types.js.map +1 -1
- package/lib/plots/bar/constants.js +3 -0
- package/lib/plots/bar/constants.js.map +1 -1
- package/lib/plots/bar/types.d.ts +16 -3
- package/lib/plots/bar/types.js.map +1 -1
- package/lib/plots/bidirectional-bar/types.d.ts +21 -6
- package/lib/plots/bidirectional-bar/types.js.map +1 -1
- package/lib/plots/box/types.d.ts +20 -6
- package/lib/plots/box/types.js.map +1 -1
- package/lib/plots/bullet/types.d.ts +36 -9
- package/lib/plots/bullet/types.js.map +1 -1
- package/lib/plots/chord/types.d.ts +14 -10
- package/lib/plots/chord/types.js.map +1 -1
- package/lib/plots/circle-packing/types.d.ts +25 -8
- package/lib/plots/circle-packing/types.js.map +1 -1
- package/lib/plots/column/constants.js +3 -0
- package/lib/plots/column/constants.js.map +1 -1
- package/lib/plots/column/types.d.ts +57 -16
- package/lib/plots/column/types.js.map +1 -1
- package/lib/plots/dual-axes/types.d.ts +31 -6
- package/lib/plots/dual-axes/types.js.map +1 -1
- package/lib/plots/dual-axes/util/render-sider.js +1 -1
- package/lib/plots/dual-axes/util/render-sider.js.map +1 -1
- package/lib/plots/facet/types.d.ts +54 -34
- package/lib/plots/facet/types.js.map +1 -1
- package/lib/plots/funnel/types.d.ts +40 -11
- package/lib/plots/funnel/types.js.map +1 -1
- package/lib/plots/gauge/adaptor.js +1 -0
- package/lib/plots/gauge/adaptor.js.map +1 -1
- package/lib/plots/gauge/types.d.ts +83 -21
- package/lib/plots/gauge/types.js.map +1 -1
- package/lib/plots/heatmap/types.d.ts +47 -12
- package/lib/plots/heatmap/types.js.map +1 -1
- package/lib/plots/histogram/types.d.ts +17 -6
- package/lib/plots/histogram/types.js.map +1 -1
- package/lib/plots/line/adaptor.js +1 -1
- package/lib/plots/line/adaptor.js.map +1 -1
- package/lib/plots/line/constants.js +1 -0
- package/lib/plots/line/constants.js.map +1 -1
- package/lib/plots/line/types.d.ts +42 -12
- package/lib/plots/line/types.js.map +1 -1
- package/lib/plots/liquid/adaptor.js +2 -1
- package/lib/plots/liquid/adaptor.js.map +1 -1
- package/lib/plots/liquid/index.d.ts +1 -0
- package/lib/plots/liquid/index.js +2 -0
- package/lib/plots/liquid/index.js.map +1 -1
- package/lib/plots/liquid/shapes/liquid.d.ts +16 -1
- package/lib/plots/liquid/shapes/liquid.js +19 -10
- package/lib/plots/liquid/shapes/liquid.js.map +1 -1
- package/lib/plots/liquid/types.d.ts +57 -16
- package/lib/plots/liquid/types.js.map +1 -1
- package/lib/plots/mix/types.d.ts +31 -22
- package/lib/plots/mix/types.js.map +1 -1
- package/lib/plots/pie/adaptor.js +2 -0
- package/lib/plots/pie/adaptor.js.map +1 -1
- package/lib/plots/pie/contants.js +1 -0
- package/lib/plots/pie/contants.js.map +1 -1
- package/lib/plots/pie/types.d.ts +27 -10
- package/lib/plots/pie/types.js.map +1 -1
- package/lib/plots/progress/adaptor.js +1 -0
- package/lib/plots/progress/adaptor.js.map +1 -1
- package/lib/plots/progress/types.d.ts +13 -4
- package/lib/plots/progress/types.js.map +1 -1
- package/lib/plots/radar/types.d.ts +39 -12
- package/lib/plots/radar/types.js.map +1 -1
- package/lib/plots/radial-bar/types.d.ts +39 -12
- package/lib/plots/radial-bar/types.js.map +1 -1
- package/lib/plots/ring-progress/types.d.ts +18 -6
- package/lib/plots/ring-progress/types.js.map +1 -1
- package/lib/plots/rose/constant.js +1 -0
- package/lib/plots/rose/constant.js.map +1 -1
- package/lib/plots/rose/types.d.ts +32 -12
- package/lib/plots/rose/types.js.map +1 -1
- package/lib/plots/sankey/adaptor.js +30 -1
- package/lib/plots/sankey/adaptor.js.map +1 -1
- package/lib/plots/sankey/types.d.ts +57 -30
- package/lib/plots/sankey/types.js.map +1 -1
- package/lib/plots/scatter/adaptor.d.ts +1 -1
- package/lib/plots/scatter/adaptor.js +1 -1
- package/lib/plots/scatter/adaptor.js.map +1 -1
- package/lib/plots/scatter/types.d.ts +76 -22
- package/lib/plots/scatter/types.js.map +1 -1
- package/lib/plots/stock/types.d.ts +20 -7
- package/lib/plots/stock/types.js.map +1 -1
- package/lib/plots/sunburst/types.d.ts +40 -12
- package/lib/plots/sunburst/types.js.map +1 -1
- package/lib/plots/tiny-area/types.d.ts +16 -5
- package/lib/plots/tiny-area/types.js.map +1 -1
- package/lib/plots/tiny-column/types.d.ts +10 -3
- package/lib/plots/tiny-column/types.js.map +1 -1
- package/lib/plots/tiny-line/types.d.ts +17 -5
- package/lib/plots/tiny-line/types.js.map +1 -1
- package/lib/plots/treemap/types.d.ts +17 -6
- package/lib/plots/treemap/types.js.map +1 -1
- package/lib/plots/venn/types.d.ts +20 -6
- package/lib/plots/venn/types.js.map +1 -1
- package/lib/plots/violin/types.d.ts +52 -17
- package/lib/plots/violin/types.js.map +1 -1
- package/lib/plots/waterfall/types.d.ts +42 -10
- package/lib/plots/waterfall/types.js.map +1 -1
- package/lib/plots/word-cloud/types.d.ts +91 -44
- package/lib/plots/word-cloud/types.js.map +1 -1
- package/lib/types/button.d.ts +8 -4
- package/lib/types/button.js.map +1 -1
- package/lib/types/common.d.ts +145 -33
- package/lib/types/common.js.map +1 -1
- package/lib/types/drill-down.d.ts +28 -7
- package/lib/types/drill-down.js.map +1 -1
- package/lib/types/interaction.d.ts +26 -6
- package/lib/types/interaction.js.map +1 -1
- package/lib/types/label.d.ts +11 -3
- package/lib/types/label.js.map +1 -1
- package/lib/types/meta.d.ts +4 -7
- package/lib/types/meta.js.map +1 -1
- package/lib/types/pattern.d.ts +58 -18
- package/lib/types/pattern.js.map +1 -1
- package/lib/types/state.d.ts +11 -3
- package/lib/types/state.js.map +1 -1
- package/lib/types/statistic.d.ts +38 -6
- package/lib/types/statistic.js.map +1 -1
- package/lib/types/tooltip.d.ts +7 -2
- package/lib/types/tooltip.js.map +1 -1
- package/lib/utils/transform/percent.js +2 -2
- package/lib/utils/transform/percent.js.map +1 -1
- package/package.json +2 -2
- package/src/core/plot.ts +5 -4
- package/src/index.ts +2 -2
- package/src/plots/area/constants.ts +1 -0
- package/src/plots/area/types.ts +35 -10
- package/src/plots/bar/constants.ts +3 -0
- package/src/plots/bar/types.ts +16 -3
- package/src/plots/bidirectional-bar/types.ts +21 -6
- package/src/plots/box/types.ts +20 -6
- package/src/plots/bullet/types.ts +36 -17
- package/src/plots/chord/types.ts +14 -11
- package/src/plots/circle-packing/types.ts +25 -14
- package/src/plots/column/constants.ts +3 -0
- package/src/plots/column/types.ts +57 -20
- package/src/plots/dual-axes/types.ts +31 -16
- package/src/plots/dual-axes/util/render-sider.ts +1 -1
- package/src/plots/facet/types.ts +54 -49
- package/src/plots/funnel/types.ts +40 -13
- package/src/plots/gauge/adaptor.ts +1 -0
- package/src/plots/gauge/types.ts +86 -27
- package/src/plots/heatmap/types.ts +49 -14
- package/src/plots/histogram/types.ts +17 -9
- package/src/plots/line/adaptor.ts +12 -1
- package/src/plots/line/constants.ts +1 -0
- package/src/plots/line/types.ts +42 -14
- package/src/plots/liquid/adaptor.ts +2 -1
- package/src/plots/liquid/index.ts +2 -0
- package/src/plots/liquid/shapes/liquid.ts +22 -11
- package/src/plots/liquid/types.ts +57 -16
- package/src/plots/mix/types.ts +31 -35
- package/src/plots/pie/adaptor.ts +2 -0
- package/src/plots/pie/contants.ts +1 -0
- package/src/plots/pie/types.ts +27 -10
- package/src/plots/progress/adaptor.ts +1 -0
- package/src/plots/progress/types.ts +13 -4
- package/src/plots/radar/types.ts +39 -12
- package/src/plots/radial-bar/types.ts +39 -12
- package/src/plots/ring-progress/types.ts +18 -6
- package/src/plots/rose/constant.ts +1 -0
- package/src/plots/rose/types.ts +32 -12
- package/src/plots/sankey/adaptor.ts +35 -2
- package/src/plots/sankey/types.ts +58 -30
- package/src/plots/scatter/adaptor.ts +3 -1
- package/src/plots/scatter/types.ts +77 -24
- package/src/plots/stock/types.ts +21 -8
- package/src/plots/sunburst/types.ts +42 -12
- package/src/plots/tiny-area/types.ts +16 -5
- package/src/plots/tiny-column/types.ts +10 -3
- package/src/plots/tiny-line/types.ts +17 -5
- package/src/plots/treemap/types.ts +17 -7
- package/src/plots/venn/types.ts +21 -6
- package/src/plots/violin/types.ts +52 -17
- package/src/plots/waterfall/types.ts +42 -10
- package/src/plots/word-cloud/types.ts +91 -44
- package/src/types/button.ts +8 -4
- package/src/types/common.ts +145 -37
- package/src/types/drill-down.ts +28 -7
- package/src/types/interaction.ts +26 -6
- package/src/types/label.ts +11 -3
- package/src/types/meta.ts +4 -7
- package/src/types/pattern.ts +58 -18
- package/src/types/state.ts +11 -3
- package/src/types/statistic.ts +38 -6
- package/src/types/tooltip.ts +7 -2
- package/src/utils/transform/percent.ts +2 -2
|
@@ -2,32 +2,67 @@ import { Types } from '@antv/g2';
|
|
|
2
2
|
import { Options, StyleAttr } from '../../types';
|
|
3
3
|
|
|
4
4
|
export interface HeatmapOptions extends Options {
|
|
5
|
-
/**
|
|
5
|
+
/**
|
|
6
|
+
* @title 热力图类型
|
|
7
|
+
* @description 'polygon' | 'density'
|
|
8
|
+
*/
|
|
6
9
|
readonly type?: 'polygon' | 'density';
|
|
7
|
-
/**
|
|
10
|
+
/**
|
|
11
|
+
* @title x轴字段
|
|
12
|
+
*/
|
|
8
13
|
readonly xField: string;
|
|
9
|
-
/**
|
|
14
|
+
/**
|
|
15
|
+
* @title y轴字段
|
|
16
|
+
*/
|
|
10
17
|
readonly yField: string;
|
|
11
|
-
/**
|
|
18
|
+
/**
|
|
19
|
+
* @title 颜色字段
|
|
20
|
+
*/
|
|
12
21
|
readonly colorField?: string;
|
|
13
|
-
/**
|
|
22
|
+
/**
|
|
23
|
+
* @title 热力格子中的形状
|
|
24
|
+
*/
|
|
14
25
|
readonly shape?: string;
|
|
15
|
-
/**
|
|
26
|
+
/**
|
|
27
|
+
* @title 热力格子中图形的尺寸比例
|
|
28
|
+
* @description 只有当 shape 和 sizeField 至少指定一项后才生效
|
|
29
|
+
*/
|
|
16
30
|
readonly sizeRatio?: number;
|
|
17
|
-
/**
|
|
31
|
+
/**
|
|
32
|
+
* @title 坐标轴映射
|
|
33
|
+
* @description 坐标轴映射 'x' | 'y'
|
|
34
|
+
*/
|
|
18
35
|
readonly reflect?: 'x' | 'y';
|
|
19
|
-
/**
|
|
36
|
+
/**
|
|
37
|
+
* @title 极坐标属性
|
|
38
|
+
*/
|
|
20
39
|
readonly coordinate?: Types.CoordinateOption;
|
|
21
40
|
|
|
22
|
-
|
|
23
|
-
|
|
41
|
+
/**
|
|
42
|
+
* @title 图例相关
|
|
43
|
+
*/
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* @title 数据字段名
|
|
47
|
+
* @description 点大小映射对应的数据字段名
|
|
48
|
+
*/
|
|
24
49
|
readonly sizeField?: string;
|
|
25
|
-
/**
|
|
50
|
+
/**
|
|
51
|
+
* @title size 对应的图例
|
|
52
|
+
*/
|
|
26
53
|
readonly sizeLegend?: Options['legend'];
|
|
27
54
|
|
|
28
|
-
|
|
29
|
-
|
|
55
|
+
/**
|
|
56
|
+
* @title 样式相关
|
|
57
|
+
*/
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* @title 热力图形样式
|
|
61
|
+
*/
|
|
30
62
|
readonly heatmapStyle?: StyleAttr;
|
|
31
|
-
/**
|
|
63
|
+
/**
|
|
64
|
+
* @title 贴图图案
|
|
65
|
+
* @description 在 type="density" 时不支持
|
|
66
|
+
*/
|
|
32
67
|
readonly pattern?: Options['pattern'];
|
|
33
68
|
}
|
|
@@ -1,21 +1,29 @@
|
|
|
1
1
|
import { Options, StyleAttr } from '../../types';
|
|
2
2
|
|
|
3
3
|
export interface HistogramOptions extends Options {
|
|
4
|
-
/**
|
|
4
|
+
/**
|
|
5
|
+
* @title 直方图绘制字段
|
|
6
|
+
* @description 设置直方图绘制 (进行分箱) 的字段
|
|
7
|
+
*/
|
|
5
8
|
readonly binField: string;
|
|
6
9
|
|
|
7
10
|
/**
|
|
8
|
-
*
|
|
9
|
-
*
|
|
11
|
+
* @title 设置直方图的分箱宽度
|
|
12
|
+
* @description binWidth 影响直方图分成多少箱,不能与binNumber一起使用
|
|
10
13
|
*/
|
|
11
14
|
readonly binWidth?: number;
|
|
12
|
-
|
|
13
|
-
|
|
15
|
+
/**
|
|
16
|
+
* @title 设置直方图的分箱数量
|
|
17
|
+
* @description binNumber 影响直方图分箱后每个柱子的宽度
|
|
18
|
+
*/
|
|
14
19
|
readonly binNumber?: number;
|
|
15
|
-
|
|
16
|
-
|
|
20
|
+
/**
|
|
21
|
+
* @title 指定层叠字段
|
|
22
|
+
* @description 通过该字段的值,柱子将会被分割为多个部分,通过颜色进行区分
|
|
23
|
+
*/
|
|
17
24
|
readonly stackField?: string;
|
|
18
|
-
|
|
19
|
-
|
|
25
|
+
/**
|
|
26
|
+
* @title 柱子样式配置
|
|
27
|
+
*/
|
|
20
28
|
readonly columnStyle?: StyleAttr;
|
|
21
29
|
}
|
|
@@ -1,7 +1,17 @@
|
|
|
1
1
|
import { Geometry } from '@antv/g2';
|
|
2
2
|
import { each, isArray } from '@antv/util';
|
|
3
3
|
import { Params } from '../../core/adaptor';
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
tooltip,
|
|
6
|
+
slider,
|
|
7
|
+
interaction,
|
|
8
|
+
animation,
|
|
9
|
+
theme,
|
|
10
|
+
scale,
|
|
11
|
+
annotation,
|
|
12
|
+
limitInPlot,
|
|
13
|
+
scrollbar,
|
|
14
|
+
} from '../../adaptor/common';
|
|
5
15
|
import { findGeometry, transformLabel, deepAssign } from '../../utils';
|
|
6
16
|
import { point, line, area } from '../../adaptor/geometries';
|
|
7
17
|
import { flow } from '../../utils';
|
|
@@ -208,6 +218,7 @@ export function adaptor(params: Params<LineOptions>) {
|
|
|
208
218
|
tooltip,
|
|
209
219
|
label,
|
|
210
220
|
slider,
|
|
221
|
+
scrollbar,
|
|
211
222
|
interaction,
|
|
212
223
|
animation,
|
|
213
224
|
annotation(),
|
package/src/plots/line/types.ts
CHANGED
|
@@ -7,30 +7,58 @@ import {
|
|
|
7
7
|
import { Options, StyleAttr } from '../../types';
|
|
8
8
|
|
|
9
9
|
export interface LineOptions extends Options, Pick<GeometryOptions, 'customInfo'> {
|
|
10
|
-
/**
|
|
10
|
+
/**
|
|
11
|
+
* @title 阶梯折线图类型
|
|
12
|
+
*/
|
|
11
13
|
readonly stepType?: string;
|
|
12
|
-
/**
|
|
14
|
+
/**
|
|
15
|
+
* @title x轴字段
|
|
16
|
+
*/
|
|
13
17
|
readonly xField?: string;
|
|
14
|
-
/**
|
|
18
|
+
/**
|
|
19
|
+
* @title y轴字段
|
|
20
|
+
*/
|
|
15
21
|
readonly yField?: string;
|
|
16
|
-
/**
|
|
22
|
+
/**
|
|
23
|
+
* @title 分组字段
|
|
24
|
+
*/
|
|
17
25
|
readonly seriesField?: string;
|
|
18
|
-
/**
|
|
26
|
+
/**
|
|
27
|
+
* @title 是否堆积
|
|
28
|
+
* @default false
|
|
29
|
+
*/
|
|
19
30
|
readonly isStack?: boolean;
|
|
20
|
-
/**
|
|
31
|
+
/**
|
|
32
|
+
* @title 是否平滑
|
|
33
|
+
* @default false
|
|
34
|
+
*/
|
|
21
35
|
readonly smooth?: boolean;
|
|
22
|
-
/**
|
|
36
|
+
/**
|
|
37
|
+
* @title 是否连接空数据
|
|
38
|
+
* @default false
|
|
39
|
+
*/
|
|
23
40
|
readonly connectNulls?: boolean;
|
|
24
|
-
/**
|
|
41
|
+
/**
|
|
42
|
+
* @title 折线图形样式
|
|
43
|
+
*/
|
|
25
44
|
readonly lineStyle?: StyleAttr;
|
|
26
|
-
/**
|
|
45
|
+
/**
|
|
46
|
+
* @title 折线 shape 配置
|
|
47
|
+
*/
|
|
27
48
|
readonly lineShape?: Required<LineGeometryOptions>['line']['shape'];
|
|
28
|
-
/**
|
|
49
|
+
/**
|
|
50
|
+
* @title 折线数据点
|
|
51
|
+
* @description 1、图形映射属性 2、状态样式
|
|
52
|
+
*/
|
|
29
53
|
readonly point?: PointGeometryOptions['point'] & Pick<PointGeometryOptions, 'state'>;
|
|
30
|
-
/**
|
|
54
|
+
/**
|
|
55
|
+
* @title 折线趋势填充色
|
|
56
|
+
* @description 1、图形映射属性
|
|
57
|
+
*/
|
|
31
58
|
readonly area?: AreaGeometryOptions['area'] & Pick<PointGeometryOptions, 'state'>;
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
59
|
+
/**
|
|
60
|
+
* @title 坐标轴反转配置
|
|
61
|
+
* @description 坐标轴反转配置 'x' | 'y' | ['x', 'y']
|
|
62
|
+
*/
|
|
35
63
|
readonly reflect?: 'x' | 'y' | ['x', 'y'];
|
|
36
64
|
}
|
|
@@ -13,7 +13,7 @@ import { getLiquidData } from './utils';
|
|
|
13
13
|
*/
|
|
14
14
|
function geometry(params: Params<LiquidOptions>): Params<LiquidOptions> {
|
|
15
15
|
const { chart, options } = params;
|
|
16
|
-
const { percent, liquidStyle, radius, outline, wave, shape } = options;
|
|
16
|
+
const { percent, liquidStyle, radius, outline, wave, shape, animation } = options;
|
|
17
17
|
|
|
18
18
|
chart.scale({
|
|
19
19
|
percent: {
|
|
@@ -49,6 +49,7 @@ function geometry(params: Params<LiquidOptions>): Params<LiquidOptions> {
|
|
|
49
49
|
wave,
|
|
50
50
|
shape,
|
|
51
51
|
background,
|
|
52
|
+
animation,
|
|
52
53
|
};
|
|
53
54
|
|
|
54
55
|
// 将 radius 传入到自定义 shape 中
|
|
@@ -203,7 +203,7 @@ function getWaterWavePath(
|
|
|
203
203
|
* @param radius 绘制图形的高度
|
|
204
204
|
* @param waveLength 波的长度
|
|
205
205
|
*/
|
|
206
|
-
function addWaterWave(
|
|
206
|
+
export function addWaterWave(
|
|
207
207
|
x: number,
|
|
208
208
|
y: number,
|
|
209
209
|
level: number,
|
|
@@ -212,18 +212,24 @@ function addWaterWave(
|
|
|
212
212
|
group: IGroup,
|
|
213
213
|
clip: IShape,
|
|
214
214
|
radius: number,
|
|
215
|
-
waveLength: number
|
|
215
|
+
waveLength: number,
|
|
216
|
+
animation: LiquidOptions['animation']
|
|
216
217
|
) {
|
|
218
|
+
// 盒子属性 颜色 宽高
|
|
217
219
|
const { fill, opacity } = waveAttrs;
|
|
218
220
|
const bbox = clip.getBBox();
|
|
219
221
|
const width = bbox.maxX - bbox.minX;
|
|
220
222
|
const height = bbox.maxY - bbox.minY;
|
|
221
223
|
|
|
224
|
+
// 循环 waveCount 个数
|
|
222
225
|
for (let idx = 0; idx < waveCount; idx++) {
|
|
223
226
|
const factor = waveCount <= 1 ? 0 : idx / (waveCount - 1);
|
|
227
|
+
|
|
228
|
+
// 画波
|
|
224
229
|
const wave = group.addShape('path', {
|
|
225
230
|
name: `waterwave-path`,
|
|
226
231
|
attrs: {
|
|
232
|
+
// 波形路径配置
|
|
227
233
|
path: getWaterWavePath(
|
|
228
234
|
radius,
|
|
229
235
|
bbox.minY + height * level,
|
|
@@ -239,6 +245,8 @@ function addWaterWave(
|
|
|
239
245
|
});
|
|
240
246
|
|
|
241
247
|
try {
|
|
248
|
+
// 默认 underfind 开启动画
|
|
249
|
+
if (animation === false) return;
|
|
242
250
|
const matrix = transform([['t', waveLength, 0]]);
|
|
243
251
|
|
|
244
252
|
wave.stopAnimate();
|
|
@@ -367,13 +375,21 @@ function rect(x: number, y: number, width: number, height: number) {
|
|
|
367
375
|
`;
|
|
368
376
|
}
|
|
369
377
|
|
|
378
|
+
const builtInShapeByName = {
|
|
379
|
+
pin,
|
|
380
|
+
circle,
|
|
381
|
+
diamond,
|
|
382
|
+
triangle,
|
|
383
|
+
rect,
|
|
384
|
+
};
|
|
385
|
+
|
|
370
386
|
registerShape('interval', 'liquid-fill-gauge', {
|
|
371
387
|
draw(cfg: any, container: IGroup) {
|
|
372
388
|
const cx = 0.5;
|
|
373
389
|
const cy = 0.5;
|
|
374
390
|
|
|
375
391
|
const { customInfo } = cfg;
|
|
376
|
-
const { radius: radio, shape, background } = customInfo as CustomInfo;
|
|
392
|
+
const { radius: radio, shape, background, animation } = customInfo as CustomInfo;
|
|
377
393
|
const outline: LiquidOptions['outline'] = customInfo.outline;
|
|
378
394
|
const wave: LiquidOptions['wave'] = customInfo.wave;
|
|
379
395
|
const { border, distance } = outline;
|
|
@@ -397,13 +413,7 @@ registerShape('interval', 'liquid-fill-gauge', {
|
|
|
397
413
|
const waveAttrs = getFillAttrs(cfg);
|
|
398
414
|
const outlineAttrs = getLineAttrs(mix({}, cfg, outline));
|
|
399
415
|
const innerRadius = radius - border / 2;
|
|
400
|
-
|
|
401
|
-
pin,
|
|
402
|
-
circle,
|
|
403
|
-
diamond,
|
|
404
|
-
triangle,
|
|
405
|
-
rect,
|
|
406
|
-
};
|
|
416
|
+
|
|
407
417
|
const buildPath = typeof shape === 'function' ? shape : builtInShapeByName[shape] || builtInShapeByName['circle'];
|
|
408
418
|
const shapePath = buildPath(center.x, center.y, innerRadius * 2, innerRadius * 2);
|
|
409
419
|
|
|
@@ -430,7 +440,8 @@ registerShape('interval', 'liquid-fill-gauge', {
|
|
|
430
440
|
waves,
|
|
431
441
|
clipPath,
|
|
432
442
|
radius * 2,
|
|
433
|
-
waveLength
|
|
443
|
+
waveLength,
|
|
444
|
+
animation
|
|
434
445
|
);
|
|
435
446
|
|
|
436
447
|
// 2. 绘制一个 distance 宽的 border
|
|
@@ -1,52 +1,93 @@
|
|
|
1
1
|
import { PathCommand } from '@antv/g-base';
|
|
2
2
|
import { Options, StyleAttr, ColorAttr, Statistic, ShapeStyle } from '../../types';
|
|
3
3
|
|
|
4
|
-
/**
|
|
4
|
+
/**
|
|
5
|
+
* @title 轮廓
|
|
6
|
+
*/
|
|
5
7
|
type Outline = Partial<{
|
|
6
|
-
/**
|
|
8
|
+
/**
|
|
9
|
+
* @title 外环的宽度
|
|
10
|
+
* @default "2px"
|
|
11
|
+
*/
|
|
7
12
|
readonly border: number;
|
|
8
|
-
/**
|
|
13
|
+
/**
|
|
14
|
+
* @title 内外的边距
|
|
15
|
+
* @default "0px"
|
|
16
|
+
*/
|
|
9
17
|
readonly distance: number;
|
|
10
|
-
/**
|
|
18
|
+
/**
|
|
19
|
+
* @title 外环的样式
|
|
20
|
+
*/
|
|
11
21
|
readonly style?: Pick<ShapeStyle, 'stroke' | 'strokeOpacity'>;
|
|
12
22
|
// /** 外边框的形状,可以有 circle,rect,默认为 circle */
|
|
13
23
|
// readonly containerShape?: 'circle' | 'rect';
|
|
14
24
|
}>;
|
|
15
25
|
|
|
16
26
|
type Wave = Partial<{
|
|
17
|
-
/**
|
|
27
|
+
/**
|
|
28
|
+
* @title 波形的数量
|
|
29
|
+
* @default 3
|
|
30
|
+
*/
|
|
18
31
|
readonly count: number;
|
|
19
|
-
/**
|
|
32
|
+
/**
|
|
33
|
+
* @title 波形的长度
|
|
34
|
+
* @default 192
|
|
35
|
+
*/
|
|
20
36
|
readonly length: number;
|
|
21
37
|
}>;
|
|
22
38
|
|
|
23
39
|
type ShapeCallback = (x: number, y: number, width: number, height: number) => PathCommand[];
|
|
24
40
|
|
|
25
|
-
/**
|
|
41
|
+
/**
|
|
42
|
+
* @title 配置类型定义
|
|
43
|
+
*/
|
|
26
44
|
export interface LiquidOptions extends Omit<Options, 'data'> {
|
|
27
|
-
/**
|
|
45
|
+
/**
|
|
46
|
+
* @title 指标比例
|
|
47
|
+
*/
|
|
28
48
|
readonly percent: number;
|
|
29
|
-
/**
|
|
49
|
+
/**
|
|
50
|
+
* @title 配置水波图的颜色
|
|
51
|
+
* @description 使用默认色板的颜色
|
|
52
|
+
*/
|
|
30
53
|
readonly color?: ColorAttr;
|
|
31
|
-
/**
|
|
54
|
+
/**
|
|
55
|
+
* @title 水波的外半径
|
|
56
|
+
* @description 范围0-1
|
|
57
|
+
* @default 0.9
|
|
58
|
+
*/
|
|
32
59
|
readonly radius?: number;
|
|
33
|
-
/**
|
|
60
|
+
/**
|
|
61
|
+
* @title 水波图的样式
|
|
62
|
+
*/
|
|
34
63
|
readonly liquidStyle?: StyleAttr;
|
|
35
|
-
/**
|
|
64
|
+
/**
|
|
65
|
+
* @title 指标文本组件
|
|
66
|
+
*/
|
|
36
67
|
readonly statistic?: Statistic;
|
|
37
|
-
/**
|
|
68
|
+
/**
|
|
69
|
+
* @title 外环轮廓
|
|
70
|
+
*/
|
|
38
71
|
readonly outline?: Outline;
|
|
39
|
-
/**
|
|
72
|
+
/**
|
|
73
|
+
* @title 波的配置
|
|
74
|
+
*/
|
|
40
75
|
readonly wave?: Wave;
|
|
41
|
-
/**
|
|
76
|
+
/**
|
|
77
|
+
* @title 波的形状配置
|
|
78
|
+
* @description ('circle' | 'rect' | 'triangle' | 'diamond')
|
|
79
|
+
*/
|
|
42
80
|
readonly shape?: string | ShapeCallback;
|
|
43
81
|
}
|
|
44
82
|
|
|
45
|
-
/**
|
|
83
|
+
/**
|
|
84
|
+
* @title 水波图自定义 的 customInfo
|
|
85
|
+
*/
|
|
46
86
|
export type CustomInfo = {
|
|
47
87
|
radius?: LiquidOptions['radius'];
|
|
48
88
|
outline?: LiquidOptions['outline'];
|
|
49
89
|
wave?: LiquidOptions['wave'];
|
|
50
90
|
shape?: LiquidOptions['shape'];
|
|
51
91
|
background?: string;
|
|
92
|
+
animation?: LiquidOptions['animation'];
|
|
52
93
|
};
|
package/src/plots/mix/types.ts
CHANGED
|
@@ -9,103 +9,99 @@ import { Interaction } from '../../types/interaction';
|
|
|
9
9
|
import { IPlotTypes } from './utils';
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
|
-
* geometry 映射信息
|
|
12
|
+
* @title geometry 映射信息
|
|
13
13
|
*/
|
|
14
14
|
export type IGeometry = Geometry & {
|
|
15
15
|
adjust?: Types.AdjustOption;
|
|
16
16
|
};
|
|
17
|
-
|
|
18
17
|
/**
|
|
19
|
-
* 子 view
|
|
18
|
+
* @title 子 view 的配置
|
|
19
|
+
* @description 暂时不开嵌套 view 的情况
|
|
20
20
|
*/
|
|
21
21
|
export type IView = {
|
|
22
22
|
/**
|
|
23
|
-
* view
|
|
23
|
+
* @title view 的布局范围
|
|
24
|
+
* @default "占满全部"
|
|
24
25
|
*/
|
|
25
26
|
readonly region?: Region;
|
|
26
|
-
|
|
27
27
|
/**
|
|
28
|
-
* view 中的数据
|
|
28
|
+
* @title view 中的数据
|
|
29
29
|
*/
|
|
30
30
|
readonly data: Data;
|
|
31
|
-
|
|
32
31
|
/**
|
|
33
|
-
* view 中对应的 meta 字段配置
|
|
32
|
+
* @title view 中对应的 meta 字段配置
|
|
34
33
|
*/
|
|
35
34
|
readonly meta?: Record<string, Meta>;
|
|
36
|
-
|
|
37
35
|
/**
|
|
38
|
-
*
|
|
36
|
+
* @title 坐标系的配置
|
|
37
|
+
* @description 每一个 view 具有相同的坐标系
|
|
39
38
|
*/
|
|
40
39
|
readonly coordinate?: Types.CoordinateOption;
|
|
41
|
-
|
|
42
40
|
/**
|
|
43
|
-
* 图形 geometry 及映射配置
|
|
41
|
+
* @title 图形 geometry 及映射配置
|
|
44
42
|
*/
|
|
45
43
|
readonly geometries: IGeometry[];
|
|
46
|
-
|
|
47
44
|
/**
|
|
48
|
-
* x,y
|
|
45
|
+
* @title x,y 轴
|
|
49
46
|
*/
|
|
50
47
|
readonly axes?: false | Record<string, Axis>;
|
|
51
|
-
|
|
52
48
|
/**
|
|
53
|
-
* interactions
|
|
49
|
+
* @title interactions
|
|
54
50
|
*/
|
|
55
51
|
readonly interactions?: Interaction[];
|
|
56
|
-
|
|
57
52
|
/**
|
|
58
|
-
* annotation
|
|
53
|
+
* @title annotation
|
|
59
54
|
*/
|
|
60
55
|
readonly annotations?: Annotation[];
|
|
61
|
-
|
|
62
56
|
/**
|
|
63
|
-
*
|
|
57
|
+
* @title annotation
|
|
64
58
|
*/
|
|
65
59
|
readonly animation?: Animation;
|
|
66
|
-
|
|
67
60
|
/**
|
|
68
|
-
* tooltip
|
|
61
|
+
* @title tooltip
|
|
69
62
|
*/
|
|
70
63
|
readonly tooltip?: Tooltip;
|
|
71
64
|
};
|
|
72
65
|
|
|
73
66
|
/**
|
|
74
|
-
* 子 plot 的配置
|
|
67
|
+
* @title 子 plot 的配置
|
|
75
68
|
*/
|
|
76
69
|
export type IPlot = IPlotTypes & {
|
|
77
70
|
/**
|
|
78
|
-
* plot view
|
|
71
|
+
* @title plot view 的布局范围
|
|
72
|
+
* @default "占满全部"
|
|
79
73
|
*/
|
|
80
74
|
readonly region?: Region;
|
|
81
75
|
};
|
|
82
76
|
|
|
83
|
-
/**
|
|
77
|
+
/**
|
|
78
|
+
* @title 类型定义
|
|
79
|
+
*/
|
|
84
80
|
export interface MixOptions
|
|
85
81
|
extends Omit<Options, 'data' | 'legend' | 'xAxis' | 'yAxis' | 'legend' | 'tooltip' | 'slider' | 'scrollbar'> {
|
|
86
82
|
/**
|
|
87
|
-
* 是否同步子 view 的配置
|
|
88
|
-
* 目前仅仅支持 true / false,后续需要增加 function 的方式进行自定义 view 之前的布局同步
|
|
83
|
+
* @title 是否同步子 view 的配置
|
|
84
|
+
* @description 目前仅仅支持 true / false,后续需要增加 function 的方式进行自定义 view 之前的布局同步
|
|
89
85
|
*/
|
|
90
86
|
readonly syncViewPadding?: boolean;
|
|
91
87
|
/**
|
|
92
|
-
*
|
|
93
|
-
*
|
|
88
|
+
* @title 每一个图层的配置
|
|
89
|
+
* @description 每个图层包括有自己的:数据、图形、图形映射
|
|
94
90
|
*/
|
|
95
91
|
readonly views?: IView[];
|
|
96
|
-
|
|
97
92
|
/**
|
|
98
|
-
*
|
|
93
|
+
* @title 限定与指定 plot 类型
|
|
94
|
+
* @description 支持使用已有的 plot,限定与指定 plot 类型
|
|
99
95
|
*/
|
|
100
96
|
readonly plots?: IPlot[];
|
|
101
|
-
|
|
102
97
|
/**
|
|
103
|
-
* tooltip
|
|
98
|
+
* @title tooltip 配置
|
|
99
|
+
* @description tooltip 配置在 chart 层配置
|
|
104
100
|
*/
|
|
105
101
|
readonly tooltip?: Tooltip;
|
|
106
|
-
|
|
107
102
|
/**
|
|
108
|
-
* legend
|
|
103
|
+
* @title legend 配置
|
|
104
|
+
* @description 统一顶层配置
|
|
109
105
|
*/
|
|
110
106
|
readonly legend?: false | Record<string, Legend>;
|
|
111
107
|
}
|
package/src/plots/pie/adaptor.ts
CHANGED
|
@@ -42,6 +42,7 @@ function geometry(params: Params<PieOptions>): Params<PieOptions> {
|
|
|
42
42
|
},
|
|
43
43
|
args: {
|
|
44
44
|
zIndexReversed: true,
|
|
45
|
+
sortZIndex: true,
|
|
45
46
|
},
|
|
46
47
|
},
|
|
47
48
|
});
|
|
@@ -62,6 +63,7 @@ function geometry(params: Params<PieOptions>): Params<PieOptions> {
|
|
|
62
63
|
},
|
|
63
64
|
args: {
|
|
64
65
|
zIndexReversed: true,
|
|
66
|
+
sortZIndex: true,
|
|
65
67
|
},
|
|
66
68
|
},
|
|
67
69
|
});
|
package/src/plots/pie/types.ts
CHANGED
|
@@ -7,26 +7,43 @@ export type StatisticData = {
|
|
|
7
7
|
};
|
|
8
8
|
|
|
9
9
|
export interface PieOptions extends Options {
|
|
10
|
-
/**
|
|
10
|
+
/**
|
|
11
|
+
* @title 角度映射字段
|
|
12
|
+
*/
|
|
11
13
|
readonly angleField: string;
|
|
12
|
-
/**
|
|
14
|
+
/**
|
|
15
|
+
* @title 颜色映射字段
|
|
16
|
+
*/
|
|
13
17
|
readonly colorField: string;
|
|
14
|
-
/**
|
|
18
|
+
/**
|
|
19
|
+
* @title 饼图半径
|
|
20
|
+
*/
|
|
15
21
|
readonly radius?: number;
|
|
16
|
-
/**
|
|
22
|
+
/**
|
|
23
|
+
* @title 饼图内半径
|
|
24
|
+
*/
|
|
17
25
|
readonly innerRadius?: number;
|
|
18
|
-
/**
|
|
26
|
+
/**
|
|
27
|
+
* @title 饼图标签
|
|
28
|
+
* @description type: 'inner' | 'outer' | 'spider'
|
|
29
|
+
*/
|
|
19
30
|
readonly label?: Label;
|
|
20
|
-
/**
|
|
31
|
+
/**
|
|
32
|
+
* @title 饼图图形样式
|
|
33
|
+
*/
|
|
21
34
|
readonly pieStyle?: StyleAttr;
|
|
22
35
|
// 设置扇形图
|
|
23
|
-
/**
|
|
36
|
+
/**
|
|
37
|
+
* @title 圆环的开始角度
|
|
38
|
+
*/
|
|
24
39
|
readonly startAngle?: number;
|
|
25
|
-
/**
|
|
40
|
+
/**
|
|
41
|
+
* @title 圆环的结束角度
|
|
42
|
+
*/
|
|
26
43
|
readonly endAngle?: number;
|
|
27
44
|
/**
|
|
28
|
-
*
|
|
29
|
-
*
|
|
45
|
+
* @title 指标卡组件
|
|
46
|
+
* @description 显示在环图中心,可以代替tooltip,显示环图数据的总计值和各项数据,启用 statistic 组件的同时将自动关闭tooltip
|
|
30
47
|
*/
|
|
31
48
|
readonly statistic?: Statistic;
|
|
32
49
|
}
|