@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.
Files changed (283) hide show
  1. package/CHANGELOG.md +52 -0
  2. package/README.md +1 -1
  3. package/dist/g2plot.min.js +4 -4
  4. package/dist/g2plot.min.js.map +1 -1
  5. package/esm/core/plot.d.ts +2 -2
  6. package/esm/core/plot.js +4 -3
  7. package/esm/core/plot.js.map +1 -1
  8. package/esm/index.d.ts +2 -2
  9. package/esm/index.js +2 -2
  10. package/esm/index.js.map +1 -1
  11. package/esm/plots/area/types.d.ts +35 -10
  12. package/esm/plots/area/types.js.map +1 -1
  13. package/esm/plots/bar/types.d.ts +16 -3
  14. package/esm/plots/bar/types.js.map +1 -1
  15. package/esm/plots/bidirectional-bar/types.d.ts +21 -6
  16. package/esm/plots/bidirectional-bar/types.js.map +1 -1
  17. package/esm/plots/box/types.d.ts +20 -6
  18. package/esm/plots/box/types.js.map +1 -1
  19. package/esm/plots/bullet/types.d.ts +36 -9
  20. package/esm/plots/bullet/types.js.map +1 -1
  21. package/esm/plots/chord/types.d.ts +14 -10
  22. package/esm/plots/chord/types.js.map +1 -1
  23. package/esm/plots/circle-packing/types.d.ts +25 -8
  24. package/esm/plots/circle-packing/types.js.map +1 -1
  25. package/esm/plots/column/types.d.ts +57 -16
  26. package/esm/plots/column/types.js.map +1 -1
  27. package/esm/plots/dual-axes/types.d.ts +31 -6
  28. package/esm/plots/dual-axes/types.js.map +1 -1
  29. package/esm/plots/dual-axes/util/render-sider.js +1 -1
  30. package/esm/plots/dual-axes/util/render-sider.js.map +1 -1
  31. package/esm/plots/facet/types.d.ts +54 -34
  32. package/esm/plots/facet/types.js.map +1 -1
  33. package/esm/plots/funnel/geometries/compare.js +2 -1
  34. package/esm/plots/funnel/geometries/compare.js.map +1 -1
  35. package/esm/plots/funnel/geometries/facet.js +2 -1
  36. package/esm/plots/funnel/geometries/facet.js.map +1 -1
  37. package/esm/plots/funnel/types.d.ts +45 -11
  38. package/esm/plots/funnel/types.js.map +1 -1
  39. package/esm/plots/gauge/types.d.ts +83 -21
  40. package/esm/plots/gauge/types.js.map +1 -1
  41. package/esm/plots/heatmap/types.d.ts +47 -12
  42. package/esm/plots/heatmap/types.js.map +1 -1
  43. package/esm/plots/histogram/types.d.ts +17 -6
  44. package/esm/plots/histogram/types.js.map +1 -1
  45. package/esm/plots/line/types.d.ts +42 -12
  46. package/esm/plots/line/types.js.map +1 -1
  47. package/esm/plots/liquid/index.d.ts +1 -0
  48. package/esm/plots/liquid/index.js +1 -0
  49. package/esm/plots/liquid/index.js.map +1 -1
  50. package/esm/plots/liquid/shapes/liquid.d.ts +16 -1
  51. package/esm/plots/liquid/shapes/liquid.js +13 -8
  52. package/esm/plots/liquid/shapes/liquid.js.map +1 -1
  53. package/esm/plots/liquid/types.d.ts +56 -16
  54. package/esm/plots/liquid/types.js.map +1 -1
  55. package/esm/plots/mix/types.d.ts +31 -22
  56. package/esm/plots/mix/types.js.map +1 -1
  57. package/esm/plots/pie/types.d.ts +27 -10
  58. package/esm/plots/pie/types.js.map +1 -1
  59. package/esm/plots/progress/types.d.ts +13 -4
  60. package/esm/plots/progress/types.js.map +1 -1
  61. package/esm/plots/radar/types.d.ts +39 -12
  62. package/esm/plots/radar/types.js.map +1 -1
  63. package/esm/plots/radial-bar/types.d.ts +39 -12
  64. package/esm/plots/radial-bar/types.js.map +1 -1
  65. package/esm/plots/ring-progress/types.d.ts +18 -6
  66. package/esm/plots/ring-progress/types.js.map +1 -1
  67. package/esm/plots/rose/types.d.ts +32 -12
  68. package/esm/plots/rose/types.js.map +1 -1
  69. package/esm/plots/sankey/adaptor.js +31 -2
  70. package/esm/plots/sankey/adaptor.js.map +1 -1
  71. package/esm/plots/sankey/types.d.ts +57 -30
  72. package/esm/plots/sankey/types.js.map +1 -1
  73. package/esm/plots/scatter/types.d.ts +76 -22
  74. package/esm/plots/scatter/types.js.map +1 -1
  75. package/esm/plots/stock/types.d.ts +20 -7
  76. package/esm/plots/stock/types.js.map +1 -1
  77. package/esm/plots/sunburst/types.d.ts +40 -12
  78. package/esm/plots/sunburst/types.js.map +1 -1
  79. package/esm/plots/tiny-area/types.d.ts +16 -5
  80. package/esm/plots/tiny-area/types.js.map +1 -1
  81. package/esm/plots/tiny-column/types.d.ts +10 -3
  82. package/esm/plots/tiny-column/types.js.map +1 -1
  83. package/esm/plots/tiny-line/types.d.ts +17 -5
  84. package/esm/plots/tiny-line/types.js.map +1 -1
  85. package/esm/plots/treemap/types.d.ts +17 -6
  86. package/esm/plots/treemap/types.js.map +1 -1
  87. package/esm/plots/venn/types.d.ts +20 -6
  88. package/esm/plots/venn/types.js.map +1 -1
  89. package/esm/plots/violin/types.d.ts +52 -17
  90. package/esm/plots/violin/types.js.map +1 -1
  91. package/esm/plots/waterfall/types.d.ts +42 -10
  92. package/esm/plots/waterfall/types.js.map +1 -1
  93. package/esm/plots/word-cloud/types.d.ts +91 -44
  94. package/esm/plots/word-cloud/types.js.map +1 -1
  95. package/esm/types/button.d.ts +8 -4
  96. package/esm/types/button.js.map +1 -1
  97. package/esm/types/common.d.ts +145 -33
  98. package/esm/types/common.js.map +1 -1
  99. package/esm/types/drill-down.d.ts +28 -7
  100. package/esm/types/drill-down.js.map +1 -1
  101. package/esm/types/interaction.d.ts +26 -6
  102. package/esm/types/interaction.js.map +1 -1
  103. package/esm/types/label.d.ts +11 -3
  104. package/esm/types/label.js.map +1 -1
  105. package/esm/types/meta.d.ts +4 -7
  106. package/esm/types/meta.js.map +1 -1
  107. package/esm/types/pattern.d.ts +58 -18
  108. package/esm/types/pattern.js.map +1 -1
  109. package/esm/types/state.d.ts +11 -3
  110. package/esm/types/state.js.map +1 -1
  111. package/esm/types/statistic.d.ts +38 -6
  112. package/esm/types/statistic.js.map +1 -1
  113. package/esm/types/tooltip.d.ts +7 -2
  114. package/esm/types/tooltip.js.map +1 -1
  115. package/esm/utils/transform/percent.js +2 -2
  116. package/esm/utils/transform/percent.js.map +1 -1
  117. package/lib/core/plot.d.ts +2 -2
  118. package/lib/core/plot.js +4 -3
  119. package/lib/core/plot.js.map +1 -1
  120. package/lib/index.d.ts +2 -2
  121. package/lib/index.js +2 -1
  122. package/lib/index.js.map +1 -1
  123. package/lib/plots/area/types.d.ts +35 -10
  124. package/lib/plots/area/types.js.map +1 -1
  125. package/lib/plots/bar/types.d.ts +16 -3
  126. package/lib/plots/bar/types.js.map +1 -1
  127. package/lib/plots/bidirectional-bar/types.d.ts +21 -6
  128. package/lib/plots/bidirectional-bar/types.js.map +1 -1
  129. package/lib/plots/box/types.d.ts +20 -6
  130. package/lib/plots/box/types.js.map +1 -1
  131. package/lib/plots/bullet/types.d.ts +36 -9
  132. package/lib/plots/bullet/types.js.map +1 -1
  133. package/lib/plots/chord/types.d.ts +14 -10
  134. package/lib/plots/chord/types.js.map +1 -1
  135. package/lib/plots/circle-packing/types.d.ts +25 -8
  136. package/lib/plots/circle-packing/types.js.map +1 -1
  137. package/lib/plots/column/types.d.ts +57 -16
  138. package/lib/plots/column/types.js.map +1 -1
  139. package/lib/plots/dual-axes/types.d.ts +31 -6
  140. package/lib/plots/dual-axes/types.js.map +1 -1
  141. package/lib/plots/dual-axes/util/render-sider.js +1 -1
  142. package/lib/plots/dual-axes/util/render-sider.js.map +1 -1
  143. package/lib/plots/facet/types.d.ts +54 -34
  144. package/lib/plots/facet/types.js.map +1 -1
  145. package/lib/plots/funnel/geometries/compare.js +2 -1
  146. package/lib/plots/funnel/geometries/compare.js.map +1 -1
  147. package/lib/plots/funnel/geometries/facet.js +2 -1
  148. package/lib/plots/funnel/geometries/facet.js.map +1 -1
  149. package/lib/plots/funnel/types.d.ts +45 -11
  150. package/lib/plots/funnel/types.js.map +1 -1
  151. package/lib/plots/gauge/types.d.ts +83 -21
  152. package/lib/plots/gauge/types.js.map +1 -1
  153. package/lib/plots/heatmap/types.d.ts +47 -12
  154. package/lib/plots/heatmap/types.js.map +1 -1
  155. package/lib/plots/histogram/types.d.ts +17 -6
  156. package/lib/plots/histogram/types.js.map +1 -1
  157. package/lib/plots/line/types.d.ts +42 -12
  158. package/lib/plots/line/types.js.map +1 -1
  159. package/lib/plots/liquid/index.d.ts +1 -0
  160. package/lib/plots/liquid/index.js +2 -0
  161. package/lib/plots/liquid/index.js.map +1 -1
  162. package/lib/plots/liquid/shapes/liquid.d.ts +16 -1
  163. package/lib/plots/liquid/shapes/liquid.js +14 -7
  164. package/lib/plots/liquid/shapes/liquid.js.map +1 -1
  165. package/lib/plots/liquid/types.d.ts +56 -16
  166. package/lib/plots/liquid/types.js.map +1 -1
  167. package/lib/plots/mix/types.d.ts +31 -22
  168. package/lib/plots/mix/types.js.map +1 -1
  169. package/lib/plots/pie/types.d.ts +27 -10
  170. package/lib/plots/pie/types.js.map +1 -1
  171. package/lib/plots/progress/types.d.ts +13 -4
  172. package/lib/plots/progress/types.js.map +1 -1
  173. package/lib/plots/radar/types.d.ts +39 -12
  174. package/lib/plots/radar/types.js.map +1 -1
  175. package/lib/plots/radial-bar/types.d.ts +39 -12
  176. package/lib/plots/radial-bar/types.js.map +1 -1
  177. package/lib/plots/ring-progress/types.d.ts +18 -6
  178. package/lib/plots/ring-progress/types.js.map +1 -1
  179. package/lib/plots/rose/types.d.ts +32 -12
  180. package/lib/plots/rose/types.js.map +1 -1
  181. package/lib/plots/sankey/adaptor.js +30 -1
  182. package/lib/plots/sankey/adaptor.js.map +1 -1
  183. package/lib/plots/sankey/types.d.ts +57 -30
  184. package/lib/plots/sankey/types.js.map +1 -1
  185. package/lib/plots/scatter/types.d.ts +76 -22
  186. package/lib/plots/scatter/types.js.map +1 -1
  187. package/lib/plots/stock/types.d.ts +20 -7
  188. package/lib/plots/stock/types.js.map +1 -1
  189. package/lib/plots/sunburst/types.d.ts +40 -12
  190. package/lib/plots/sunburst/types.js.map +1 -1
  191. package/lib/plots/tiny-area/types.d.ts +16 -5
  192. package/lib/plots/tiny-area/types.js.map +1 -1
  193. package/lib/plots/tiny-column/types.d.ts +10 -3
  194. package/lib/plots/tiny-column/types.js.map +1 -1
  195. package/lib/plots/tiny-line/types.d.ts +17 -5
  196. package/lib/plots/tiny-line/types.js.map +1 -1
  197. package/lib/plots/treemap/types.d.ts +17 -6
  198. package/lib/plots/treemap/types.js.map +1 -1
  199. package/lib/plots/venn/types.d.ts +20 -6
  200. package/lib/plots/venn/types.js.map +1 -1
  201. package/lib/plots/violin/types.d.ts +52 -17
  202. package/lib/plots/violin/types.js.map +1 -1
  203. package/lib/plots/waterfall/types.d.ts +42 -10
  204. package/lib/plots/waterfall/types.js.map +1 -1
  205. package/lib/plots/word-cloud/types.d.ts +91 -44
  206. package/lib/plots/word-cloud/types.js.map +1 -1
  207. package/lib/types/button.d.ts +8 -4
  208. package/lib/types/button.js.map +1 -1
  209. package/lib/types/common.d.ts +145 -33
  210. package/lib/types/common.js.map +1 -1
  211. package/lib/types/drill-down.d.ts +28 -7
  212. package/lib/types/drill-down.js.map +1 -1
  213. package/lib/types/interaction.d.ts +26 -6
  214. package/lib/types/interaction.js.map +1 -1
  215. package/lib/types/label.d.ts +11 -3
  216. package/lib/types/label.js.map +1 -1
  217. package/lib/types/meta.d.ts +4 -7
  218. package/lib/types/meta.js.map +1 -1
  219. package/lib/types/pattern.d.ts +58 -18
  220. package/lib/types/pattern.js.map +1 -1
  221. package/lib/types/state.d.ts +11 -3
  222. package/lib/types/state.js.map +1 -1
  223. package/lib/types/statistic.d.ts +38 -6
  224. package/lib/types/statistic.js.map +1 -1
  225. package/lib/types/tooltip.d.ts +7 -2
  226. package/lib/types/tooltip.js.map +1 -1
  227. package/lib/utils/transform/percent.js +2 -2
  228. package/lib/utils/transform/percent.js.map +1 -1
  229. package/package.json +1 -1
  230. package/src/core/plot.ts +5 -4
  231. package/src/index.ts +2 -2
  232. package/src/plots/area/types.ts +35 -10
  233. package/src/plots/bar/types.ts +16 -3
  234. package/src/plots/bidirectional-bar/types.ts +21 -6
  235. package/src/plots/box/types.ts +20 -6
  236. package/src/plots/bullet/types.ts +36 -17
  237. package/src/plots/chord/types.ts +14 -11
  238. package/src/plots/circle-packing/types.ts +25 -14
  239. package/src/plots/column/types.ts +57 -20
  240. package/src/plots/dual-axes/types.ts +31 -16
  241. package/src/plots/dual-axes/util/render-sider.ts +1 -1
  242. package/src/plots/facet/types.ts +54 -49
  243. package/src/plots/funnel/geometries/compare.ts +2 -0
  244. package/src/plots/funnel/geometries/facet.ts +2 -1
  245. package/src/plots/funnel/types.ts +45 -14
  246. package/src/plots/gauge/types.ts +86 -27
  247. package/src/plots/heatmap/types.ts +49 -14
  248. package/src/plots/histogram/types.ts +17 -9
  249. package/src/plots/line/types.ts +42 -14
  250. package/src/plots/liquid/index.ts +2 -0
  251. package/src/plots/liquid/shapes/liquid.ts +16 -8
  252. package/src/plots/liquid/types.ts +56 -16
  253. package/src/plots/mix/types.ts +31 -35
  254. package/src/plots/pie/types.ts +27 -10
  255. package/src/plots/progress/types.ts +13 -4
  256. package/src/plots/radar/types.ts +39 -12
  257. package/src/plots/radial-bar/types.ts +39 -12
  258. package/src/plots/ring-progress/types.ts +18 -6
  259. package/src/plots/rose/types.ts +32 -12
  260. package/src/plots/sankey/adaptor.ts +35 -2
  261. package/src/plots/sankey/types.ts +58 -30
  262. package/src/plots/scatter/types.ts +77 -24
  263. package/src/plots/stock/types.ts +21 -8
  264. package/src/plots/sunburst/types.ts +42 -12
  265. package/src/plots/tiny-area/types.ts +16 -5
  266. package/src/plots/tiny-column/types.ts +10 -3
  267. package/src/plots/tiny-line/types.ts +17 -5
  268. package/src/plots/treemap/types.ts +17 -7
  269. package/src/plots/venn/types.ts +21 -6
  270. package/src/plots/violin/types.ts +52 -17
  271. package/src/plots/waterfall/types.ts +42 -10
  272. package/src/plots/word-cloud/types.ts +91 -44
  273. package/src/types/button.ts +8 -4
  274. package/src/types/common.ts +145 -37
  275. package/src/types/drill-down.ts +28 -7
  276. package/src/types/interaction.ts +26 -6
  277. package/src/types/label.ts +11 -3
  278. package/src/types/meta.ts +4 -7
  279. package/src/types/pattern.ts +58 -18
  280. package/src/types/state.ts +11 -3
  281. package/src/types/statistic.ts +38 -6
  282. package/src/types/tooltip.ts +7 -2
  283. package/src/utils/transform/percent.ts +2 -2
@@ -4,29 +4,45 @@ import { PERCENT, RANGE_TYPE, RANGE_VALUE } from './constants';
4
4
 
5
5
  /** 指标指标的配置 */
6
6
  export type Indicator = {
7
- // 指针
7
+ /**
8
+ * @title 指针
9
+ * @description 只允许静态的 object
10
+ */
8
11
  readonly pointer?: {
9
- readonly style?: ShapeStyle; // 只允许静态的 object
12
+ readonly style?: ShapeStyle;
10
13
  };
11
- // 圆环
14
+ /**
15
+ * @title 圆环
16
+ * @description 只允许静态的 object
17
+ */
12
18
  readonly pin?: {
13
- readonly style?: ShapeStyle; // 只允许静态的 object
19
+ readonly style?: ShapeStyle;
14
20
  };
15
- // 自定义指针 shape. 默认: 'gauge-indicator'
21
+ /**
22
+ * @title 自定义指针 shape
23
+ * @default 'gauge-indicator'
24
+ */
16
25
  readonly shape?: string;
17
26
  };
18
27
 
19
28
  export type Range = {
20
- /** 辅助的刻度值 0 ~ 1 的数字 */
29
+ /**
30
+ * @title 辅助的刻度值
31
+ * @description 0 ~ 1 的数字
32
+ */
21
33
  readonly ticks?: number[];
22
- /** 辅助刻度的颜色配置 */
34
+ /**
35
+ * @title 辅助刻度的颜色配置
36
+ */
23
37
  readonly color?: string | string[];
24
- /** 仪表盘辅助背景的宽度 */
38
+ /**
39
+ * @title 仪表盘辅助背景的宽度
40
+ */
25
41
  readonly width?: number;
26
42
  };
27
43
 
28
44
  /**
29
- * 仪表盘辅助生成的 rangeData
45
+ * @title 仪表盘辅助生成的 rangeData
30
46
  */
31
47
  export type GaugeRangeData = {
32
48
  readonly [RANGE_VALUE]?: number;
@@ -34,46 +50,89 @@ export type GaugeRangeData = {
34
50
  readonly [PERCENT]: number;
35
51
  }[];
36
52
 
37
- /** 仪表盘配置类型定义 */
53
+ /**
54
+ * @title 仪表盘配置类型定义
55
+ */
38
56
  export interface GaugeOptions
39
57
  extends Omit<Options, 'data' | 'tooltip' | 'legend' | 'xAxis' | 'yAxis' | 'xField' | 'yField' | 'color'> {
40
- /** 指标的比例 0 ~ 1 */
58
+ /**
59
+ * @title 指标的比例
60
+ * @description 范围0 ~ 1
61
+ */
41
62
  readonly percent: number;
42
- /** 外弧度 0 ~ 1 */
63
+ /**
64
+ * @title 外弧度
65
+ * @description 范围0 ~ 1
66
+ */
43
67
  readonly radius?: number;
44
- /** 内弧度 0 ~ 1 */
68
+ /**
69
+ * @title 内弧度
70
+ * @description 范围0 ~ 1
71
+ */
45
72
  readonly innerRadius?: number;
46
- /** 弧度起始 */
73
+ /**
74
+ * @title 弧度起始
75
+ */
47
76
  readonly startAngle?: number;
48
- /** 弧度结束 */
77
+ /**
78
+ * @title 弧度结束
79
+ */
49
80
  readonly endAngle?: number;
50
- /** 辅助的 range 组件 */
81
+ /**
82
+ * @title 辅助的 range 组件
83
+ */
51
84
  readonly range?: Range;
52
- /** 坐标轴配置 */
85
+ /**
86
+ * @title 坐标轴配置
87
+ */
53
88
  readonly axis?: Axis;
54
- /** 指针的配置 */
89
+ /**
90
+ * @title 指针的配置
91
+ */
55
92
  readonly indicator?: false | Indicator;
56
- /** 统计文本 */
93
+ /**
94
+ * @title 统计文本
95
+ */
57
96
  readonly statistic?: Statistic;
58
- /** 仪表盘样式 */
97
+ /**
98
+ * @title 仪表盘样式
99
+ */
59
100
  readonly gaugeStyle?: StyleAttr;
60
101
 
61
- // meter gauge 相关配置
62
- /** 仪表盘类型, 可选项: 'meter', default 为空 */
102
+ /**
103
+ * @title meter gauge 相关配置
104
+ */
105
+
106
+ /**
107
+ * @title 仪表盘类型
108
+ * @description 可选项: 'meter', default 为空
109
+ */
63
110
  readonly type?: string;
64
- /** 当仪表盘类型 = 'meter' 生效 */
111
+ /**
112
+ * @title 仪表盘配置
113
+ * @description 当仪表盘类型 = 'meter' 生效
114
+ */
65
115
  readonly meter?: {
66
- /** 仪表盘总步数, default: 50 */
116
+ /**
117
+ * @title 仪表盘总步数
118
+ * @default "50"
119
+ */
67
120
  readonly steps?: number;
68
- /** step 与 gap 的宽度占比, default: 0.5 */
121
+ /**
122
+ * @title step 与 gap 的宽度占比
123
+ * @default "0.5"
124
+ */
69
125
  readonly stepRatio?: number;
70
126
  };
71
127
  }
72
128
 
73
129
  /**
74
- * 仪表盘 自定义 shape 使用的 customInfo
130
+ * @title 仪表盘
131
+ * @description 自定义 shape 使用的 customInfo
75
132
  */
76
133
  export type GaugeCustomInfo = {
77
- /** 仪表盘 meter 类型的相关配置 */
134
+ /**
135
+ * @title 仪表盘 meter 类型的相关配置
136
+ */
78
137
  readonly meter?: GaugeOptions['meter'];
79
138
  };
@@ -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
- /** x 轴字段 */
10
+ /**
11
+ * @title x轴字段
12
+ */
8
13
  readonly xField: string;
9
- /** y 轴字段 */
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
- /** 热力格子中图形的尺寸比例,可选,只有当 shape 和 sizeField 至少指定一项后才生效 */
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
- /** size 对应的图例 */
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
- /** 贴图图案, 在 type="density" 时不支持 */
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
- * 设置直方图的分箱宽度,binWidth 影响直方图分成多少箱,
9
- * 不能与binNumber一起使用
11
+ * @title 设置直方图的分箱宽度
12
+ * @description binWidth 影响直方图分成多少箱,不能与binNumber一起使用
10
13
  */
11
14
  readonly binWidth?: number;
12
-
13
- /** 设置直方图的分箱数量,binNumber 影响直方图分箱后每个柱子的宽度 */
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
  }
@@ -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
- /** x 轴字段 */
14
+ /**
15
+ * @title x轴字段
16
+ */
13
17
  readonly xField?: string;
14
- /** y 轴字段 */
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
- /** 折线 shape 配置 */
45
+ /**
46
+ * @title 折线 shape 配置
47
+ */
27
48
  readonly lineShape?: Required<LineGeometryOptions>['line']['shape'];
28
- /** 折线数据点:1、图形映射属性 2、状态样式 */
49
+ /**
50
+ * @title 折线数据点
51
+ * @description 1、图形映射属性 2、状态样式
52
+ */
29
53
  readonly point?: PointGeometryOptions['point'] & Pick<PointGeometryOptions, 'state'>;
30
- /** 折线趋势填充色:1、图形映射属性 */
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
  }
@@ -8,6 +8,8 @@ import { getLiquidData } from './utils';
8
8
  // register liquid shape
9
9
  import './shapes/liquid';
10
10
 
11
+ export { addWaterWave } from './shapes/liquid';
12
+
11
13
  export type { LiquidOptions };
12
14
 
13
15
  /**
@@ -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,
@@ -215,16 +215,21 @@ function addWaterWave(
215
215
  waveLength: number,
216
216
  animation: LiquidOptions['animation']
217
217
  ) {
218
+ // 盒子属性 颜色 宽高
218
219
  const { fill, opacity } = waveAttrs;
219
220
  const bbox = clip.getBBox();
220
221
  const width = bbox.maxX - bbox.minX;
221
222
  const height = bbox.maxY - bbox.minY;
222
223
 
224
+ // 循环 waveCount 个数
223
225
  for (let idx = 0; idx < waveCount; idx++) {
224
226
  const factor = waveCount <= 1 ? 0 : idx / (waveCount - 1);
227
+
228
+ // 画波
225
229
  const wave = group.addShape('path', {
226
230
  name: `waterwave-path`,
227
231
  attrs: {
232
+ // 波形路径配置
228
233
  path: getWaterWavePath(
229
234
  radius,
230
235
  bbox.minY + height * level,
@@ -240,6 +245,7 @@ function addWaterWave(
240
245
  });
241
246
 
242
247
  try {
248
+ // 默认 underfind 开启动画
243
249
  if (animation === false) return;
244
250
  const matrix = transform([['t', waveLength, 0]]);
245
251
 
@@ -369,6 +375,14 @@ function rect(x: number, y: number, width: number, height: number) {
369
375
  `;
370
376
  }
371
377
 
378
+ const builtInShapeByName = {
379
+ pin,
380
+ circle,
381
+ diamond,
382
+ triangle,
383
+ rect,
384
+ };
385
+
372
386
  registerShape('interval', 'liquid-fill-gauge', {
373
387
  draw(cfg: any, container: IGroup) {
374
388
  const cx = 0.5;
@@ -399,13 +413,7 @@ registerShape('interval', 'liquid-fill-gauge', {
399
413
  const waveAttrs = getFillAttrs(cfg);
400
414
  const outlineAttrs = getLineAttrs(mix({}, cfg, outline));
401
415
  const innerRadius = radius - border / 2;
402
- const builtInShapeByName = {
403
- pin,
404
- circle,
405
- diamond,
406
- triangle,
407
- rect,
408
- };
416
+
409
417
  const buildPath = typeof shape === 'function' ? shape : builtInShapeByName[shape] || builtInShapeByName['circle'];
410
418
  const shapePath = buildPath(center.x, center.y, innerRadius * 2, innerRadius * 2);
411
419
 
@@ -1,48 +1,88 @@
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
- /** 外环的宽度,默认为 2px */
8
+ /**
9
+ * @title 外环的宽度
10
+ * @default "2px"
11
+ */
7
12
  readonly border: number;
8
- /** 内外的边距,默认为 0px */
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
- /** 波形的数量,默认为 3 */
27
+ /**
28
+ * @title 波形的数量
29
+ * @default 3
30
+ */
18
31
  readonly count: number;
19
- /** 波形的长度,默认是 192 */
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
- /** 水波的外半径, 0 ~ 1,默认为 0.9 */
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
- /** 波的形状配置('circle' | 'rect' | 'triangle' | 'diamond')*/
76
+ /**
77
+ * @title 波的形状配置
78
+ * @description ('circle' | 'rect' | 'triangle' | 'diamond')
79
+ */
42
80
  readonly shape?: string | ShapeCallback;
43
81
  }
44
82
 
45
- /** 水波图自定义 的 customInfo */
83
+ /**
84
+ * @title 水波图自定义 的 customInfo
85
+ */
46
86
  export type CustomInfo = {
47
87
  radius?: LiquidOptions['radius'];
48
88
  outline?: LiquidOptions['outline'];
@@ -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 的配置。暂时不开嵌套 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
- * 坐标系的配置,每一个 view 具有相同的坐标系
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
- * animation 配置
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
- * 支持使用已有的 plot,限定与指定 plot 类型
93
+ * @title 限定与指定 plot 类型
94
+ * @description 支持使用已有的 plot,限定与指定 plot 类型
99
95
  */
100
96
  readonly plots?: IPlot[];
101
-
102
97
  /**
103
- * tooltip 配置在 chart 层配置
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
  }