@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
@@ -1 +1 @@
1
- {"version":3,"file":"label.js","sourceRoot":"","sources":["../../src/types/label.ts"],"names":[],"mappings":"","sourcesContent":["import { Types } from '@antv/g2';\n\nexport type Label =\n | false\n | ({\n /** 映射的字段。 */\n readonly fields?: string[];\n /** 回调函数。 */\n readonly callback?: Types.LabelCallback;\n /** 功能同 content ,兼容 v1 */\n readonly formatter?: Types.GeometryLabelCfg['content'];\n } & Types.GeometryLabelCfg);\n"]}
1
+ {"version":3,"file":"label.js","sourceRoot":"","sources":["../../src/types/label.ts"],"names":[],"mappings":"","sourcesContent":["import { Types } from '@antv/g2';\n\nexport type Label =\n | false\n | ({\n /**\n * @title 映射的字段\n */\n readonly fields?: string[];\n /**\n * @title 回调函数\n * @description 回调函数,返回相关点 value\n */\n readonly callback?: Types.LabelCallback;\n /**\n * @title 格式化\n * @description 功能同 content ,兼容 v1,一般用于自定义。\n */\n readonly formatter?: Types.GeometryLabelCfg['content'];\n } & Types.GeometryLabelCfg);\n"]}
@@ -2,16 +2,13 @@ import { ScaleConfig } from '@antv/g2';
2
2
  /** scale 元信息,取名为 meta */
3
3
  export declare type Meta = ScaleConfig & {
4
4
  /**
5
- * scale 的 type 类型
6
- * 对于连续的,一般是 linear,对于分类一般为 cat。
7
- * 当然也有 log, pow, time 等类型,或者通过 tickMethod 自定义自己的 scale
5
+ * @title mescale 的 type 类型ta
6
+ * @description 对于连续的,一般是 linear,对于分类一般为 cat。当然也有 log, pow, time 等类型,或者通过 tickMethod 自定义自己的 scale
8
7
  */
9
8
  readonly type?: string;
10
9
  /**
11
- * 是否进行 scale 的同步。
12
- * - 设置为 false 则不同步
13
- * - 设置为 true 则以 field 为 key 进行同步
14
- * - 设置为 string,则以这个 string 为 key 进行同步
10
+ * @title 是否进行 scale 的同步
11
+ * @description 设置为 false 则不同步; 设置为 true 则以 field 为 key 进行同步;设置为 string,则以这个 string 为 key 进行同步
15
12
  */
16
13
  readonly sync?: boolean | string;
17
14
  };
@@ -1 +1 @@
1
- {"version":3,"file":"meta.js","sourceRoot":"","sources":["../../src/types/meta.ts"],"names":[],"mappings":"","sourcesContent":["import { ScaleConfig } from '@antv/g2';\n\n/** scale 元信息,取名为 meta */\nexport type Meta = ScaleConfig & {\n /**\n * scale 的 type 类型\n * 对于连续的,一般是 linear,对于分类一般为 cat。\n * 当然也有 log, pow, time 等类型,或者通过 tickMethod 自定义自己的 scale\n */\n readonly type?: string;\n /**\n * 是否进行 scale 的同步。\n * - 设置为 false 则不同步\n * - 设置为 true 则以 field 为 key 进行同步\n * - 设置为 string,则以这个 string 为 key 进行同步\n */\n readonly sync?: boolean | string;\n};\n"]}
1
+ {"version":3,"file":"meta.js","sourceRoot":"","sources":["../../src/types/meta.ts"],"names":[],"mappings":"","sourcesContent":["import { ScaleConfig } from '@antv/g2';\n\n/** scale 元信息,取名为 meta */\nexport type Meta = ScaleConfig & {\n /**\n * @title mescale 的 type 类型ta\n * @description 对于连续的,一般是 linear,对于分类一般为 cat。当然也有 log, pow, time 等类型,或者通过 tickMethod 自定义自己的 scale\n */\n readonly type?: string;\n /**\n * @title 是否进行 scale 的同步\n * @description 设置为 false 则不同步; 设置为 true 则以 field 为 key 进行同步;设置为 string,则以这个 string 为 key 进行同步\n */\n readonly sync?: boolean | string;\n};\n"]}
@@ -1,47 +1,87 @@
1
1
  export declare type PatternCfg = {
2
- /** pattern background color. Default: inherit (默认: 继承图形元素颜色) */
2
+ /**
3
+ * @title 背景色
4
+ * @description pattern background color. Default: inherit (默认: 继承图形元素颜色)
5
+ * @default "inherit"
6
+ */
3
7
  backgroundColor?: string;
4
- /** pattern fill color. 贴图图案填充色 */
8
+ /**
9
+ * @title 贴图图案填充色
10
+ */
5
11
  fill?: string;
6
- /** 填充透明度 */
12
+ /**
13
+ * @title 填充透明度
14
+ */
7
15
  fillOpacity?: number;
8
- /** pattern stroke color. 贴图图案描边色 */
16
+ /**
17
+ * @title 描边色
18
+ * @description 贴图图案描边色
19
+ */
9
20
  stroke?: string;
10
- /** 描边透明度 */
21
+ /**
22
+ * @title 描边透明度
23
+ */
11
24
  strokeOpacity?: number;
12
- /** lines thickness. 描边粗细 */
25
+ /**
26
+ * @title 描边粗细
27
+ */
13
28
  lineWidth?: number;
14
- /** 整个pattern 透明度 */
29
+ /**
30
+ * @title 透明度
31
+ * @description 整个pattern 透明度
32
+ */
15
33
  opacity?: number;
16
- /** 整个pattern 的旋转角度 */
34
+ /**
35
+ * @title 旋转角度
36
+ * @description 整个pattern 的旋转角度
37
+ */
17
38
  rotation?: number;
18
39
  };
19
40
  /**
20
- * dot pattern
41
+ * @title dot pattern
21
42
  */
22
43
  export declare type DotPatternCfg = PatternCfg & {
23
- /** 点的大小, 默认: 4 */
44
+ /**
45
+ * @title 点的大小
46
+ * @default 4
47
+ */
24
48
  size?: number;
25
- /** padding between dots, 默认: 4 */
49
+ /**
50
+ * @title 点间距
51
+ * @default 4
52
+ */
26
53
  padding?: number;
27
- /** 是否交错,默认: true. 即 staggered dots. */
54
+ /**
55
+ * @title 是否交错
56
+ * @default true
57
+ */
28
58
  isStagger?: boolean;
29
59
  };
30
60
  /**
31
- * line pattern
61
+ * @title line pattern
32
62
  */
33
63
  export declare type LinePatternCfg = PatternCfg & {
34
- /** pacing between lines. 线之间的距离 */
64
+ /**
65
+ * @title 线之间的距离
66
+ */
35
67
  spacing?: number;
36
68
  };
37
69
  /**
38
- * square pattern
70
+ * @title square pattern
39
71
  */
40
72
  export declare type SquarePatternCfg = PatternCfg & {
41
- /** 矩形的大小 */
73
+ /**
74
+ * @title 矩形的大小
75
+ */
42
76
  size?: number;
43
- /** 矩形之间的间隔 */
77
+ /**
78
+ * @title 矩形之间的间隔
79
+ */
44
80
  padding?: number;
45
- /** 是否交错,默认: true. 即 staggered squares. */
81
+ /**
82
+ * @title 是否交错
83
+ * @description 即 staggered squares.
84
+ * @default true
85
+ */
46
86
  isStagger?: boolean;
47
87
  };
@@ -1 +1 @@
1
- {"version":3,"file":"pattern.js","sourceRoot":"","sources":["../../src/types/pattern.ts"],"names":[],"mappings":"","sourcesContent":["export type PatternCfg = {\n /** pattern background color. Default: inherit (默认: 继承图形元素颜色) */\n backgroundColor?: string;\n /** pattern fill color. 贴图图案填充色 */\n fill?: string;\n /** 填充透明度 */\n fillOpacity?: number;\n /** pattern stroke color. 贴图图案描边色 */\n stroke?: string;\n /** 描边透明度 */\n strokeOpacity?: number;\n /** lines thickness. 描边粗细 */\n lineWidth?: number;\n /** 整个pattern 透明度 */\n opacity?: number;\n /** 整个pattern 的旋转角度 */\n rotation?: number;\n};\n\n/**\n * dot pattern\n */\nexport type DotPatternCfg = PatternCfg & {\n /** 点的大小, 默认: 4 */\n size?: number;\n /** padding between dots, 默认: 4 */\n padding?: number;\n /** 是否交错,默认: true. 即 staggered dots. */\n isStagger?: boolean;\n};\n\n/**\n * line pattern\n */\nexport type LinePatternCfg = PatternCfg & {\n /** pacing between lines. 线之间的距离 */\n spacing?: number;\n};\n\n/**\n * square pattern\n */\nexport type SquarePatternCfg = PatternCfg & {\n /** 矩形的大小 */\n size?: number;\n /** 矩形之间的间隔 */\n padding?: number;\n /** 是否交错,默认: true. 即 staggered squares. */\n isStagger?: boolean;\n};\n"]}
1
+ {"version":3,"file":"pattern.js","sourceRoot":"","sources":["../../src/types/pattern.ts"],"names":[],"mappings":"","sourcesContent":["export type PatternCfg = {\n /**\n * @title 背景色\n * @description pattern background color. Default: inherit (默认: 继承图形元素颜色)\n * @default \"inherit\"\n */\n backgroundColor?: string;\n /**\n * @title 贴图图案填充色\n */\n fill?: string;\n /**\n * @title 填充透明度\n */\n fillOpacity?: number;\n /**\n * @title 描边色\n * @description 贴图图案描边色\n */\n stroke?: string;\n /**\n * @title 描边透明度\n */\n strokeOpacity?: number;\n /**\n * @title 描边粗细\n */\n lineWidth?: number;\n /**\n * @title 透明度\n * @description 整个pattern 透明度\n */\n opacity?: number;\n /**\n * @title 旋转角度\n * @description 整个pattern 的旋转角度\n */\n rotation?: number;\n};\n\n/**\n * @title dot pattern\n */\nexport type DotPatternCfg = PatternCfg & {\n /**\n * @title 点的大小\n * @default 4\n */\n size?: number;\n /**\n * @title 点间距\n * @default 4\n */\n padding?: number;\n /**\n * @title 是否交错\n * @default true\n */\n isStagger?: boolean;\n};\n\n/**\n * @title line pattern\n */\nexport type LinePatternCfg = PatternCfg & {\n /**\n * @title 线之间的距离\n */\n spacing?: number;\n};\n\n/**\n * @title square pattern\n */\nexport type SquarePatternCfg = PatternCfg & {\n /**\n * @title 矩形的大小\n */\n size?: number;\n /**\n * @title 矩形之间的间隔\n */\n padding?: number;\n /**\n * @title 是否交错\n * @description 即 staggered squares.\n * @default true\n */\n isStagger?: boolean;\n};\n"]}
@@ -1,11 +1,19 @@
1
1
  import { Types, Element, Geometry } from '@antv/g2';
2
2
  import { Datum, Data } from './common';
3
3
  export declare type State = Types.StateOption;
4
- /** 状态名称,G2 Element 开放 'active' | 'inactive' | 'selected' | 'default' 四种状态 */
4
+ /**
5
+ * @title 状态名称
6
+ * @description G2 Element 开放 'active' | 'inactive' | 'selected' | 'default' 四种状态
7
+ */
5
8
  export declare type StateName = 'active' | 'inactive' | 'selected' | 'default';
6
- /** 状态条件 */
9
+ /**
10
+ * @title 状态条件
11
+ */
7
12
  export declare type StateCondition = (data: Datum | Data) => boolean;
8
- /** 状态对象, 可通过 `plot.getStates()` 获取 */
13
+ /**
14
+ * @title 状态对象
15
+ * @description 可通过 `plot.getStates()` 获取
16
+ */
9
17
  export declare type StateObject = {
10
18
  data: Datum | Data;
11
19
  state: string;
@@ -1 +1 @@
1
- {"version":3,"file":"state.js","sourceRoot":"","sources":["../../src/types/state.ts"],"names":[],"mappings":"","sourcesContent":["import { Types, Element, Geometry } from '@antv/g2';\nimport { Datum, Data } from './common';\n\nexport type State = Types.StateOption;\n\n/** 状态名称,G2 Element 开放 'active' | 'inactive' | 'selected' | 'default' 四种状态 */\nexport type StateName = 'active' | 'inactive' | 'selected' | 'default';\n\n/** 状态条件 */\nexport type StateCondition = (data: Datum | Data) => boolean;\n\n/** 状态对象, 可通过 `plot.getStates()` 获取 */\nexport type StateObject = { data: Datum | Data; state: string; geometry: Geometry; element: Element };\n"]}
1
+ {"version":3,"file":"state.js","sourceRoot":"","sources":["../../src/types/state.ts"],"names":[],"mappings":"","sourcesContent":["import { Types, Element, Geometry } from '@antv/g2';\nimport { Datum, Data } from './common';\n\nexport type State = Types.StateOption;\n\n/**\n * @title 状态名称\n * @description G2 Element 开放 'active' | 'inactive' | 'selected' | 'default' 四种状态\n */\nexport type StateName = 'active' | 'inactive' | 'selected' | 'default';\n\n/**\n * @title 状态条件\n */\nexport type StateCondition = (data: Datum | Data) => boolean;\n\n/**\n * @title 状态对象\n * @description 可通过 `plot.getStates()` 获取\n */\nexport type StateObject = { data: Datum | Data; state: string; geometry: Geometry; element: Element };\n"]}
@@ -1,32 +1,64 @@
1
1
  import { View } from '@antv/g2';
2
2
  import { Data, Datum } from './common';
3
3
  declare type CSSStyle = Omit<Partial<CSSStyleDeclaration>, 'opacity' | 'fontWeight' | 'lineHeight'> & {
4
+ /**
5
+ * @title 透明度
6
+ */
4
7
  opacity?: number;
8
+ /**
9
+ * @title 字体粗细程度
10
+ */
5
11
  fontWeight?: string | number;
12
+ /**
13
+ * @title 行高
14
+ */
6
15
  lineHeight?: string | number;
7
16
  };
8
17
  /**
9
- * 统计文本
10
- * - 支持三种设置模式(优先级):customHtml > formatter > content
18
+ * @title 统计文本
19
+ * @description 支持三种设置模式(优先级):customHtml > formatter > content
11
20
  */
12
21
  export declare type StatisticText = {
13
- /** 统计文本的样式 */
22
+ /**
23
+ * @title 统计文本的样式
24
+ */
14
25
  readonly style?: CSSStyle | ((datum: Datum) => CSSStyle);
15
- /** 文本内容 */
26
+ /**
27
+ * @title 文本内容
28
+ */
16
29
  readonly content?: string;
17
- /** 文本的格式化 */
30
+ /**
31
+ * @title 文本的格式化
32
+ */
18
33
  readonly formatter?: (datum?: Datum, data?: Data /** filterData */) => string;
19
- /** 自定义中心文本的 html */
34
+ /**
35
+ * @title 自定义中心文本的 html
36
+ */
20
37
  readonly customHtml?: (container: HTMLElement, view: View, datum?: Datum, data?: Data /** filterData */) => string;
38
+ /**
39
+ * @title 旋转弧度
40
+ */
21
41
  readonly rotate?: number;
42
+ /**
43
+ * @title 横轴偏移值
44
+ */
22
45
  readonly offsetX?: number;
46
+ /**
47
+ * @title 纵轴偏移值
48
+ */
23
49
  readonly offsetY?: number;
24
50
  };
25
51
  /**
26
52
  * 中心文本的统计信息,统一一个数据结构
27
53
  */
28
54
  export declare type Statistic = {
55
+ /**
56
+ * @title 标题
57
+ */
29
58
  readonly title?: false | StatisticText;
59
+ /**
60
+ * @title 内容
61
+ */
30
62
  readonly content?: false | StatisticText;
31
63
  };
32
64
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"statistic.js","sourceRoot":"","sources":["../../src/types/statistic.ts"],"names":[],"mappings":"","sourcesContent":["import { View } from '@antv/g2';\nimport { Data, Datum } from './common';\n\ntype CSSStyle = Omit<Partial<CSSStyleDeclaration>, 'opacity' | 'fontWeight' | 'lineHeight'> & {\n opacity?: number;\n fontWeight?: string | number;\n lineHeight?: string | number;\n};\n\n/**\n * 统计文本\n * - 支持三种设置模式(优先级):customHtml > formatter > content\n */\nexport type StatisticText = {\n /** 统计文本的样式 */\n readonly style?: CSSStyle | ((datum: Datum) => CSSStyle);\n /** 文本内容 */\n readonly content?: string;\n /** 文本的格式化 */\n readonly formatter?: (datum?: Datum, data?: Data /** filterData */) => string;\n /** 自定义中心文本的 html */\n readonly customHtml?: (container: HTMLElement, view: View, datum?: Datum, data?: Data /** filterData */) => string;\n readonly rotate?: number;\n readonly offsetX?: number;\n readonly offsetY?: number;\n};\n\n/**\n * 中心文本的统计信息,统一一个数据结构\n */\nexport type Statistic = {\n readonly title?: false | StatisticText;\n readonly content?: false | StatisticText;\n};\n"]}
1
+ {"version":3,"file":"statistic.js","sourceRoot":"","sources":["../../src/types/statistic.ts"],"names":[],"mappings":"","sourcesContent":["import { View } from '@antv/g2';\nimport { Data, Datum } from './common';\n\ntype CSSStyle = Omit<Partial<CSSStyleDeclaration>, 'opacity' | 'fontWeight' | 'lineHeight'> & {\n /**\n * @title 透明度\n */\n opacity?: number;\n /**\n * @title 字体粗细程度\n */\n fontWeight?: string | number;\n /**\n * @title 行高\n */\n lineHeight?: string | number;\n};\n\n/**\n * @title 统计文本\n * @description 支持三种设置模式(优先级):customHtml > formatter > content\n */\nexport type StatisticText = {\n /**\n * @title 统计文本的样式\n */\n readonly style?: CSSStyle | ((datum: Datum) => CSSStyle);\n /**\n * @title 文本内容\n */\n readonly content?: string;\n /**\n * @title 文本的格式化\n */\n readonly formatter?: (datum?: Datum, data?: Data /** filterData */) => string;\n /**\n * @title 自定义中心文本的 html\n */\n readonly customHtml?: (container: HTMLElement, view: View, datum?: Datum, data?: Data /** filterData */) => string;\n /**\n * @title 旋转弧度\n */\n readonly rotate?: number;\n /**\n * @title 横轴偏移值\n */\n readonly offsetX?: number;\n /**\n * @title 纵轴偏移值\n */\n readonly offsetY?: number;\n};\n\n/**\n * 中心文本的统计信息,统一一个数据结构\n */\nexport type Statistic = {\n /**\n * @title 标题\n */\n readonly title?: false | StatisticText;\n /**\n * @title 内容\n */\n readonly content?: false | StatisticText;\n};\n"]}
@@ -1,9 +1,14 @@
1
1
  import { Types } from '@antv/g2';
2
2
  import { TooltipAttr } from '../types/attr';
3
3
  export declare type TooltipMapping = {
4
- /** 指定需要显示 tooltip 中的字段,默认是包含 x seriesFields y */
4
+ /**
5
+ * @title 映射字段
6
+ * @description 指定需要显示 tooltip 中的字段,默认是包含 x seriesFields y
7
+ */
5
8
  readonly fields?: string[] | false;
6
- /** value 格式化 **/
9
+ /**
10
+ * @title value 格式化
11
+ */
7
12
  readonly formatter?: TooltipAttr;
8
13
  };
9
14
  export declare type TooltipOptions = Types.TooltipCfg & TooltipMapping;
@@ -1 +1 @@
1
- {"version":3,"file":"tooltip.js","sourceRoot":"","sources":["../../src/types/tooltip.ts"],"names":[],"mappings":"","sourcesContent":["import { Types } from '@antv/g2';\nimport { TooltipAttr } from '../types/attr';\n\nexport type TooltipMapping = {\n /** 指定需要显示 tooltip 中的字段,默认是包含 x seriesFields y */\n readonly fields?: string[] | false;\n /** value 格式化 **/\n readonly formatter?: TooltipAttr;\n};\n\nexport type TooltipOptions = Types.TooltipCfg & TooltipMapping;\n\nexport type Tooltip = false | TooltipOptions;\n"]}
1
+ {"version":3,"file":"tooltip.js","sourceRoot":"","sources":["../../src/types/tooltip.ts"],"names":[],"mappings":"","sourcesContent":["import { Types } from '@antv/g2';\nimport { TooltipAttr } from '../types/attr';\n\nexport type TooltipMapping = {\n /**\n * @title 映射字段\n * @description 指定需要显示 tooltip 中的字段,默认是包含 x seriesFields y\n */\n readonly fields?: string[] | false;\n /**\n * @title value 格式化\n */\n readonly formatter?: TooltipAttr;\n};\n\nexport type TooltipOptions = Types.TooltipCfg & TooltipMapping;\n\nexport type Tooltip = false | TooltipOptions;\n"]}
@@ -26,7 +26,7 @@ function percent(data, measure, groupField, as) {
26
26
  var _a;
27
27
  var v = datum[measure];
28
28
  var groupValue = datum[groupField];
29
- var percentage = number_1.isRealNumber(v) ? v / sumMap.get(groupValue) : 0;
29
+ var percentage = number_1.isRealNumber(v) && sumMap.get(groupValue) !== 0 ? v / sumMap.get(groupValue) : 0;
30
30
  return tslib_1.__assign(tslib_1.__assign({}, datum), (_a = {}, _a[as] = percentage, _a));
31
31
  });
32
32
  }
@@ -54,7 +54,7 @@ function getDeepPercent(data, measure, fields, percent) {
54
54
  var v = datum[measure];
55
55
  // 获取分组得到的枚举key值
56
56
  var groupValue = util_1.reduce(fields, function (value, field) { return "" + value + datum[field]; }, '');
57
- var percentage = number_1.isRealNumber(v) ? v / sumMap.get(groupValue) : 0;
57
+ var percentage = number_1.isRealNumber(v) && sumMap.get(groupValue) !== 0 ? v / sumMap.get(groupValue) : 0;
58
58
  return tslib_1.__assign(tslib_1.__assign({}, datum), (_a = {}, _a[percent] = percentage, _a));
59
59
  });
60
60
  }
@@ -1 +1 @@
1
- {"version":3,"file":"percent.js","sourceRoot":"","sources":["../../../src/utils/transform/percent.ts"],"names":[],"mappings":"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","sourcesContent":["import { map, reduce } from '@antv/util';\nimport { Data, Datum } from '../../types';\nimport { isRealNumber } from '../number';\n\n/**\n * 对数据进行百分比化\n * @param data\n * @param measure\n * @param groupField\n * @param as\n */\nexport function percent(data: Data, measure: string, groupField: string, as: string) {\n // 1. 先计算每一个分组的 max 值\n const sumMap = reduce(\n data,\n (map, datum: Datum) => {\n const groupValue = datum[groupField];\n let sum = map.has(groupValue) ? map.get(groupValue) : 0;\n\n const v = datum[measure];\n\n sum = isRealNumber(v) ? sum + v : sum;\n map.set(groupValue, sum);\n\n return map;\n },\n new Map<string, number>()\n );\n\n // 2. 循环数组,计算占比\n return map(data, (datum: Datum) => {\n const v = datum[measure];\n const groupValue = datum[groupField];\n const percentage = isRealNumber(v) ? v / sumMap.get(groupValue) : 0;\n\n return {\n ...datum,\n [as]: percentage,\n };\n });\n}\n\n/**\n * 对数据进行深层百分比化\n * @param data\n * @param measure // 数值\n * @param fields // 需要分组的 field值\n * @param as // 存储percent 百分比的值\n */\nexport function getDeepPercent(data: Record<string, any>[], measure: string, fields: string[], percent: string) {\n const sumMap = reduce(\n data,\n (map, datum: Datum) => {\n // 获取分组得到的枚举key值\n const groupValue = reduce(fields, (value, field) => `${value}${datum[field]}`, '');\n\n let sum = map.has(groupValue) ? map.get(groupValue) : 0;\n\n const v = datum[measure];\n\n sum = isRealNumber(v) ? sum + v : sum;\n map.set(groupValue, sum);\n\n return map;\n },\n new Map<string, number>()\n );\n\n // 2. 循环数组,计算占比\n return map(data, (datum: Datum) => {\n const v = datum[measure];\n // 获取分组得到的枚举key值\n const groupValue = reduce(fields, (value, field) => `${value}${datum[field]}`, '');\n\n const percentage = isRealNumber(v) ? v / sumMap.get(groupValue) : 0;\n\n return {\n ...datum,\n [percent]: percentage,\n };\n });\n}\n\n/**\n * 获取数据,如果是百分比,进行数据转换 (适用于面积图、柱状图、条形图)\n * @param isPercent 是否百分比\n */\nexport function getDataWhetherPecentage(\n data: Record<string, any>[],\n yField: string,\n groupField: string,\n asField: string,\n isPercent?: boolean\n) {\n return !isPercent ? data : percent(data, yField, groupField, asField);\n}\n"]}
1
+ {"version":3,"file":"percent.js","sourceRoot":"","sources":["../../../src/utils/transform/percent.ts"],"names":[],"mappings":"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","sourcesContent":["import { map, reduce } from '@antv/util';\nimport { Data, Datum } from '../../types';\nimport { isRealNumber } from '../number';\n\n/**\n * 对数据进行百分比化\n * @param data\n * @param measure\n * @param groupField\n * @param as\n */\nexport function percent(data: Data, measure: string, groupField: string, as: string) {\n // 1. 先计算每一个分组的 max 值\n const sumMap = reduce(\n data,\n (map, datum: Datum) => {\n const groupValue = datum[groupField];\n let sum = map.has(groupValue) ? map.get(groupValue) : 0;\n\n const v = datum[measure];\n\n sum = isRealNumber(v) ? sum + v : sum;\n map.set(groupValue, sum);\n\n return map;\n },\n new Map<string, number>()\n );\n\n // 2. 循环数组,计算占比\n return map(data, (datum: Datum) => {\n const v = datum[measure];\n const groupValue = datum[groupField];\n const percentage = isRealNumber(v) && sumMap.get(groupValue) !== 0 ? v / sumMap.get(groupValue) : 0;\n\n return {\n ...datum,\n [as]: percentage,\n };\n });\n}\n\n/**\n * 对数据进行深层百分比化\n * @param data\n * @param measure // 数值\n * @param fields // 需要分组的 field值\n * @param as // 存储percent 百分比的值\n */\nexport function getDeepPercent(data: Record<string, any>[], measure: string, fields: string[], percent: string) {\n const sumMap = reduce(\n data,\n (map, datum: Datum) => {\n // 获取分组得到的枚举key值\n const groupValue = reduce(fields, (value, field) => `${value}${datum[field]}`, '');\n\n let sum = map.has(groupValue) ? map.get(groupValue) : 0;\n\n const v = datum[measure];\n\n sum = isRealNumber(v) ? sum + v : sum;\n map.set(groupValue, sum);\n\n return map;\n },\n new Map<string, number>()\n );\n\n // 2. 循环数组,计算占比\n return map(data, (datum: Datum) => {\n const v = datum[measure];\n // 获取分组得到的枚举key值\n const groupValue = reduce(fields, (value, field) => `${value}${datum[field]}`, '');\n\n const percentage = isRealNumber(v) && sumMap.get(groupValue) !== 0 ? v / sumMap.get(groupValue) : 0;\n\n return {\n ...datum,\n [percent]: percentage,\n };\n });\n}\n\n/**\n * 获取数据,如果是百分比,进行数据转换 (适用于面积图、柱状图、条形图)\n * @param isPercent 是否百分比\n */\nexport function getDataWhetherPecentage(\n data: Record<string, any>[],\n yField: string,\n groupField: string,\n asField: string,\n isPercent?: boolean\n) {\n return !isPercent ? data : percent(data, yField, groupField, asField);\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antv/g2plot",
3
- "version": "2.4.7",
3
+ "version": "2.4.10",
4
4
  "description": "An interactive and responsive charting library",
5
5
  "keywords": [
6
6
  "chart",
package/src/core/plot.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Chart, Event, Element } from '@antv/g2';
1
+ import { Chart, Event, Element, View } from '@antv/g2';
2
2
  import { each } from '@antv/util';
3
3
  import EE from '@antv/event-emitter';
4
4
  import { bind } from 'size-sensor';
@@ -241,9 +241,10 @@ export abstract class Plot<O extends PickOptions> extends EE {
241
241
  /**
242
242
  * 增加图表标注。通过 id 标识,如果匹配到,就做更新
243
243
  */
244
- public addAnnotations(annotations: Annotation[]): void {
244
+ public addAnnotations(annotations: Annotation[], view?: View): void {
245
+ view = view ? view : this.chart;
245
246
  const incoming = [...annotations];
246
- const controller = this.chart.getController('annotation');
247
+ const controller = view.getController('annotation');
247
248
  const current = controller.getComponents().map((co) => co.extra);
248
249
 
249
250
  controller.clear(true);
@@ -259,7 +260,7 @@ export abstract class Plot<O extends PickOptions> extends EE {
259
260
  }
260
261
 
261
262
  incoming.forEach((annotation) => controller.annotation(annotation));
262
- this.chart.render(true);
263
+ view.render(true);
263
264
  }
264
265
 
265
266
  /**
package/src/index.ts CHANGED
@@ -1,4 +1,4 @@
1
- export const version = '2.4.7';
1
+ export const version = '2.4.10';
2
2
 
3
3
  // G2 自定义能力透出
4
4
  import * as G2 from '@antv/g2';
@@ -115,7 +115,7 @@ export { Funnel, FUNNEL_CONVERSATION_FIELD } from './plots/funnel';
115
115
  export type { FunnelOptions } from './plots/funnel';
116
116
 
117
117
  // 水波图及类型定义 | author by [CarisL](https://github.com/CarisL), [hustcc](https://github.com/hustcc), [pearmini](https://github.com/pearmini)
118
- export { Liquid } from './plots/liquid';
118
+ export { Liquid, addWaterWave } from './plots/liquid';
119
119
  export type { LiquidOptions } from './plots/liquid';
120
120
 
121
121
  // 子弹图及类型定义 | author by [arcsin1](https://github.com/arcsin1)
@@ -3,24 +3,49 @@ import { Options, StyleAttr } from '../../types';
3
3
 
4
4
  /** 面积图的配置类型定义 */
5
5
  export interface AreaOptions extends Options, Pick<GeometryOptions, 'customInfo'> {
6
- /** x 轴字段 */
6
+ /**
7
+ * @title x轴字段
8
+ */
7
9
  readonly xField?: string;
8
- /** y 轴字段 */
10
+ /**
11
+ * @title y轴字段
12
+ */
9
13
  readonly yField?: string;
10
- /** 分组字段 */
14
+ /**
15
+ * @title 分组字段
16
+ */
11
17
  readonly seriesField?: string;
12
- /** 是否堆积 */
18
+ /**
19
+ * @title 是否配置堆积
20
+ * @default false
21
+ */
13
22
  readonly isStack?: boolean;
14
- /** 是否百分比 */
23
+ /**
24
+ * @title 是否配置百分比
25
+ * @default false
26
+ */
15
27
  readonly isPercent?: boolean;
16
- /** 是否平滑 */
28
+ /**
29
+ * @title 是否配置平滑
30
+ * @default false
31
+ */
17
32
  readonly smooth?: boolean;
18
- /** 面积图形样式 */
33
+ /**
34
+ * @title 面积图形样式
35
+ */
19
36
  readonly areaStyle?: StyleAttr;
20
- /** 面积中折线的样式 */
37
+ /**
38
+ * @title 面积中折线的样式
39
+ */
21
40
  readonly line?: LineGeometryOptions['line'] & Pick<PointGeometryOptions, 'state'>;
22
- /** 面积图数据点图形样式 */
41
+ /**
42
+ * @title 面积图数据点图形样式
43
+ */
23
44
  readonly point?: PointGeometryOptions['point'] & Pick<PointGeometryOptions, 'state'>;
24
- /** 积图是否从 0 基准线开始填充 */
45
+ /**
46
+ * @title 面积图填充
47
+ * @description 面积图是否从 0 基准线开始填充
48
+ * @default false
49
+ */
25
50
  readonly startOnZero?: boolean;
26
51
  }
@@ -3,12 +3,25 @@ import { ColumnOptions } from '../column/types';
3
3
  // rename column to bar
4
4
  export interface BarOptions
5
5
  extends Omit<ColumnOptions, 'columnStyle' | 'columnWidthRatio' | 'minColumnWidth' | 'maxColumnWidth'> {
6
+ /**
7
+ * @title 柱状图柱子样式配置
8
+ */
6
9
  readonly barStyle?: ColumnOptions['columnStyle'];
10
+ /**
11
+ * @title 柱状图宽度占比
12
+ * @description 范围[0-1]
13
+ */
7
14
  readonly barWidthRatio?: ColumnOptions['columnWidthRatio'];
8
- /** 条形图最小宽度(像素) */
15
+ /**
16
+ * @title 条形图最小宽度(像素)
17
+ */
9
18
  readonly minBarWidth?: ColumnOptions['minColumnWidth'];
10
- /** 条形图最大宽度(像素) */
19
+ /**
20
+ * @title 条形图最大宽度(像素)
21
+ */
11
22
  readonly maxBarWidth?: ColumnOptions['maxColumnWidth'];
12
- /** 条形图柱子的背景 */
23
+ /**
24
+ * @title 条形图柱子的背景配置
25
+ */
13
26
  readonly barBackground?: ColumnOptions['columnBackground'];
14
27
  }
@@ -2,20 +2,35 @@ import { Axis } from '../../types/axis';
2
2
  import { Options, StyleAttr } from '../../types';
3
3
 
4
4
  export interface BidirectionalBarOptions extends Omit<Options, 'yAxis' | 'yField'> {
5
- /** x 轴字段 */
5
+ /**
6
+ * @title x轴字段
7
+ */
6
8
  readonly xField: string;
7
- /** y 轴映射字段 */
9
+ /**
10
+ * @title y轴字段
11
+ */
8
12
  readonly yField: [string, string];
9
- /** yAxis 为多个 key 为 yField 里面的 2 个字段 */
13
+ /**
14
+ * @title yAxis
15
+ * @description yAxis 为多个 key 为 yField 里面的 2 个字段
16
+ */
10
17
  readonly yAxis?:
11
18
  | false
12
19
  | {
13
20
  [key: string]: Axis;
14
21
  };
15
- /** 柱状图宽度占比 [0-1] */
22
+ /**
23
+ * @title 柱状图宽度占比
24
+ * @description 范围[0-1]
25
+ */
16
26
  readonly widthRatio?: number;
17
- /** 柱子样式配置,可选 */
27
+ /**
28
+ * @title 柱状图柱子样式
29
+ */
18
30
  readonly barStyle?: StyleAttr;
19
- /** layout 方向选择,默认水平 horizontal*/
31
+ /**
32
+ * @title 布局方向选择
33
+ * @default "horizontal"
34
+ */
20
35
  readonly layout?: 'horizontal' | 'vertical';
21
36
  }
@@ -1,16 +1,30 @@
1
1
  import { Options, StyleAttr } from '../../types';
2
2
 
3
3
  export interface BoxOptions extends Options {
4
- /** x 轴字段 */
4
+ /**
5
+ * @title x轴字段
6
+ */
5
7
  readonly xField: string;
6
- /** y 轴映射 box range [low, q1, median, q3, high] 五个字段 or 一个数组字段 */
8
+ /**
9
+ * @title y轴映射
10
+ * @descriptionbox range [low, q1, median, q3, high] 五个字段 or 一个数组字段
11
+ */
7
12
  readonly yField: string | [string?, string?, string?, string?, string?];
8
- /** 箱型样式配置,可选 */
13
+ /**
14
+ * @title 箱型样式
15
+ */
9
16
  readonly boxStyle?: StyleAttr;
10
- /** 分组拆分字段,默认是分组情况,颜色作为视觉通道 */
17
+ /**
18
+ * @title 分组拆分字段
19
+ * @default 分组情况,颜色作为视觉通道
20
+ */
11
21
  readonly groupField?: string;
12
- /** 异常值字段 */
22
+ /**
23
+ * @title 异常值字段
24
+ */
13
25
  readonly outliersField?: string;
14
- /** 异常值样式 */
26
+ /**
27
+ * @title 异常值样式
28
+ */
15
29
  readonly outliersStyle?: StyleAttr;
16
30
  }
@@ -9,30 +9,49 @@ type BulletAttr<T> = {
9
9
  range?: T;
10
10
  };
11
11
  export interface BulletOptions extends Omit<Options, 'color' | 'label' | 'style'> {
12
- /** 弹图标题,用于区分不同的类型 */
12
+ /**
13
+ * @title 弹图标题
14
+ * @description 用于区分不同的类型
15
+ */
13
16
  readonly xField?: string;
14
-
15
- /** 使用数据条的长度,表示实际数值字段,所表示值为 number[]*/
17
+ /**
18
+ * @title 测量字段
19
+ * @description 使用数据条的长度,表示实际数值字段,所表示值为 number[]
20
+ */
16
21
  readonly measureField: string;
17
-
18
- /** 使用背景色条的长度,表示区间范围 [20,50,100], 所表示值为 number[]*/
22
+ /**
23
+ * @title 范围字段
24
+ * @description 使用背景色条的长度,表示区间范围 [20,50,100], 所表示值为 number[]
25
+ */
19
26
  readonly rangeField: string;
20
-
21
- /** 使用测量标记的刻度轴位置,表示目标值,所表示值为数值 */
27
+ /**
28
+ * @title 目标字段
29
+ * @description 使用测量标记的刻度轴位置,表示目标值,所表示值为数值
30
+ */
22
31
  readonly targetField: string;
23
-
24
- /** label 包含了 measure,target,range */
32
+ /**
33
+ * @title 标签
34
+ * @description 包含了 measure,target,range
35
+ */
25
36
  readonly label?: BulletAttr<GeometryLabelAttr | false>;
26
-
27
- /** size 包含了 measure,target,range */
37
+ /**
38
+ * @title 尺寸
39
+ * @description 包含了 measure,target,range
40
+ */
28
41
  readonly size?: BulletAttr<SizeAttr>;
29
-
30
- /** color 包含了 measure,target,range */
42
+ /**
43
+ * @title 颜色
44
+ * @description 包含了 measure,target,range
45
+ */
31
46
  readonly color?: BulletAttr<ColorAttr>;
32
-
33
- /** bulletStyle 包含了 measure,target,range */
47
+ /**
48
+ * @title 项目符号样式
49
+ * @description 包含了 measure,target,range
50
+ */
34
51
  readonly bulletStyle?: BulletAttr<StyleAttr>;
35
-
36
- /** layout 方向选择*/
52
+ /**
53
+ * @title 布局方向选择
54
+ * @default "horizontal"
55
+ */
37
56
  layout?: 'horizontal' | 'vertical';
38
57
  }