@antv/g2plot 2.4.7 → 2.4.10
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 +52 -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/types.d.ts +35 -10
- package/esm/plots/area/types.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/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/geometries/compare.js +2 -1
- package/esm/plots/funnel/geometries/compare.js.map +1 -1
- package/esm/plots/funnel/geometries/facet.js +2 -1
- package/esm/plots/funnel/geometries/facet.js.map +1 -1
- package/esm/plots/funnel/types.d.ts +45 -11
- package/esm/plots/funnel/types.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/types.d.ts +42 -12
- package/esm/plots/line/types.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 +13 -8
- package/esm/plots/liquid/shapes/liquid.js.map +1 -1
- package/esm/plots/liquid/types.d.ts +56 -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/types.d.ts +27 -10
- package/esm/plots/pie/types.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/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/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/types.d.ts +35 -10
- package/lib/plots/area/types.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/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/geometries/compare.js +2 -1
- package/lib/plots/funnel/geometries/compare.js.map +1 -1
- package/lib/plots/funnel/geometries/facet.js +2 -1
- package/lib/plots/funnel/geometries/facet.js.map +1 -1
- package/lib/plots/funnel/types.d.ts +45 -11
- package/lib/plots/funnel/types.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/types.d.ts +42 -12
- package/lib/plots/line/types.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 +14 -7
- package/lib/plots/liquid/shapes/liquid.js.map +1 -1
- package/lib/plots/liquid/types.d.ts +56 -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/types.d.ts +27 -10
- package/lib/plots/pie/types.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/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/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 +1 -1
- package/src/core/plot.ts +5 -4
- package/src/index.ts +2 -2
- package/src/plots/area/types.ts +35 -10
- 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/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/geometries/compare.ts +2 -0
- package/src/plots/funnel/geometries/facet.ts +2 -1
- package/src/plots/funnel/types.ts +45 -14
- 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/types.ts +42 -14
- package/src/plots/liquid/index.ts +2 -0
- package/src/plots/liquid/shapes/liquid.ts +16 -8
- package/src/plots/liquid/types.ts +56 -16
- package/src/plots/mix/types.ts +31 -35
- package/src/plots/pie/types.ts +27 -10
- 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/types.ts +32 -12
- package/src/plots/sankey/adaptor.ts +35 -2
- package/src/plots/sankey/types.ts +58 -30
- 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
package/src/types/common.ts
CHANGED
|
@@ -34,9 +34,15 @@ export type Position = [number, number];
|
|
|
34
34
|
|
|
35
35
|
/** 一个区域描述 */
|
|
36
36
|
export type Region = {
|
|
37
|
-
/**
|
|
37
|
+
/**
|
|
38
|
+
* @title 开始位置
|
|
39
|
+
* @description the top-left corner of layer-range, range from 0 to 1, relative to parent layer's range
|
|
40
|
+
*/
|
|
38
41
|
readonly start: Point;
|
|
39
|
-
/**
|
|
42
|
+
/**
|
|
43
|
+
* @title 结束位置
|
|
44
|
+
* @description the bottom-right corner of layer-range, range from 0 to 1, relative to parent layer's range
|
|
45
|
+
*/
|
|
40
46
|
readonly end: Point;
|
|
41
47
|
};
|
|
42
48
|
|
|
@@ -50,17 +56,29 @@ export type BBox = {
|
|
|
50
56
|
|
|
51
57
|
/** 文字 */
|
|
52
58
|
export type TextStyle = {
|
|
53
|
-
/**
|
|
59
|
+
/**
|
|
60
|
+
* @title 文本大小
|
|
61
|
+
*/
|
|
54
62
|
readonly fontSize?: number;
|
|
55
|
-
/**
|
|
63
|
+
/**
|
|
64
|
+
* @title 字体系列
|
|
65
|
+
*/
|
|
56
66
|
readonly fontFamily?: string;
|
|
57
|
-
/**
|
|
67
|
+
/**
|
|
68
|
+
* @title 文本粗细
|
|
69
|
+
*/
|
|
58
70
|
readonly fontWeight?: number;
|
|
59
|
-
/**
|
|
71
|
+
/**
|
|
72
|
+
* @title 文本行高
|
|
73
|
+
*/
|
|
60
74
|
readonly lineHeight?: number;
|
|
61
|
-
/**
|
|
75
|
+
/**
|
|
76
|
+
* @title 文本对齐方式
|
|
77
|
+
*/
|
|
62
78
|
readonly textAlign?: 'center' | 'left' | 'right';
|
|
63
|
-
/**
|
|
79
|
+
/**
|
|
80
|
+
* @title 文本基线
|
|
81
|
+
*/
|
|
64
82
|
readonly textBaseline?: 'middle' | 'top' | 'bottom';
|
|
65
83
|
};
|
|
66
84
|
|
|
@@ -71,67 +89,157 @@ export type Size = {
|
|
|
71
89
|
|
|
72
90
|
/** 基础的 Options 配置 */
|
|
73
91
|
export type Options = {
|
|
74
|
-
|
|
75
|
-
|
|
92
|
+
/**
|
|
93
|
+
* @title 画布宽度
|
|
94
|
+
*/
|
|
76
95
|
readonly width?: number;
|
|
77
|
-
/**
|
|
96
|
+
/**
|
|
97
|
+
* @title 画布高度
|
|
98
|
+
*/
|
|
78
99
|
readonly height?: number;
|
|
79
|
-
/**
|
|
100
|
+
/**
|
|
101
|
+
* @title 自适应
|
|
102
|
+
* @description 画布是否自动适配容器大小,默认为 true
|
|
103
|
+
*/
|
|
80
104
|
readonly autoFit?: boolean;
|
|
81
|
-
/**
|
|
105
|
+
/**
|
|
106
|
+
* @title 内填充
|
|
107
|
+
* @description 画布的 padding 值,或者开启 'auto'
|
|
108
|
+
*/
|
|
82
109
|
readonly padding?: number[] | number | 'auto';
|
|
83
|
-
/**
|
|
110
|
+
/**
|
|
111
|
+
* @title 画布宽度
|
|
112
|
+
* @description 额外怎加的 padding 值
|
|
113
|
+
*/
|
|
84
114
|
readonly appendPadding?: number[] | number;
|
|
85
|
-
/**
|
|
115
|
+
/**
|
|
116
|
+
* @title 额外填充
|
|
117
|
+
* @description 是否同步子 view 的 padding
|
|
118
|
+
*/
|
|
86
119
|
readonly syncViewPadding?: boolean | Types.SyncViewPaddingFn;
|
|
87
120
|
|
|
88
|
-
/**
|
|
121
|
+
/**
|
|
122
|
+
* @title 国际化
|
|
123
|
+
* @description 语言配置
|
|
124
|
+
*/
|
|
89
125
|
readonly locale?: string;
|
|
90
126
|
|
|
91
|
-
|
|
92
|
-
|
|
127
|
+
/**
|
|
128
|
+
* @title 渲染引擎
|
|
129
|
+
* @description 设置渲染引擎,'svg' | 'canvas'
|
|
130
|
+
* @default "canvas"
|
|
131
|
+
*/
|
|
93
132
|
readonly renderer?: 'svg' | 'canvas';
|
|
94
|
-
/**
|
|
133
|
+
/**
|
|
134
|
+
* @title 屏幕像素比
|
|
135
|
+
* @description 默认为 window.devicePixelRatio
|
|
136
|
+
*/
|
|
95
137
|
readonly pixelRatio?: number;
|
|
96
|
-
/**
|
|
138
|
+
/**
|
|
139
|
+
* @title 是否启局部渲染
|
|
140
|
+
* @description 是否开启局部渲染,默认为 true
|
|
141
|
+
* @default true
|
|
142
|
+
*/
|
|
97
143
|
readonly localRefresh?: boolean;
|
|
98
|
-
/**
|
|
144
|
+
/**
|
|
145
|
+
* @title 是否支持 CSS transform
|
|
146
|
+
* @description 开启后图表的交互以及事件将在页面设置了 css transform 属性时生效,默认关闭。
|
|
147
|
+
* @default false
|
|
148
|
+
*/
|
|
99
149
|
readonly supportCSSTransform?: boolean;
|
|
100
150
|
|
|
101
|
-
|
|
102
|
-
|
|
151
|
+
/**
|
|
152
|
+
* @title 数据
|
|
153
|
+
* @description 设置画布具体的数据
|
|
154
|
+
*/
|
|
103
155
|
readonly data: Record<string, any>[];
|
|
104
|
-
/**
|
|
156
|
+
/**
|
|
157
|
+
* @title 数据字段元信息
|
|
158
|
+
* @description 设置数据字段元信息
|
|
159
|
+
*/
|
|
105
160
|
readonly meta?: Record<string, Meta>;
|
|
106
161
|
|
|
107
162
|
// G2 相关
|
|
108
|
-
/**
|
|
163
|
+
/**
|
|
164
|
+
* @title 主题
|
|
165
|
+
* @description G2 主题,字符串或者 theme object
|
|
166
|
+
* @default "light"
|
|
167
|
+
*/
|
|
109
168
|
readonly theme?: string | object;
|
|
110
|
-
/**
|
|
169
|
+
/**
|
|
170
|
+
* @title 颜色色板
|
|
171
|
+
* @description 设置颜色色板
|
|
172
|
+
*/
|
|
111
173
|
readonly color?: ColorAttr;
|
|
112
|
-
/**
|
|
174
|
+
/**
|
|
175
|
+
* @title pattern 配置
|
|
176
|
+
* @description 设置图表 pattern
|
|
177
|
+
*/
|
|
113
178
|
readonly pattern?: PatternAttr;
|
|
114
|
-
/**
|
|
179
|
+
/**
|
|
180
|
+
* @title 横坐标
|
|
181
|
+
* @description 设置画布横坐标的配置项
|
|
182
|
+
*/
|
|
115
183
|
readonly xAxis?: Axis;
|
|
116
|
-
/**
|
|
184
|
+
/**
|
|
185
|
+
* @title 纵坐标
|
|
186
|
+
* @description 设置画布纵坐标的配置项
|
|
187
|
+
*/
|
|
117
188
|
readonly yAxis?: Axis;
|
|
118
|
-
/**
|
|
189
|
+
/**
|
|
190
|
+
* @title 数据标签
|
|
191
|
+
* @description 设置数据标签
|
|
192
|
+
*/
|
|
119
193
|
readonly label?: Label;
|
|
120
|
-
/**
|
|
194
|
+
/**
|
|
195
|
+
* @title tooltip 提示
|
|
196
|
+
* @description 设置画布 tooltip 的配置项
|
|
197
|
+
*/
|
|
121
198
|
readonly tooltip?: Tooltip;
|
|
122
|
-
/**
|
|
199
|
+
/**
|
|
200
|
+
* @title 图例
|
|
201
|
+
* @description 设置画布图例 legend 的配置项
|
|
202
|
+
*/
|
|
123
203
|
readonly legend?: Legend;
|
|
124
|
-
/**
|
|
204
|
+
/**
|
|
205
|
+
* @title 缩略轴
|
|
206
|
+
* @description 设置缩略轴 slider 的配置项
|
|
207
|
+
*/
|
|
125
208
|
readonly slider?: Slider;
|
|
126
|
-
/**
|
|
209
|
+
/**
|
|
210
|
+
* @title 滚动条
|
|
211
|
+
* @description 设置画布缩略轴 scrollbar 的配置项
|
|
212
|
+
*/
|
|
127
213
|
readonly scrollbar?: Scrollbar;
|
|
214
|
+
/**
|
|
215
|
+
* @title 动画
|
|
216
|
+
* @description 设置图表动画
|
|
217
|
+
*/
|
|
128
218
|
readonly animation?: Animation;
|
|
219
|
+
/**
|
|
220
|
+
* @title 交互
|
|
221
|
+
* @description 设置画布交互行为
|
|
222
|
+
*/
|
|
129
223
|
readonly interactions?: Interaction[];
|
|
224
|
+
/**
|
|
225
|
+
* @title 注解
|
|
226
|
+
* @description 设置画布注解
|
|
227
|
+
*/
|
|
130
228
|
readonly annotations?: Annotation[];
|
|
131
|
-
|
|
229
|
+
/**
|
|
230
|
+
* @title 图表状态
|
|
231
|
+
* @description 设置画布配置 active,inactive,selected 三种状态的样式,也可在 Theme 主题中配置
|
|
232
|
+
*/
|
|
132
233
|
readonly state?: State;
|
|
133
|
-
/**
|
|
234
|
+
/**
|
|
235
|
+
* @title 是否裁剪
|
|
236
|
+
* @description 是否对超出坐标系范围的 Geometry 进行剪切
|
|
237
|
+
*/
|
|
134
238
|
readonly limitInPlot?: boolean;
|
|
135
|
-
/**
|
|
239
|
+
/**
|
|
240
|
+
* @title 内置交互
|
|
241
|
+
* @description 内置注册的交互
|
|
242
|
+
* @deprecated false
|
|
243
|
+
*/
|
|
136
244
|
readonly defaultInteractions?: string[];
|
|
137
245
|
};
|
package/src/types/drill-down.ts
CHANGED
|
@@ -1,19 +1,40 @@
|
|
|
1
1
|
import { ShapeAttrs } from '@antv/g2';
|
|
2
2
|
|
|
3
3
|
export type DrillDownCfg = {
|
|
4
|
-
/**
|
|
4
|
+
/**
|
|
5
|
+
* @title 是否启用
|
|
6
|
+
* @description 是否启用 drillDown interaction
|
|
7
|
+
*/
|
|
5
8
|
enabled?: boolean;
|
|
6
|
-
/**
|
|
9
|
+
/**
|
|
10
|
+
* @title 面包屑
|
|
11
|
+
* @description 设置面包屑相关配置
|
|
12
|
+
*/
|
|
7
13
|
breadCrumb?: {
|
|
8
|
-
/**
|
|
14
|
+
/**
|
|
15
|
+
* @title 位置
|
|
16
|
+
* @description 设置面包屑显示位置
|
|
17
|
+
*/
|
|
9
18
|
position: 'top-left' | 'bottom-left';
|
|
10
|
-
/**
|
|
19
|
+
/**
|
|
20
|
+
* @title 根文本
|
|
21
|
+
* @description 设置面包屑根文本
|
|
22
|
+
*/
|
|
11
23
|
rootText?: string;
|
|
12
|
-
/**
|
|
24
|
+
/**
|
|
25
|
+
* @title 分割线文本
|
|
26
|
+
* @description 设置面包屑分割线文本
|
|
27
|
+
*/
|
|
13
28
|
dividerText?: string;
|
|
14
|
-
/**
|
|
29
|
+
/**
|
|
30
|
+
* @title 字体样式
|
|
31
|
+
* @description 设置面包屑字体样式
|
|
32
|
+
*/
|
|
15
33
|
textStyle?: ShapeAttrs;
|
|
16
|
-
/**
|
|
34
|
+
/**
|
|
35
|
+
* @title 激活的字体样式
|
|
36
|
+
* @description 设置面包屑字激活的字体样式
|
|
37
|
+
*/
|
|
17
38
|
activeTextStyle?: ShapeAttrs;
|
|
18
39
|
};
|
|
19
40
|
};
|
package/src/types/interaction.ts
CHANGED
|
@@ -10,17 +10,37 @@ export type Interaction = {
|
|
|
10
10
|
|
|
11
11
|
/** brush 交互 */
|
|
12
12
|
export type BrushCfg = {
|
|
13
|
-
/**
|
|
13
|
+
/**
|
|
14
|
+
* @title 是否启用
|
|
15
|
+
* @description 是否启用 brush 交互
|
|
16
|
+
*/
|
|
14
17
|
readonly enabled?: boolean;
|
|
15
|
-
/**
|
|
18
|
+
/**
|
|
19
|
+
* @title brush 类型
|
|
20
|
+
* @description '矩形', 'x 方向' 和 'y 方向', 'circle', 'path'(不规则矩形). 默认: 'rect'.
|
|
21
|
+
* @default "rect"
|
|
22
|
+
*/
|
|
16
23
|
readonly type?: 'rect' | 'x-rect' | 'y-rect' | 'circle' | 'path';
|
|
17
|
-
/**
|
|
24
|
+
/**
|
|
25
|
+
* @title brush 操作
|
|
26
|
+
* @description '筛选过滤' 和 '高亮强调'. 默认: 'filter'. 目前只在 type 为 'rect' 的情况下生效
|
|
27
|
+
* @default "filter"
|
|
28
|
+
*/
|
|
18
29
|
readonly action?: 'filter' | 'highlight';
|
|
19
|
-
/**
|
|
30
|
+
/**
|
|
31
|
+
* @title mask
|
|
32
|
+
* @description brush mask 的配置
|
|
33
|
+
*/
|
|
20
34
|
readonly mask?: {
|
|
21
|
-
/**
|
|
35
|
+
/**
|
|
36
|
+
* @title mask 样式
|
|
37
|
+
* @description mask 蒙层样式
|
|
38
|
+
*/
|
|
22
39
|
style?: ShapeAttrs;
|
|
23
40
|
};
|
|
24
|
-
/**
|
|
41
|
+
/**
|
|
42
|
+
* @title button 配置
|
|
43
|
+
* @description brush button 的配置, 只在 action: 'filter' 的情况下适用
|
|
44
|
+
*/
|
|
25
45
|
readonly button?: ButtonCfg;
|
|
26
46
|
};
|
package/src/types/label.ts
CHANGED
|
@@ -3,10 +3,18 @@ import { Types } from '@antv/g2';
|
|
|
3
3
|
export type Label =
|
|
4
4
|
| false
|
|
5
5
|
| ({
|
|
6
|
-
/**
|
|
6
|
+
/**
|
|
7
|
+
* @title 映射的字段
|
|
8
|
+
*/
|
|
7
9
|
readonly fields?: string[];
|
|
8
|
-
/**
|
|
10
|
+
/**
|
|
11
|
+
* @title 回调函数
|
|
12
|
+
* @description 回调函数,返回相关点 value
|
|
13
|
+
*/
|
|
9
14
|
readonly callback?: Types.LabelCallback;
|
|
10
|
-
/**
|
|
15
|
+
/**
|
|
16
|
+
* @title 格式化
|
|
17
|
+
* @description 功能同 content ,兼容 v1,一般用于自定义。
|
|
18
|
+
*/
|
|
11
19
|
readonly formatter?: Types.GeometryLabelCfg['content'];
|
|
12
20
|
} & Types.GeometryLabelCfg);
|
package/src/types/meta.ts
CHANGED
|
@@ -3,16 +3,13 @@ import { ScaleConfig } from '@antv/g2';
|
|
|
3
3
|
/** scale 元信息,取名为 meta */
|
|
4
4
|
export type Meta = ScaleConfig & {
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
7
|
-
* 对于连续的,一般是 linear,对于分类一般为 cat
|
|
8
|
-
* 当然也有 log, pow, time 等类型,或者通过 tickMethod 自定义自己的 scale
|
|
6
|
+
* @title mescale 的 type 类型ta
|
|
7
|
+
* @description 对于连续的,一般是 linear,对于分类一般为 cat。当然也有 log, pow, time 等类型,或者通过 tickMethod 自定义自己的 scale
|
|
9
8
|
*/
|
|
10
9
|
readonly type?: string;
|
|
11
10
|
/**
|
|
12
|
-
* 是否进行 scale
|
|
13
|
-
*
|
|
14
|
-
* - 设置为 true 则以 field 为 key 进行同步
|
|
15
|
-
* - 设置为 string,则以这个 string 为 key 进行同步
|
|
11
|
+
* @title 是否进行 scale 的同步
|
|
12
|
+
* @description 设置为 false 则不同步; 设置为 true 则以 field 为 key 进行同步;设置为 string,则以这个 string 为 key 进行同步
|
|
16
13
|
*/
|
|
17
14
|
readonly sync?: boolean | string;
|
|
18
15
|
};
|
package/src/types/pattern.ts
CHANGED
|
@@ -1,50 +1,90 @@
|
|
|
1
1
|
export type PatternCfg = {
|
|
2
|
-
/**
|
|
2
|
+
/**
|
|
3
|
+
* @title 背景色
|
|
4
|
+
* @description pattern background color. Default: inherit (默认: 继承图形元素颜色)
|
|
5
|
+
* @default "inherit"
|
|
6
|
+
*/
|
|
3
7
|
backgroundColor?: string;
|
|
4
|
-
/**
|
|
8
|
+
/**
|
|
9
|
+
* @title 贴图图案填充色
|
|
10
|
+
*/
|
|
5
11
|
fill?: string;
|
|
6
|
-
/**
|
|
12
|
+
/**
|
|
13
|
+
* @title 填充透明度
|
|
14
|
+
*/
|
|
7
15
|
fillOpacity?: number;
|
|
8
|
-
/**
|
|
16
|
+
/**
|
|
17
|
+
* @title 描边色
|
|
18
|
+
* @description 贴图图案描边色
|
|
19
|
+
*/
|
|
9
20
|
stroke?: string;
|
|
10
|
-
/**
|
|
21
|
+
/**
|
|
22
|
+
* @title 描边透明度
|
|
23
|
+
*/
|
|
11
24
|
strokeOpacity?: number;
|
|
12
|
-
/**
|
|
25
|
+
/**
|
|
26
|
+
* @title 描边粗细
|
|
27
|
+
*/
|
|
13
28
|
lineWidth?: number;
|
|
14
|
-
/**
|
|
29
|
+
/**
|
|
30
|
+
* @title 透明度
|
|
31
|
+
* @description 整个pattern 透明度
|
|
32
|
+
*/
|
|
15
33
|
opacity?: number;
|
|
16
|
-
/**
|
|
34
|
+
/**
|
|
35
|
+
* @title 旋转角度
|
|
36
|
+
* @description 整个pattern 的旋转角度
|
|
37
|
+
*/
|
|
17
38
|
rotation?: number;
|
|
18
39
|
};
|
|
19
40
|
|
|
20
41
|
/**
|
|
21
|
-
* dot pattern
|
|
42
|
+
* @title dot pattern
|
|
22
43
|
*/
|
|
23
44
|
export type DotPatternCfg = PatternCfg & {
|
|
24
|
-
/**
|
|
45
|
+
/**
|
|
46
|
+
* @title 点的大小
|
|
47
|
+
* @default 4
|
|
48
|
+
*/
|
|
25
49
|
size?: number;
|
|
26
|
-
/**
|
|
50
|
+
/**
|
|
51
|
+
* @title 点间距
|
|
52
|
+
* @default 4
|
|
53
|
+
*/
|
|
27
54
|
padding?: number;
|
|
28
|
-
/**
|
|
55
|
+
/**
|
|
56
|
+
* @title 是否交错
|
|
57
|
+
* @default true
|
|
58
|
+
*/
|
|
29
59
|
isStagger?: boolean;
|
|
30
60
|
};
|
|
31
61
|
|
|
32
62
|
/**
|
|
33
|
-
* line pattern
|
|
63
|
+
* @title line pattern
|
|
34
64
|
*/
|
|
35
65
|
export type LinePatternCfg = PatternCfg & {
|
|
36
|
-
/**
|
|
66
|
+
/**
|
|
67
|
+
* @title 线之间的距离
|
|
68
|
+
*/
|
|
37
69
|
spacing?: number;
|
|
38
70
|
};
|
|
39
71
|
|
|
40
72
|
/**
|
|
41
|
-
* square pattern
|
|
73
|
+
* @title square pattern
|
|
42
74
|
*/
|
|
43
75
|
export type SquarePatternCfg = PatternCfg & {
|
|
44
|
-
/**
|
|
76
|
+
/**
|
|
77
|
+
* @title 矩形的大小
|
|
78
|
+
*/
|
|
45
79
|
size?: number;
|
|
46
|
-
/**
|
|
80
|
+
/**
|
|
81
|
+
* @title 矩形之间的间隔
|
|
82
|
+
*/
|
|
47
83
|
padding?: number;
|
|
48
|
-
/**
|
|
84
|
+
/**
|
|
85
|
+
* @title 是否交错
|
|
86
|
+
* @description 即 staggered squares.
|
|
87
|
+
* @default true
|
|
88
|
+
*/
|
|
49
89
|
isStagger?: boolean;
|
|
50
90
|
};
|
package/src/types/state.ts
CHANGED
|
@@ -3,11 +3,19 @@ import { Datum, Data } from './common';
|
|
|
3
3
|
|
|
4
4
|
export type State = Types.StateOption;
|
|
5
5
|
|
|
6
|
-
/**
|
|
6
|
+
/**
|
|
7
|
+
* @title 状态名称
|
|
8
|
+
* @description G2 Element 开放 'active' | 'inactive' | 'selected' | 'default' 四种状态
|
|
9
|
+
*/
|
|
7
10
|
export type StateName = 'active' | 'inactive' | 'selected' | 'default';
|
|
8
11
|
|
|
9
|
-
/**
|
|
12
|
+
/**
|
|
13
|
+
* @title 状态条件
|
|
14
|
+
*/
|
|
10
15
|
export type StateCondition = (data: Datum | Data) => boolean;
|
|
11
16
|
|
|
12
|
-
/**
|
|
17
|
+
/**
|
|
18
|
+
* @title 状态对象
|
|
19
|
+
* @description 可通过 `plot.getStates()` 获取
|
|
20
|
+
*/
|
|
13
21
|
export type StateObject = { data: Datum | Data; state: string; geometry: Geometry; element: Element };
|
package/src/types/statistic.ts
CHANGED
|
@@ -2,26 +2,52 @@ import { View } from '@antv/g2';
|
|
|
2
2
|
import { Data, Datum } from './common';
|
|
3
3
|
|
|
4
4
|
type CSSStyle = Omit<Partial<CSSStyleDeclaration>, 'opacity' | 'fontWeight' | 'lineHeight'> & {
|
|
5
|
+
/**
|
|
6
|
+
* @title 透明度
|
|
7
|
+
*/
|
|
5
8
|
opacity?: number;
|
|
9
|
+
/**
|
|
10
|
+
* @title 字体粗细程度
|
|
11
|
+
*/
|
|
6
12
|
fontWeight?: string | number;
|
|
13
|
+
/**
|
|
14
|
+
* @title 行高
|
|
15
|
+
*/
|
|
7
16
|
lineHeight?: string | number;
|
|
8
17
|
};
|
|
9
18
|
|
|
10
19
|
/**
|
|
11
|
-
* 统计文本
|
|
12
|
-
*
|
|
20
|
+
* @title 统计文本
|
|
21
|
+
* @description 支持三种设置模式(优先级):customHtml > formatter > content
|
|
13
22
|
*/
|
|
14
23
|
export type StatisticText = {
|
|
15
|
-
/**
|
|
24
|
+
/**
|
|
25
|
+
* @title 统计文本的样式
|
|
26
|
+
*/
|
|
16
27
|
readonly style?: CSSStyle | ((datum: Datum) => CSSStyle);
|
|
17
|
-
/**
|
|
28
|
+
/**
|
|
29
|
+
* @title 文本内容
|
|
30
|
+
*/
|
|
18
31
|
readonly content?: string;
|
|
19
|
-
/**
|
|
32
|
+
/**
|
|
33
|
+
* @title 文本的格式化
|
|
34
|
+
*/
|
|
20
35
|
readonly formatter?: (datum?: Datum, data?: Data /** filterData */) => string;
|
|
21
|
-
/**
|
|
36
|
+
/**
|
|
37
|
+
* @title 自定义中心文本的 html
|
|
38
|
+
*/
|
|
22
39
|
readonly customHtml?: (container: HTMLElement, view: View, datum?: Datum, data?: Data /** filterData */) => string;
|
|
40
|
+
/**
|
|
41
|
+
* @title 旋转弧度
|
|
42
|
+
*/
|
|
23
43
|
readonly rotate?: number;
|
|
44
|
+
/**
|
|
45
|
+
* @title 横轴偏移值
|
|
46
|
+
*/
|
|
24
47
|
readonly offsetX?: number;
|
|
48
|
+
/**
|
|
49
|
+
* @title 纵轴偏移值
|
|
50
|
+
*/
|
|
25
51
|
readonly offsetY?: number;
|
|
26
52
|
};
|
|
27
53
|
|
|
@@ -29,6 +55,12 @@ export type StatisticText = {
|
|
|
29
55
|
* 中心文本的统计信息,统一一个数据结构
|
|
30
56
|
*/
|
|
31
57
|
export type Statistic = {
|
|
58
|
+
/**
|
|
59
|
+
* @title 标题
|
|
60
|
+
*/
|
|
32
61
|
readonly title?: false | StatisticText;
|
|
62
|
+
/**
|
|
63
|
+
* @title 内容
|
|
64
|
+
*/
|
|
33
65
|
readonly content?: false | StatisticText;
|
|
34
66
|
};
|
package/src/types/tooltip.ts
CHANGED
|
@@ -2,9 +2,14 @@ import { Types } from '@antv/g2';
|
|
|
2
2
|
import { TooltipAttr } from '../types/attr';
|
|
3
3
|
|
|
4
4
|
export type TooltipMapping = {
|
|
5
|
-
/**
|
|
5
|
+
/**
|
|
6
|
+
* @title 映射字段
|
|
7
|
+
* @description 指定需要显示 tooltip 中的字段,默认是包含 x seriesFields y
|
|
8
|
+
*/
|
|
6
9
|
readonly fields?: string[] | false;
|
|
7
|
-
/**
|
|
10
|
+
/**
|
|
11
|
+
* @title value 格式化
|
|
12
|
+
*/
|
|
8
13
|
readonly formatter?: TooltipAttr;
|
|
9
14
|
};
|
|
10
15
|
|
|
@@ -31,7 +31,7 @@ export function percent(data: Data, measure: string, groupField: string, as: str
|
|
|
31
31
|
return map(data, (datum: Datum) => {
|
|
32
32
|
const v = datum[measure];
|
|
33
33
|
const groupValue = datum[groupField];
|
|
34
|
-
const percentage = isRealNumber(v) ? v / sumMap.get(groupValue) : 0;
|
|
34
|
+
const percentage = isRealNumber(v) && sumMap.get(groupValue) !== 0 ? v / sumMap.get(groupValue) : 0;
|
|
35
35
|
|
|
36
36
|
return {
|
|
37
37
|
...datum,
|
|
@@ -72,7 +72,7 @@ export function getDeepPercent(data: Record<string, any>[], measure: string, fie
|
|
|
72
72
|
// 获取分组得到的枚举key值
|
|
73
73
|
const groupValue = reduce(fields, (value, field) => `${value}${datum[field]}`, '');
|
|
74
74
|
|
|
75
|
-
const percentage = isRealNumber(v) ? v / sumMap.get(groupValue) : 0;
|
|
75
|
+
const percentage = isRealNumber(v) && sumMap.get(groupValue) !== 0 ? v / sumMap.get(groupValue) : 0;
|
|
76
76
|
|
|
77
77
|
return {
|
|
78
78
|
...datum,
|