@antv/g2plot 2.4.5 → 2.4.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (335) hide show
  1. package/CHANGELOG.md +64 -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/constants.js +1 -0
  12. package/esm/plots/area/constants.js.map +1 -1
  13. package/esm/plots/area/types.d.ts +35 -10
  14. package/esm/plots/area/types.js.map +1 -1
  15. package/esm/plots/bar/constants.js +3 -0
  16. package/esm/plots/bar/constants.js.map +1 -1
  17. package/esm/plots/bar/types.d.ts +16 -3
  18. package/esm/plots/bar/types.js.map +1 -1
  19. package/esm/plots/bidirectional-bar/types.d.ts +21 -6
  20. package/esm/plots/bidirectional-bar/types.js.map +1 -1
  21. package/esm/plots/box/types.d.ts +20 -6
  22. package/esm/plots/box/types.js.map +1 -1
  23. package/esm/plots/bullet/types.d.ts +36 -9
  24. package/esm/plots/bullet/types.js.map +1 -1
  25. package/esm/plots/chord/types.d.ts +14 -10
  26. package/esm/plots/chord/types.js.map +1 -1
  27. package/esm/plots/circle-packing/types.d.ts +25 -8
  28. package/esm/plots/circle-packing/types.js.map +1 -1
  29. package/esm/plots/column/constants.js +3 -0
  30. package/esm/plots/column/constants.js.map +1 -1
  31. package/esm/plots/column/types.d.ts +57 -16
  32. package/esm/plots/column/types.js.map +1 -1
  33. package/esm/plots/dual-axes/types.d.ts +31 -6
  34. package/esm/plots/dual-axes/types.js.map +1 -1
  35. package/esm/plots/dual-axes/util/render-sider.js +1 -1
  36. package/esm/plots/dual-axes/util/render-sider.js.map +1 -1
  37. package/esm/plots/facet/types.d.ts +54 -34
  38. package/esm/plots/facet/types.js.map +1 -1
  39. package/esm/plots/funnel/types.d.ts +40 -11
  40. package/esm/plots/funnel/types.js.map +1 -1
  41. package/esm/plots/gauge/adaptor.js +1 -0
  42. package/esm/plots/gauge/adaptor.js.map +1 -1
  43. package/esm/plots/gauge/types.d.ts +83 -21
  44. package/esm/plots/gauge/types.js.map +1 -1
  45. package/esm/plots/heatmap/types.d.ts +47 -12
  46. package/esm/plots/heatmap/types.js.map +1 -1
  47. package/esm/plots/histogram/types.d.ts +17 -6
  48. package/esm/plots/histogram/types.js.map +1 -1
  49. package/esm/plots/line/adaptor.js +2 -2
  50. package/esm/plots/line/adaptor.js.map +1 -1
  51. package/esm/plots/line/constants.js +1 -0
  52. package/esm/plots/line/constants.js.map +1 -1
  53. package/esm/plots/line/types.d.ts +42 -12
  54. package/esm/plots/line/types.js.map +1 -1
  55. package/esm/plots/liquid/adaptor.js +2 -1
  56. package/esm/plots/liquid/adaptor.js.map +1 -1
  57. package/esm/plots/liquid/index.d.ts +1 -0
  58. package/esm/plots/liquid/index.js +1 -0
  59. package/esm/plots/liquid/index.js.map +1 -1
  60. package/esm/plots/liquid/shapes/liquid.d.ts +16 -1
  61. package/esm/plots/liquid/shapes/liquid.js +17 -10
  62. package/esm/plots/liquid/shapes/liquid.js.map +1 -1
  63. package/esm/plots/liquid/types.d.ts +57 -16
  64. package/esm/plots/liquid/types.js.map +1 -1
  65. package/esm/plots/mix/types.d.ts +31 -22
  66. package/esm/plots/mix/types.js.map +1 -1
  67. package/esm/plots/pie/adaptor.js +2 -0
  68. package/esm/plots/pie/adaptor.js.map +1 -1
  69. package/esm/plots/pie/contants.js +1 -0
  70. package/esm/plots/pie/contants.js.map +1 -1
  71. package/esm/plots/pie/types.d.ts +27 -10
  72. package/esm/plots/pie/types.js.map +1 -1
  73. package/esm/plots/progress/adaptor.js +1 -0
  74. package/esm/plots/progress/adaptor.js.map +1 -1
  75. package/esm/plots/progress/types.d.ts +13 -4
  76. package/esm/plots/progress/types.js.map +1 -1
  77. package/esm/plots/radar/types.d.ts +39 -12
  78. package/esm/plots/radar/types.js.map +1 -1
  79. package/esm/plots/radial-bar/types.d.ts +39 -12
  80. package/esm/plots/radial-bar/types.js.map +1 -1
  81. package/esm/plots/ring-progress/types.d.ts +18 -6
  82. package/esm/plots/ring-progress/types.js.map +1 -1
  83. package/esm/plots/rose/constant.js +1 -0
  84. package/esm/plots/rose/constant.js.map +1 -1
  85. package/esm/plots/rose/types.d.ts +32 -12
  86. package/esm/plots/rose/types.js.map +1 -1
  87. package/esm/plots/sankey/adaptor.js +31 -2
  88. package/esm/plots/sankey/adaptor.js.map +1 -1
  89. package/esm/plots/sankey/types.d.ts +57 -30
  90. package/esm/plots/sankey/types.js.map +1 -1
  91. package/esm/plots/scatter/adaptor.d.ts +1 -1
  92. package/esm/plots/scatter/adaptor.js +2 -2
  93. package/esm/plots/scatter/adaptor.js.map +1 -1
  94. package/esm/plots/scatter/types.d.ts +76 -22
  95. package/esm/plots/scatter/types.js.map +1 -1
  96. package/esm/plots/stock/types.d.ts +20 -7
  97. package/esm/plots/stock/types.js.map +1 -1
  98. package/esm/plots/sunburst/types.d.ts +40 -12
  99. package/esm/plots/sunburst/types.js.map +1 -1
  100. package/esm/plots/tiny-area/types.d.ts +16 -5
  101. package/esm/plots/tiny-area/types.js.map +1 -1
  102. package/esm/plots/tiny-column/types.d.ts +10 -3
  103. package/esm/plots/tiny-column/types.js.map +1 -1
  104. package/esm/plots/tiny-line/types.d.ts +17 -5
  105. package/esm/plots/tiny-line/types.js.map +1 -1
  106. package/esm/plots/treemap/types.d.ts +17 -6
  107. package/esm/plots/treemap/types.js.map +1 -1
  108. package/esm/plots/venn/types.d.ts +20 -6
  109. package/esm/plots/venn/types.js.map +1 -1
  110. package/esm/plots/violin/types.d.ts +52 -17
  111. package/esm/plots/violin/types.js.map +1 -1
  112. package/esm/plots/waterfall/types.d.ts +42 -10
  113. package/esm/plots/waterfall/types.js.map +1 -1
  114. package/esm/plots/word-cloud/types.d.ts +91 -44
  115. package/esm/plots/word-cloud/types.js.map +1 -1
  116. package/esm/types/button.d.ts +8 -4
  117. package/esm/types/button.js.map +1 -1
  118. package/esm/types/common.d.ts +145 -33
  119. package/esm/types/common.js.map +1 -1
  120. package/esm/types/drill-down.d.ts +28 -7
  121. package/esm/types/drill-down.js.map +1 -1
  122. package/esm/types/interaction.d.ts +26 -6
  123. package/esm/types/interaction.js.map +1 -1
  124. package/esm/types/label.d.ts +11 -3
  125. package/esm/types/label.js.map +1 -1
  126. package/esm/types/meta.d.ts +4 -7
  127. package/esm/types/meta.js.map +1 -1
  128. package/esm/types/pattern.d.ts +58 -18
  129. package/esm/types/pattern.js.map +1 -1
  130. package/esm/types/state.d.ts +11 -3
  131. package/esm/types/state.js.map +1 -1
  132. package/esm/types/statistic.d.ts +38 -6
  133. package/esm/types/statistic.js.map +1 -1
  134. package/esm/types/tooltip.d.ts +7 -2
  135. package/esm/types/tooltip.js.map +1 -1
  136. package/esm/utils/transform/percent.js +2 -2
  137. package/esm/utils/transform/percent.js.map +1 -1
  138. package/lib/core/plot.d.ts +2 -2
  139. package/lib/core/plot.js +4 -3
  140. package/lib/core/plot.js.map +1 -1
  141. package/lib/index.d.ts +2 -2
  142. package/lib/index.js +2 -1
  143. package/lib/index.js.map +1 -1
  144. package/lib/plots/area/constants.js +1 -0
  145. package/lib/plots/area/constants.js.map +1 -1
  146. package/lib/plots/area/types.d.ts +35 -10
  147. package/lib/plots/area/types.js.map +1 -1
  148. package/lib/plots/bar/constants.js +3 -0
  149. package/lib/plots/bar/constants.js.map +1 -1
  150. package/lib/plots/bar/types.d.ts +16 -3
  151. package/lib/plots/bar/types.js.map +1 -1
  152. package/lib/plots/bidirectional-bar/types.d.ts +21 -6
  153. package/lib/plots/bidirectional-bar/types.js.map +1 -1
  154. package/lib/plots/box/types.d.ts +20 -6
  155. package/lib/plots/box/types.js.map +1 -1
  156. package/lib/plots/bullet/types.d.ts +36 -9
  157. package/lib/plots/bullet/types.js.map +1 -1
  158. package/lib/plots/chord/types.d.ts +14 -10
  159. package/lib/plots/chord/types.js.map +1 -1
  160. package/lib/plots/circle-packing/types.d.ts +25 -8
  161. package/lib/plots/circle-packing/types.js.map +1 -1
  162. package/lib/plots/column/constants.js +3 -0
  163. package/lib/plots/column/constants.js.map +1 -1
  164. package/lib/plots/column/types.d.ts +57 -16
  165. package/lib/plots/column/types.js.map +1 -1
  166. package/lib/plots/dual-axes/types.d.ts +31 -6
  167. package/lib/plots/dual-axes/types.js.map +1 -1
  168. package/lib/plots/dual-axes/util/render-sider.js +1 -1
  169. package/lib/plots/dual-axes/util/render-sider.js.map +1 -1
  170. package/lib/plots/facet/types.d.ts +54 -34
  171. package/lib/plots/facet/types.js.map +1 -1
  172. package/lib/plots/funnel/types.d.ts +40 -11
  173. package/lib/plots/funnel/types.js.map +1 -1
  174. package/lib/plots/gauge/adaptor.js +1 -0
  175. package/lib/plots/gauge/adaptor.js.map +1 -1
  176. package/lib/plots/gauge/types.d.ts +83 -21
  177. package/lib/plots/gauge/types.js.map +1 -1
  178. package/lib/plots/heatmap/types.d.ts +47 -12
  179. package/lib/plots/heatmap/types.js.map +1 -1
  180. package/lib/plots/histogram/types.d.ts +17 -6
  181. package/lib/plots/histogram/types.js.map +1 -1
  182. package/lib/plots/line/adaptor.js +1 -1
  183. package/lib/plots/line/adaptor.js.map +1 -1
  184. package/lib/plots/line/constants.js +1 -0
  185. package/lib/plots/line/constants.js.map +1 -1
  186. package/lib/plots/line/types.d.ts +42 -12
  187. package/lib/plots/line/types.js.map +1 -1
  188. package/lib/plots/liquid/adaptor.js +2 -1
  189. package/lib/plots/liquid/adaptor.js.map +1 -1
  190. package/lib/plots/liquid/index.d.ts +1 -0
  191. package/lib/plots/liquid/index.js +2 -0
  192. package/lib/plots/liquid/index.js.map +1 -1
  193. package/lib/plots/liquid/shapes/liquid.d.ts +16 -1
  194. package/lib/plots/liquid/shapes/liquid.js +19 -10
  195. package/lib/plots/liquid/shapes/liquid.js.map +1 -1
  196. package/lib/plots/liquid/types.d.ts +57 -16
  197. package/lib/plots/liquid/types.js.map +1 -1
  198. package/lib/plots/mix/types.d.ts +31 -22
  199. package/lib/plots/mix/types.js.map +1 -1
  200. package/lib/plots/pie/adaptor.js +2 -0
  201. package/lib/plots/pie/adaptor.js.map +1 -1
  202. package/lib/plots/pie/contants.js +1 -0
  203. package/lib/plots/pie/contants.js.map +1 -1
  204. package/lib/plots/pie/types.d.ts +27 -10
  205. package/lib/plots/pie/types.js.map +1 -1
  206. package/lib/plots/progress/adaptor.js +1 -0
  207. package/lib/plots/progress/adaptor.js.map +1 -1
  208. package/lib/plots/progress/types.d.ts +13 -4
  209. package/lib/plots/progress/types.js.map +1 -1
  210. package/lib/plots/radar/types.d.ts +39 -12
  211. package/lib/plots/radar/types.js.map +1 -1
  212. package/lib/plots/radial-bar/types.d.ts +39 -12
  213. package/lib/plots/radial-bar/types.js.map +1 -1
  214. package/lib/plots/ring-progress/types.d.ts +18 -6
  215. package/lib/plots/ring-progress/types.js.map +1 -1
  216. package/lib/plots/rose/constant.js +1 -0
  217. package/lib/plots/rose/constant.js.map +1 -1
  218. package/lib/plots/rose/types.d.ts +32 -12
  219. package/lib/plots/rose/types.js.map +1 -1
  220. package/lib/plots/sankey/adaptor.js +30 -1
  221. package/lib/plots/sankey/adaptor.js.map +1 -1
  222. package/lib/plots/sankey/types.d.ts +57 -30
  223. package/lib/plots/sankey/types.js.map +1 -1
  224. package/lib/plots/scatter/adaptor.d.ts +1 -1
  225. package/lib/plots/scatter/adaptor.js +1 -1
  226. package/lib/plots/scatter/adaptor.js.map +1 -1
  227. package/lib/plots/scatter/types.d.ts +76 -22
  228. package/lib/plots/scatter/types.js.map +1 -1
  229. package/lib/plots/stock/types.d.ts +20 -7
  230. package/lib/plots/stock/types.js.map +1 -1
  231. package/lib/plots/sunburst/types.d.ts +40 -12
  232. package/lib/plots/sunburst/types.js.map +1 -1
  233. package/lib/plots/tiny-area/types.d.ts +16 -5
  234. package/lib/plots/tiny-area/types.js.map +1 -1
  235. package/lib/plots/tiny-column/types.d.ts +10 -3
  236. package/lib/plots/tiny-column/types.js.map +1 -1
  237. package/lib/plots/tiny-line/types.d.ts +17 -5
  238. package/lib/plots/tiny-line/types.js.map +1 -1
  239. package/lib/plots/treemap/types.d.ts +17 -6
  240. package/lib/plots/treemap/types.js.map +1 -1
  241. package/lib/plots/venn/types.d.ts +20 -6
  242. package/lib/plots/venn/types.js.map +1 -1
  243. package/lib/plots/violin/types.d.ts +52 -17
  244. package/lib/plots/violin/types.js.map +1 -1
  245. package/lib/plots/waterfall/types.d.ts +42 -10
  246. package/lib/plots/waterfall/types.js.map +1 -1
  247. package/lib/plots/word-cloud/types.d.ts +91 -44
  248. package/lib/plots/word-cloud/types.js.map +1 -1
  249. package/lib/types/button.d.ts +8 -4
  250. package/lib/types/button.js.map +1 -1
  251. package/lib/types/common.d.ts +145 -33
  252. package/lib/types/common.js.map +1 -1
  253. package/lib/types/drill-down.d.ts +28 -7
  254. package/lib/types/drill-down.js.map +1 -1
  255. package/lib/types/interaction.d.ts +26 -6
  256. package/lib/types/interaction.js.map +1 -1
  257. package/lib/types/label.d.ts +11 -3
  258. package/lib/types/label.js.map +1 -1
  259. package/lib/types/meta.d.ts +4 -7
  260. package/lib/types/meta.js.map +1 -1
  261. package/lib/types/pattern.d.ts +58 -18
  262. package/lib/types/pattern.js.map +1 -1
  263. package/lib/types/state.d.ts +11 -3
  264. package/lib/types/state.js.map +1 -1
  265. package/lib/types/statistic.d.ts +38 -6
  266. package/lib/types/statistic.js.map +1 -1
  267. package/lib/types/tooltip.d.ts +7 -2
  268. package/lib/types/tooltip.js.map +1 -1
  269. package/lib/utils/transform/percent.js +2 -2
  270. package/lib/utils/transform/percent.js.map +1 -1
  271. package/package.json +2 -2
  272. package/src/core/plot.ts +5 -4
  273. package/src/index.ts +2 -2
  274. package/src/plots/area/constants.ts +1 -0
  275. package/src/plots/area/types.ts +35 -10
  276. package/src/plots/bar/constants.ts +3 -0
  277. package/src/plots/bar/types.ts +16 -3
  278. package/src/plots/bidirectional-bar/types.ts +21 -6
  279. package/src/plots/box/types.ts +20 -6
  280. package/src/plots/bullet/types.ts +36 -17
  281. package/src/plots/chord/types.ts +14 -11
  282. package/src/plots/circle-packing/types.ts +25 -14
  283. package/src/plots/column/constants.ts +3 -0
  284. package/src/plots/column/types.ts +57 -20
  285. package/src/plots/dual-axes/types.ts +31 -16
  286. package/src/plots/dual-axes/util/render-sider.ts +1 -1
  287. package/src/plots/facet/types.ts +54 -49
  288. package/src/plots/funnel/types.ts +40 -13
  289. package/src/plots/gauge/adaptor.ts +1 -0
  290. package/src/plots/gauge/types.ts +86 -27
  291. package/src/plots/heatmap/types.ts +49 -14
  292. package/src/plots/histogram/types.ts +17 -9
  293. package/src/plots/line/adaptor.ts +12 -1
  294. package/src/plots/line/constants.ts +1 -0
  295. package/src/plots/line/types.ts +42 -14
  296. package/src/plots/liquid/adaptor.ts +2 -1
  297. package/src/plots/liquid/index.ts +2 -0
  298. package/src/plots/liquid/shapes/liquid.ts +22 -11
  299. package/src/plots/liquid/types.ts +57 -16
  300. package/src/plots/mix/types.ts +31 -35
  301. package/src/plots/pie/adaptor.ts +2 -0
  302. package/src/plots/pie/contants.ts +1 -0
  303. package/src/plots/pie/types.ts +27 -10
  304. package/src/plots/progress/adaptor.ts +1 -0
  305. package/src/plots/progress/types.ts +13 -4
  306. package/src/plots/radar/types.ts +39 -12
  307. package/src/plots/radial-bar/types.ts +39 -12
  308. package/src/plots/ring-progress/types.ts +18 -6
  309. package/src/plots/rose/constant.ts +1 -0
  310. package/src/plots/rose/types.ts +32 -12
  311. package/src/plots/sankey/adaptor.ts +35 -2
  312. package/src/plots/sankey/types.ts +58 -30
  313. package/src/plots/scatter/adaptor.ts +3 -1
  314. package/src/plots/scatter/types.ts +77 -24
  315. package/src/plots/stock/types.ts +21 -8
  316. package/src/plots/sunburst/types.ts +42 -12
  317. package/src/plots/tiny-area/types.ts +16 -5
  318. package/src/plots/tiny-column/types.ts +10 -3
  319. package/src/plots/tiny-line/types.ts +17 -5
  320. package/src/plots/treemap/types.ts +17 -7
  321. package/src/plots/venn/types.ts +21 -6
  322. package/src/plots/violin/types.ts +52 -17
  323. package/src/plots/waterfall/types.ts +42 -10
  324. package/src/plots/word-cloud/types.ts +91 -44
  325. package/src/types/button.ts +8 -4
  326. package/src/types/common.ts +145 -37
  327. package/src/types/drill-down.ts +28 -7
  328. package/src/types/interaction.ts +26 -6
  329. package/src/types/label.ts +11 -3
  330. package/src/types/meta.ts +4 -7
  331. package/src/types/pattern.ts +58 -18
  332. package/src/types/state.ts +11 -3
  333. package/src/types/statistic.ts +38 -6
  334. package/src/types/tooltip.ts +7 -2
  335. package/src/utils/transform/percent.ts +2 -2
@@ -1 +1 @@
1
- {"version":3,"file":"adaptor.js","sourceRoot":"","sources":["../../../src/plots/pie/adaptor.ts"],"names":[],"mappings":";;;;AAAA,mCAA0G;AAE1G,+CAAmF;AACnF,sDAAmE;AACnE,uDAAoD;AACpD,iDAAgD;AAChD,4CAA8C;AAE9C,qCAA8G;AAE9G,uCAA6C;AAC7C,iCAAgE;AAChE,+CAA+C;AAG/C;;;GAGG;AACH,SAAS,QAAQ,CAAC,MAA0B;IAClC,IAAA,KAAK,GAAc,MAAM,MAApB,EAAE,OAAO,GAAK,MAAM,QAAX,CAAY;IAC1B,IAAA,IAAI,GAA8C,OAAO,KAArD,EAAE,UAAU,GAAkC,OAAO,WAAzC,EAAE,UAAU,GAAsB,OAAO,WAA7B,EAAE,KAAK,GAAe,OAAO,MAAtB,EAAE,QAAQ,GAAK,OAAO,SAAZ,CAAa;IAElE,WAAW;IACX,IAAI,WAAW,GAAG,0BAAkB,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;IAEvD,IAAI,iBAAS,CAAC,WAAW,EAAE,UAAU,CAAC,EAAE;QACtC,0BAA0B;QAC1B,IAAM,iBAAe,GAAG,gBAAgB,CAAC;QACzC,WAAW,GAAG,WAAW,CA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AAS;wBACjC,GAAG,EAAE,EAAE,SAAS,WAAA,EAAE,WAAW,aAAA,EAAE;qBAChC;iBACF,CAAC;aACH;YACD,WAAI,OAAC,CAAC,CAAC,GAAG,0CAAE,KAAK,EAAE,UAAC,KAAK;gBACvB,aAAW,CAAC,IAAI,uCAAM,KAAK,KAAE,GAAG,EAAE,EAAE,SAAS,WAAA,EAAE,WAAW,aAAA,EAAE,IAAG,CAAC;YAClE,CAAC,CAAC,CAAC;YACH,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,EAAE,kBAAU,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,EAAE,EAAE,KAAK,EAAE,aAAW,EAAE,CAAC,CAAC,CAAC;SAC1E;aAAM;YACL,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,GAAG,IAAI,EAAE,CAAC,CAAC;SACxC;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC;AA7BD,kCA6BC;AAED;;;;GAIG;AACH,SAAgB,OAAO,CAAC,MAA0B;IAChD,0BAA0B;IAC1B,OAAO,YAAI,CACT,iBAAO,CAAC,UAAU,CAAC,EACnB,QAAQ,EACR,IAAI,EACJ,cAAK,EACL,UAAU,EACV,eAAM,EACN,OAAO,EACP,KAAK,EACL,cAAK;IACL,mBAAmB;IACnB,aAAa,EACb,WAAW,EACX,kBAAS,CACV,CAAC,MAAM,CAAC,CAAC;AACZ,CAAC;AAjBD,0BAiBC","sourcesContent":["import { isFunction, isString, isNil, get, isArray, isNumber, each, toString, isEmpty } from '@antv/util';\nimport { Params } from '../../core/adaptor';\nimport { legend, animation, theme, state, annotation } from '../../adaptor/common';\nimport { getMappingFunction } from '../../adaptor/geometries/base';\nimport { interval } from '../../adaptor/geometries';\nimport { pattern } from '../../adaptor/pattern';\nimport { getLocale } from '../../core/locale';\nimport { Interaction } from '../../types/interaction';\nimport { flow, template, transformLabel, deepAssign, renderStatistic, processIllegalData } from '../../utils';\nimport { Data, Datum } from '../../types';\nimport { DEFAULT_OPTIONS } from './contants';\nimport { adaptOffset, getTotalValue, isAllZero } from './utils';\nimport { PIE_STATISTIC } from './interactions';\nimport { PieOptions } from './types';\n\n/**\n * 字段\n * @param params\n */\nfunction geometry(params: Params<PieOptions>): Params<PieOptions> {\n const { chart, options } = params;\n const { data, angleField, colorField, color, pieStyle } = options;\n\n // 处理不合法的数据\n let processData = processIllegalData(data, angleField);\n\n if (isAllZero(processData, angleField)) {\n // 数据全 0 处理,调整 position 映射\n const percentageField = '$$percentage$$';\n processData = processData.map((d) => ({ ...d, [percentageField]: 1 / processData.length }));\n chart.data(processData);\n\n const p = deepAssign({}, params, {\n options: {\n xField: '1',\n yField: percentageField,\n seriesField: colorField,\n isStack: true,\n interval: {\n color,\n style: pieStyle,\n },\n args: {\n zIndexReversed: true,\n },\n },\n });\n\n interval(p);\n } else {\n chart.data(processData);\n\n const p = deepAssign({}, params, {\n options: {\n xField: '1',\n yField: angleField,\n seriesField: colorField,\n isStack: true,\n interval: {\n color,\n style: pieStyle,\n },\n args: {\n zIndexReversed: true,\n },\n },\n });\n\n interval(p);\n }\n\n return params;\n}\n\n/**\n * meta 配置\n * @param params\n */\nfunction meta(params: Params<PieOptions>): Params<PieOptions> {\n const { chart, options } = params;\n const { meta, colorField } = options;\n\n // meta 直接是 scale 的信息\n const scales = deepAssign({}, meta);\n chart.scale(scales, {\n [colorField]: { type: 'cat' },\n });\n\n return params;\n}\n\n/**\n * coord 配置\n * @param params\n */\nfunction coordinate(params: Params<PieOptions>): Params<PieOptions> {\n const { chart, options } = params;\n const { radius, innerRadius, startAngle, endAngle } = options;\n\n chart.coordinate({\n type: 'theta',\n cfg: {\n radius,\n innerRadius,\n startAngle,\n endAngle,\n },\n });\n\n return params;\n}\n\n/**\n * label 配置\n * @param params\n */\nfunction label(params: Params<PieOptions>): Params<PieOptions> {\n const { chart, options } = params;\n const { label, colorField, angleField } = options;\n\n const geometry = chart.geometries[0];\n // label 为 false, 空 则不显示 label\n if (!label) {\n geometry.label(false);\n } else {\n const { callback, ...cfg } = label;\n const labelCfg = transformLabel(cfg);\n\n // ① 提供模板字符串的 label content 配置\n if (labelCfg.content) {\n const { content } = labelCfg;\n labelCfg.content = (data: object, dataum: any, index: number) => {\n const name = data[colorField];\n const value = data[angleField];\n // dymatic get scale, scale is ready this time\n const angleScale = chart.getScaleByField(angleField);\n const percent = angleScale?.scale(value);\n return isFunction(content)\n ? // append pecent (number) to data, users can get origin data from `dataum._origin`\n content({ ...data, percent }, dataum, index)\n : isString(content)\n ? template(content as string, {\n value,\n name,\n // percentage (string), default keep 2\n percentage: isNumber(percent) && !isNil(value) ? `${(percent * 100).toFixed(2)}%` : null,\n })\n : content;\n };\n }\n\n const LABEL_LAYOUT_TYPE_MAP = {\n inner: '',\n outer: 'pie-outer',\n spider: 'pie-spider',\n };\n const labelLayoutType = labelCfg.type ? LABEL_LAYOUT_TYPE_MAP[labelCfg.type] : 'pie-outer';\n const labelLayoutCfg = labelCfg.layout ? (!isArray(labelCfg.layout) ? [labelCfg.layout] : labelCfg.layout) : [];\n labelCfg.layout = (labelLayoutType ? [{ type: labelLayoutType }] : []).concat(labelLayoutCfg);\n\n geometry.label({\n // fix: could not create scale, when field is undefined(attributes 中的 fields 定义都会被用来创建 scale)\n fields: colorField ? [angleField, colorField] : [angleField],\n callback,\n cfg: {\n ...labelCfg,\n offset: adaptOffset(labelCfg.type, labelCfg.offset),\n type: 'pie',\n },\n });\n }\n return params;\n}\n\n/**\n * statistic options 处理\n * 1. 默认继承 default options 的样式\n * 2. 默认使用 meta 的 formatter\n */\nexport function transformStatisticOptions(options: PieOptions): PieOptions {\n const { innerRadius, statistic, angleField, colorField, meta, locale } = options;\n\n const i18n = getLocale(locale);\n\n if (innerRadius && statistic) {\n let { title: titleOpt, content: contentOpt } = deepAssign({}, DEFAULT_OPTIONS.statistic, statistic);\n if (titleOpt !== false) {\n titleOpt = deepAssign(\n {},\n {\n formatter: (datum: Datum) => {\n // 交互中\n if (datum) {\n return datum[colorField];\n }\n return !isNil(titleOpt.content) ? titleOpt.content : i18n.get(['statistic', 'total']);\n },\n },\n titleOpt\n );\n }\n if (contentOpt !== false) {\n contentOpt = deepAssign(\n {},\n {\n formatter: (datum: Datum, data: Data) => {\n const dataValue = datum ? datum[angleField] : getTotalValue(data, angleField);\n const metaFormatter = get(meta, [angleField, 'formatter']) || ((v) => v);\n // 交互中\n if (datum) {\n return metaFormatter(dataValue);\n }\n return !isNil(contentOpt.content) ? contentOpt.content : metaFormatter(dataValue);\n },\n },\n contentOpt\n );\n }\n\n return deepAssign({}, { statistic: { title: titleOpt, content: contentOpt } }, options);\n }\n return options;\n}\n\n/**\n * statistic 中心文本配置\n * @param params\n */\nexport function pieAnnotation(params: Params<PieOptions>): Params<PieOptions> {\n const { chart, options } = params;\n const { innerRadius, statistic } = transformStatisticOptions(options);\n // 先清空标注,再重新渲染\n chart.getController('annotation').clear(true);\n\n // 先进行其他 annotations,再去渲染统计文本\n flow(annotation())(params);\n\n /** 中心文本 指标卡 */\n if (innerRadius && statistic) {\n renderStatistic(chart, { statistic, plotType: 'pie' });\n }\n\n return params;\n}\n\n/**\n * 饼图 tooltip 配置\n * 1. 强制 tooltip.shared 为 false\n * @param params\n */\nfunction tooltip(params: Params<PieOptions>): Params<PieOptions> {\n const { chart, options } = params;\n const { tooltip, colorField, angleField, data } = options;\n\n if (tooltip === false) {\n chart.tooltip(tooltip);\n } else {\n chart.tooltip(deepAssign({}, tooltip, { shared: false }));\n\n // 主要解决 all zero, 对于非 all zero 不再适用\n if (isAllZero(data, angleField)) {\n let fields = get(tooltip, 'fields');\n let formatter = get(tooltip, 'formatter');\n\n if (isEmpty(get(tooltip, 'fields'))) {\n fields = [colorField, angleField];\n formatter = formatter || ((datum) => ({ name: datum[colorField], value: toString(datum[angleField]) }));\n }\n chart.geometries[0].tooltip(fields.join('*'), getMappingFunction(fields, formatter));\n }\n }\n\n return params;\n}\n\n/**\n * Interaction 配置 (饼图特殊的 interaction, 中心文本变更的时候,需要将一些配置参数传进去)\n * @param params\n */\nexport function interaction(params: Params<PieOptions>): Params<PieOptions> {\n const { chart, options } = params;\n const { interactions, statistic, annotations } = transformStatisticOptions(options);\n\n each(interactions, (i: Interaction) => {\n if (i.enable === false) {\n chart.removeInteraction(i.type);\n } else if (i.type === 'pie-statistic-active') {\n // 只针对 start 阶段的配置,进行添加参数信息\n let startStages = [];\n if (!i.cfg?.start) {\n startStages = [\n {\n trigger: 'element:mouseenter',\n action: `${PIE_STATISTIC}:change`,\n arg: { statistic, annotations },\n },\n ];\n }\n each(i.cfg?.start, (stage) => {\n startStages.push({ ...stage, arg: { statistic, annotations } });\n });\n chart.interaction(i.type, deepAssign({}, i.cfg, { start: startStages }));\n } else {\n chart.interaction(i.type, i.cfg || {});\n }\n });\n\n return params;\n}\n\n/**\n * 饼图适配器\n * @param chart\n * @param options\n */\nexport function adaptor(params: Params<PieOptions>) {\n // flow 的方式处理所有的配置到 G2 API\n return flow<Params<PieOptions>>(\n pattern('pieStyle'),\n geometry,\n meta,\n theme,\n coordinate,\n legend,\n tooltip,\n label,\n state,\n /** 指标卡中心文本 放在下层 */\n pieAnnotation,\n interaction,\n animation\n )(params);\n}\n"]}
1
+ {"version":3,"file":"adaptor.js","sourceRoot":"","sources":["../../../src/plots/pie/adaptor.ts"],"names":[],"mappings":";;;;AAAA,mCAA0G;AAE1G,+CAAmF;AACnF,sDAAmE;AACnE,uDAAoD;AACpD,iDAAgD;AAChD,4CAA8C;AAE9C,qCAA8G;AAE9G,uCAA6C;AAC7C,iCAAgE;AAChE,+CAA+C;AAG/C;;;GAGG;AACH,SAAS,QAAQ,CAAC,MAA0B;IAClC,IAAA,KAAK,GAAc,MAAM,MAApB,EAAE,OAAO,GAAK,MAAM,QAAX,CAAY;IAC1B,IAAA,IAAI,GAA8C,OAAO,KAArD,EAAE,UAAU,GAAkC,OAAO,WAAzC,EAAE,UAAU,GAAsB,OAAO,WAA7B,E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CAAC,CAAC;AACZ,CAAC;AAjBD,0BAiBC","sourcesContent":["import { isFunction, isString, isNil, get, isArray, isNumber, each, toString, isEmpty } from '@antv/util';\nimport { Params } from '../../core/adaptor';\nimport { legend, animation, theme, state, annotation } from '../../adaptor/common';\nimport { getMappingFunction } from '../../adaptor/geometries/base';\nimport { interval } from '../../adaptor/geometries';\nimport { pattern } from '../../adaptor/pattern';\nimport { getLocale } from '../../core/locale';\nimport { Interaction } from '../../types/interaction';\nimport { flow, template, transformLabel, deepAssign, renderStatistic, processIllegalData } from '../../utils';\nimport { Data, Datum } from '../../types';\nimport { DEFAULT_OPTIONS } from './contants';\nimport { adaptOffset, getTotalValue, isAllZero } from './utils';\nimport { PIE_STATISTIC } from './interactions';\nimport { PieOptions } from './types';\n\n/**\n * 字段\n * @param params\n */\nfunction geometry(params: Params<PieOptions>): Params<PieOptions> {\n const { chart, options } = params;\n const { data, angleField, colorField, color, pieStyle } = options;\n\n // 处理不合法的数据\n let processData = processIllegalData(data, angleField);\n\n if (isAllZero(processData, angleField)) {\n // 数据全 0 处理,调整 position 映射\n const percentageField = '$$percentage$$';\n processData = processData.map((d) => ({ ...d, [percentageField]: 1 / processData.length }));\n chart.data(processData);\n\n const p = deepAssign({}, params, {\n options: {\n xField: '1',\n yField: percentageField,\n seriesField: colorField,\n isStack: true,\n interval: {\n color,\n style: pieStyle,\n },\n args: {\n zIndexReversed: true,\n sortZIndex: true,\n },\n },\n });\n\n interval(p);\n } else {\n chart.data(processData);\n\n const p = deepAssign({}, params, {\n options: {\n xField: '1',\n yField: angleField,\n seriesField: colorField,\n isStack: true,\n interval: {\n color,\n style: pieStyle,\n },\n args: {\n zIndexReversed: true,\n sortZIndex: true,\n },\n },\n });\n\n interval(p);\n }\n\n return params;\n}\n\n/**\n * meta 配置\n * @param params\n */\nfunction meta(params: Params<PieOptions>): Params<PieOptions> {\n const { chart, options } = params;\n const { meta, colorField } = options;\n\n // meta 直接是 scale 的信息\n const scales = deepAssign({}, meta);\n chart.scale(scales, {\n [colorField]: { type: 'cat' },\n });\n\n return params;\n}\n\n/**\n * coord 配置\n * @param params\n */\nfunction coordinate(params: Params<PieOptions>): Params<PieOptions> {\n const { chart, options } = params;\n const { radius, innerRadius, startAngle, endAngle } = options;\n\n chart.coordinate({\n type: 'theta',\n cfg: {\n radius,\n innerRadius,\n startAngle,\n endAngle,\n },\n });\n\n return params;\n}\n\n/**\n * label 配置\n * @param params\n */\nfunction label(params: Params<PieOptions>): Params<PieOptions> {\n const { chart, options } = params;\n const { label, colorField, angleField } = options;\n\n const geometry = chart.geometries[0];\n // label 为 false, 空 则不显示 label\n if (!label) {\n geometry.label(false);\n } else {\n const { callback, ...cfg } = label;\n const labelCfg = transformLabel(cfg);\n\n // ① 提供模板字符串的 label content 配置\n if (labelCfg.content) {\n const { content } = labelCfg;\n labelCfg.content = (data: object, dataum: any, index: number) => {\n const name = data[colorField];\n const value = data[angleField];\n // dymatic get scale, scale is ready this time\n const angleScale = chart.getScaleByField(angleField);\n const percent = angleScale?.scale(value);\n return isFunction(content)\n ? // append pecent (number) to data, users can get origin data from `dataum._origin`\n content({ ...data, percent }, dataum, index)\n : isString(content)\n ? template(content as string, {\n value,\n name,\n // percentage (string), default keep 2\n percentage: isNumber(percent) && !isNil(value) ? `${(percent * 100).toFixed(2)}%` : null,\n })\n : content;\n };\n }\n\n const LABEL_LAYOUT_TYPE_MAP = {\n inner: '',\n outer: 'pie-outer',\n spider: 'pie-spider',\n };\n const labelLayoutType = labelCfg.type ? LABEL_LAYOUT_TYPE_MAP[labelCfg.type] : 'pie-outer';\n const labelLayoutCfg = labelCfg.layout ? (!isArray(labelCfg.layout) ? [labelCfg.layout] : labelCfg.layout) : [];\n labelCfg.layout = (labelLayoutType ? [{ type: labelLayoutType }] : []).concat(labelLayoutCfg);\n\n geometry.label({\n // fix: could not create scale, when field is undefined(attributes 中的 fields 定义都会被用来创建 scale)\n fields: colorField ? [angleField, colorField] : [angleField],\n callback,\n cfg: {\n ...labelCfg,\n offset: adaptOffset(labelCfg.type, labelCfg.offset),\n type: 'pie',\n },\n });\n }\n return params;\n}\n\n/**\n * statistic options 处理\n * 1. 默认继承 default options 的样式\n * 2. 默认使用 meta 的 formatter\n */\nexport function transformStatisticOptions(options: PieOptions): PieOptions {\n const { innerRadius, statistic, angleField, colorField, meta, locale } = options;\n\n const i18n = getLocale(locale);\n\n if (innerRadius && statistic) {\n let { title: titleOpt, content: contentOpt } = deepAssign({}, DEFAULT_OPTIONS.statistic, statistic);\n if (titleOpt !== false) {\n titleOpt = deepAssign(\n {},\n {\n formatter: (datum: Datum) => {\n // 交互中\n if (datum) {\n return datum[colorField];\n }\n return !isNil(titleOpt.content) ? titleOpt.content : i18n.get(['statistic', 'total']);\n },\n },\n titleOpt\n );\n }\n if (contentOpt !== false) {\n contentOpt = deepAssign(\n {},\n {\n formatter: (datum: Datum, data: Data) => {\n const dataValue = datum ? datum[angleField] : getTotalValue(data, angleField);\n const metaFormatter = get(meta, [angleField, 'formatter']) || ((v) => v);\n // 交互中\n if (datum) {\n return metaFormatter(dataValue);\n }\n return !isNil(contentOpt.content) ? contentOpt.content : metaFormatter(dataValue);\n },\n },\n contentOpt\n );\n }\n\n return deepAssign({}, { statistic: { title: titleOpt, content: contentOpt } }, options);\n }\n return options;\n}\n\n/**\n * statistic 中心文本配置\n * @param params\n */\nexport function pieAnnotation(params: Params<PieOptions>): Params<PieOptions> {\n const { chart, options } = params;\n const { innerRadius, statistic } = transformStatisticOptions(options);\n // 先清空标注,再重新渲染\n chart.getController('annotation').clear(true);\n\n // 先进行其他 annotations,再去渲染统计文本\n flow(annotation())(params);\n\n /** 中心文本 指标卡 */\n if (innerRadius && statistic) {\n renderStatistic(chart, { statistic, plotType: 'pie' });\n }\n\n return params;\n}\n\n/**\n * 饼图 tooltip 配置\n * 1. 强制 tooltip.shared 为 false\n * @param params\n */\nfunction tooltip(params: Params<PieOptions>): Params<PieOptions> {\n const { chart, options } = params;\n const { tooltip, colorField, angleField, data } = options;\n\n if (tooltip === false) {\n chart.tooltip(tooltip);\n } else {\n chart.tooltip(deepAssign({}, tooltip, { shared: false }));\n\n // 主要解决 all zero, 对于非 all zero 不再适用\n if (isAllZero(data, angleField)) {\n let fields = get(tooltip, 'fields');\n let formatter = get(tooltip, 'formatter');\n\n if (isEmpty(get(tooltip, 'fields'))) {\n fields = [colorField, angleField];\n formatter = formatter || ((datum) => ({ name: datum[colorField], value: toString(datum[angleField]) }));\n }\n chart.geometries[0].tooltip(fields.join('*'), getMappingFunction(fields, formatter));\n }\n }\n\n return params;\n}\n\n/**\n * Interaction 配置 (饼图特殊的 interaction, 中心文本变更的时候,需要将一些配置参数传进去)\n * @param params\n */\nexport function interaction(params: Params<PieOptions>): Params<PieOptions> {\n const { chart, options } = params;\n const { interactions, statistic, annotations } = transformStatisticOptions(options);\n\n each(interactions, (i: Interaction) => {\n if (i.enable === false) {\n chart.removeInteraction(i.type);\n } else if (i.type === 'pie-statistic-active') {\n // 只针对 start 阶段的配置,进行添加参数信息\n let startStages = [];\n if (!i.cfg?.start) {\n startStages = [\n {\n trigger: 'element:mouseenter',\n action: `${PIE_STATISTIC}:change`,\n arg: { statistic, annotations },\n },\n ];\n }\n each(i.cfg?.start, (stage) => {\n startStages.push({ ...stage, arg: { statistic, annotations } });\n });\n chart.interaction(i.type, deepAssign({}, i.cfg, { start: startStages }));\n } else {\n chart.interaction(i.type, i.cfg || {});\n }\n });\n\n return params;\n}\n\n/**\n * 饼图适配器\n * @param chart\n * @param options\n */\nexport function adaptor(params: Params<PieOptions>) {\n // flow 的方式处理所有的配置到 G2 API\n return flow<Params<PieOptions>>(\n pattern('pieStyle'),\n geometry,\n meta,\n theme,\n coordinate,\n legend,\n tooltip,\n label,\n state,\n /** 指标卡中心文本 放在下层 */\n pieAnnotation,\n interaction,\n animation\n )(params);\n}\n"]}
@@ -9,6 +9,7 @@ var utils_1 = require("../../utils");
9
9
  exports.DEFAULT_OPTIONS = utils_1.deepAssign({}, plot_1.Plot.getDefaultOptions(), {
10
10
  legend: {
11
11
  position: 'right',
12
+ radio: {},
12
13
  },
13
14
  tooltip: {
14
15
  shared: false,
@@ -1 +1 @@
1
- {"version":3,"file":"contants.js","sourceRoot":"","sources":["../../../src/plots/pie/contants.ts"],"names":[],"mappings":";;;AAAA,wCAAuC;AACvC,qCAAyC;AAEzC;;GAEG;AACU,QAAA,eAAe,GAAG,kBAAU,CAAC,EAAE,EAAE,WAAI,CAAC,iBAAiB,EAAE,EAAE;IACtE,MAAM,EAAE;QACN,QAAQ,EAAE,OAAO;KAClB;IACD,OAAO,EAAE;QACP,MAAM,EAAE,KAAK;QACb,SAAS,EAAE,KAAK;QAChB,WAAW,EAAE,KAAK;KACnB;IACD,KAAK,EAAE;QACL,MAAM,EAAE,EAAE,IAAI,EAAE,eAAe,EAAE,GAAG,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,EAAE;KAC/D;IACD,oBAAoB;IACpB,QAAQ,EAAE;QACR,MAAM,EAAE,OAAO;QACf,SAAS,EAAE,CAAC;KACb;IACD,iBAAiB;IACjB,SAAS,EAAE;QACT,KAAK,EAAE;YACL,KAAK,EAAE,EAAE,UAAU,EAAE,GAAG,EAAE,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC,EAAE;SACnG;QACD,OAAO,EAAE;YACP,KAAK,EAAE;gBACL,UAAU,EAAE,MAAM;gBAClB,KAAK,EAAE,qBAAqB;gBAC5B,SAAS,EAAE,QAAQ;gBACnB,QAAQ,EAAE,MAAM;gBAChB,UAAU,EAAE,CAAC;aACd;SACF;KACF;IACD,8BAA8B;IAC9B,KAAK,EAAE;QACL,UAAU,EAAE;YACV,UAAU,EAAE;gBACV,IAAI,EAAE;oBACJ,OAAO,EAAE,KAAK;iBACf;aACF;SACF;KACF;CACF,CAAC,CAAC","sourcesContent":["import { Plot } from '../../core/plot';\nimport { deepAssign } from '../../utils';\n\n/**\n * 饼图默认配置项\n */\nexport const DEFAULT_OPTIONS = deepAssign({}, Plot.getDefaultOptions(), {\n legend: {\n position: 'right',\n },\n tooltip: {\n shared: false,\n showTitle: false,\n showMarkers: false,\n },\n label: {\n layout: { type: 'limit-in-plot', cfg: { action: 'ellipsis' } },\n },\n /** 饼图样式, 不影响暗黑主题 */\n pieStyle: {\n stroke: 'white',\n lineWidth: 1,\n },\n /** 饼图中心文本默认样式 */\n statistic: {\n title: {\n style: { fontWeight: 300, color: '#4B535E', textAlign: 'center', fontSize: '20px', lineHeight: 1 },\n },\n content: {\n style: {\n fontWeight: 'bold',\n color: 'rgba(44,53,66,0.85)',\n textAlign: 'center',\n fontSize: '32px',\n lineHeight: 1,\n },\n },\n },\n /** 默认关闭 text-annotation 动画 */\n theme: {\n components: {\n annotation: {\n text: {\n animate: false,\n },\n },\n },\n },\n});\n"]}
1
+ {"version":3,"file":"contants.js","sourceRoot":"","sources":["../../../src/plots/pie/contants.ts"],"names":[],"mappings":";;;AAAA,wCAAuC;AACvC,qCAAyC;AAEzC;;GAEG;AACU,QAAA,eAAe,GAAG,kBAAU,CAAC,EAAE,EAAE,WAAI,CAAC,iBAAiB,EAAE,EAAE;IACtE,MAAM,EAAE;QACN,QAAQ,EAAE,OAAO;QACjB,KAAK,EAAE,EAAE;KACV;IACD,OAAO,EAAE;QACP,MAAM,EAAE,KAAK;QACb,SAAS,EAAE,KAAK;QAChB,WAAW,EAAE,KAAK;KACnB;IACD,KAAK,EAAE;QACL,MAAM,EAAE,EAAE,IAAI,EAAE,eAAe,EAAE,GAAG,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,EAAE;KAC/D;IACD,oBAAoB;IACpB,QAAQ,EAAE;QACR,MAAM,EAAE,OAAO;QACf,SAAS,EAAE,CAAC;KACb;IACD,iBAAiB;IACjB,SAAS,EAAE;QACT,KAAK,EAAE;YACL,KAAK,EAAE,EAAE,UAAU,EAAE,GAAG,EAAE,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC,EAAE;SACnG;QACD,OAAO,EAAE;YACP,KAAK,EAAE;gBACL,UAAU,EAAE,MAAM;gBAClB,KAAK,EAAE,qBAAqB;gBAC5B,SAAS,EAAE,QAAQ;gBACnB,QAAQ,EAAE,MAAM;gBAChB,UAAU,EAAE,CAAC;aACd;SACF;KACF;IACD,8BAA8B;IAC9B,KAAK,EAAE;QACL,UAAU,EAAE;YACV,UAAU,EAAE;gBACV,IAAI,EAAE;oBACJ,OAAO,EAAE,KAAK;iBACf;aACF;SACF;KACF;CACF,CAAC,CAAC","sourcesContent":["import { Plot } from '../../core/plot';\nimport { deepAssign } from '../../utils';\n\n/**\n * 饼图默认配置项\n */\nexport const DEFAULT_OPTIONS = deepAssign({}, Plot.getDefaultOptions(), {\n legend: {\n position: 'right',\n radio: {},\n },\n tooltip: {\n shared: false,\n showTitle: false,\n showMarkers: false,\n },\n label: {\n layout: { type: 'limit-in-plot', cfg: { action: 'ellipsis' } },\n },\n /** 饼图样式, 不影响暗黑主题 */\n pieStyle: {\n stroke: 'white',\n lineWidth: 1,\n },\n /** 饼图中心文本默认样式 */\n statistic: {\n title: {\n style: { fontWeight: 300, color: '#4B535E', textAlign: 'center', fontSize: '20px', lineHeight: 1 },\n },\n content: {\n style: {\n fontWeight: 'bold',\n color: 'rgba(44,53,66,0.85)',\n textAlign: 'center',\n fontSize: '32px',\n lineHeight: 1,\n },\n },\n },\n /** 默认关闭 text-annotation 动画 */\n theme: {\n components: {\n annotation: {\n text: {\n animate: false,\n },\n },\n },\n },\n});\n"]}
@@ -5,25 +5,42 @@ export declare type StatisticData = {
5
5
  value: string | number | null;
6
6
  };
7
7
  export interface PieOptions extends Options {
8
- /** 角度映射字段 */
8
+ /**
9
+ * @title 角度映射字段
10
+ */
9
11
  readonly angleField: string;
10
- /** 颜色映射字段 */
12
+ /**
13
+ * @title 颜色映射字段
14
+ */
11
15
  readonly colorField: string;
12
- /** 饼图半径 */
16
+ /**
17
+ * @title 饼图半径
18
+ */
13
19
  readonly radius?: number;
14
- /** 饼图内半径 */
20
+ /**
21
+ * @title 饼图内半径
22
+ */
15
23
  readonly innerRadius?: number;
16
- /** 饼图标签,type: 'inner' | 'outer' | 'spider' */
24
+ /**
25
+ * @title 饼图标签
26
+ * @description type: 'inner' | 'outer' | 'spider'
27
+ */
17
28
  readonly label?: Label;
18
- /** 饼图图形样式 */
29
+ /**
30
+ * @title 饼图图形样式
31
+ */
19
32
  readonly pieStyle?: StyleAttr;
20
- /** 圆环的开始角度 */
33
+ /**
34
+ * @title 圆环的开始角度
35
+ */
21
36
  readonly startAngle?: number;
22
- /** 圆环的结束角度 */
37
+ /**
38
+ * @title 圆环的结束角度
39
+ */
23
40
  readonly endAngle?: number;
24
41
  /**
25
- * 指标卡组件: 显示在环图中心,可以代替tooltip,显示环图数据的总计值和各项数据
26
- * 启用 statistic 组件的同时将自动关闭tooltip
42
+ * @title 指标卡组件
43
+ * @description 显示在环图中心,可以代替tooltip,显示环图数据的总计值和各项数据,启用 statistic 组件的同时将自动关闭tooltip
27
44
  */
28
45
  readonly statistic?: Statistic;
29
46
  }
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/plots/pie/types.ts"],"names":[],"mappings":"","sourcesContent":["import { Options, Statistic, StyleAttr } from '../../types';\nimport { Label } from '../../types/label';\n\nexport type StatisticData = {\n title: string;\n value: string | number | null;\n};\n\nexport interface PieOptions extends Options {\n /** 角度映射字段 */\n readonly angleField: string;\n /** 颜色映射字段 */\n readonly colorField: string;\n /** 饼图半径 */\n readonly radius?: number;\n /** 饼图内半径 */\n readonly innerRadius?: number;\n /** 饼图标签,type: 'inner' | 'outer' | 'spider' */\n readonly label?: Label;\n /** 饼图图形样式 */\n readonly pieStyle?: StyleAttr;\n // 设置扇形图\n /** 圆环的开始角度 */\n readonly startAngle?: number;\n /** 圆环的结束角度 */\n readonly endAngle?: number;\n /**\n * 指标卡组件: 显示在环图中心,可以代替tooltip,显示环图数据的总计值和各项数据\n * 启用 statistic 组件的同时将自动关闭tooltip\n */\n readonly statistic?: Statistic;\n}\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/plots/pie/types.ts"],"names":[],"mappings":"","sourcesContent":["import { Options, Statistic, StyleAttr } from '../../types';\nimport { Label } from '../../types/label';\n\nexport type StatisticData = {\n title: string;\n value: string | number | null;\n};\n\nexport interface PieOptions extends Options {\n /**\n * @title 角度映射字段\n */\n readonly angleField: string;\n /**\n * @title 颜色映射字段\n */\n readonly colorField: string;\n /**\n * @title 饼图半径\n */\n readonly radius?: number;\n /**\n * @title 饼图内半径\n */\n readonly innerRadius?: number;\n /**\n * @title 饼图标签\n * @description type: 'inner' | 'outer' | 'spider'\n */\n readonly label?: Label;\n /**\n * @title 饼图图形样式\n */\n readonly pieStyle?: StyleAttr;\n // 设置扇形图\n /**\n * @title 圆环的开始角度\n */\n readonly startAngle?: number;\n /**\n * @title 圆环的结束角度\n */\n readonly endAngle?: number;\n /**\n * @title 指标卡组件\n * @description 显示在环图中心,可以代替tooltip,显示环图数据的总计值和各项数据,启用 statistic 组件的同时将自动关闭tooltip\n */\n readonly statistic?: Statistic;\n}\n"]}
@@ -28,6 +28,7 @@ function geometry(params) {
28
28
  },
29
29
  args: {
30
30
  zIndexReversed: true,
31
+ sortZIndex: true,
31
32
  },
32
33
  },
33
34
  });
@@ -1 +1 @@
1
- {"version":3,"file":"adaptor.js","sourceRoot":"","sources":["../../../src/plots/progress/adaptor.ts"],"names":[],"mappings":";;;AAAA,mCAAsC;AAEtC,qCAA+C;AAC/C,+CAA2E;AAC3E,uDAAoD;AAEpD,yCAA4C;AAC5C,iCAA0C;AAE1C;;;GAGG;AACH,SAAgB,QAAQ,CAAC,MAA+B;IAC9C,IAAA,KAAK,GAAc,MAAM,MAApB,EAAE,OAAO,GAAK,MAAM,QAAX,CAAY;IAC1B,IAAA,OAAO,GAA0C,OAAO,Q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AU,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC;AACvF,CAAC;AAHD,0BAGC","sourcesContent":["import { isString } from '@antv/util';\nimport { Params } from '../../core/adaptor';\nimport { flow, deepAssign } from '../../utils';\nimport { scale, animation, theme, annotation } from '../../adaptor/common';\nimport { interval } from '../../adaptor/geometries';\nimport { ProgressOptions } from './types';\nimport { DEFAULT_COLOR } from './constants';\nimport { getProgressData } from './utils';\n\n/**\n * 字段\n * @param params\n */\nexport function geometry(params: Params<ProgressOptions>): Params<ProgressOptions> {\n const { chart, options } = params;\n const { percent, progressStyle, color, barWidthRatio } = options;\n\n chart.data(getProgressData(percent));\n\n const p = deepAssign({}, params, {\n options: {\n xField: '1',\n yField: 'percent',\n seriesField: 'type',\n isStack: true,\n widthRatio: barWidthRatio,\n interval: {\n style: progressStyle,\n color: isString(color) ? [color, DEFAULT_COLOR[1]] : color,\n },\n args: {\n zIndexReversed: true,\n },\n },\n });\n\n interval(p);\n\n // 关闭组件\n chart.tooltip(false);\n chart.axis(false);\n chart.legend(false);\n\n return params;\n}\n\n/**\n * other 配置\n * @param params\n */\nfunction coordinate(params: Params<ProgressOptions>): Params<ProgressOptions> {\n const { chart } = params;\n\n chart.coordinate('rect').transpose();\n\n return params;\n}\n\n/**\n * 进度图适配器\n * @param chart\n * @param options\n */\nexport function adaptor(params: Params<ProgressOptions>) {\n // @ts-ignore\n return flow(geometry, scale({}), coordinate, animation, theme, annotation())(params);\n}\n"]}
1
+ {"version":3,"file":"adaptor.js","sourceRoot":"","sources":["../../../src/plots/progress/adaptor.ts"],"names":[],"mappings":";;;AAAA,mCAAsC;AAEtC,qCAA+C;AAC/C,+CAA2E;AAC3E,uDAAoD;AAEpD,yCAA4C;AAC5C,iCAA0C;AAE1C;;;GAGG;AACH,SAAgB,QAAQ,CAAC,MAA+B;IAC9C,IAAA,KAAK,GAAc,MAAM,MAApB,EAAE,OAAO,GAAK,MAAM,QAAX,CAAY;IAC1B,IAAA,OAAO,GAA0C,OAAO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BAAS,EAAE,cAAK,EAAE,mBAAU,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC;AACvF,CAAC;AAHD,0BAGC","sourcesContent":["import { isString } from '@antv/util';\nimport { Params } from '../../core/adaptor';\nimport { flow, deepAssign } from '../../utils';\nimport { scale, animation, theme, annotation } from '../../adaptor/common';\nimport { interval } from '../../adaptor/geometries';\nimport { ProgressOptions } from './types';\nimport { DEFAULT_COLOR } from './constants';\nimport { getProgressData } from './utils';\n\n/**\n * 字段\n * @param params\n */\nexport function geometry(params: Params<ProgressOptions>): Params<ProgressOptions> {\n const { chart, options } = params;\n const { percent, progressStyle, color, barWidthRatio } = options;\n\n chart.data(getProgressData(percent));\n\n const p = deepAssign({}, params, {\n options: {\n xField: '1',\n yField: 'percent',\n seriesField: 'type',\n isStack: true,\n widthRatio: barWidthRatio,\n interval: {\n style: progressStyle,\n color: isString(color) ? [color, DEFAULT_COLOR[1]] : color,\n },\n args: {\n zIndexReversed: true,\n sortZIndex: true,\n },\n },\n });\n\n interval(p);\n\n // 关闭组件\n chart.tooltip(false);\n chart.axis(false);\n chart.legend(false);\n\n return params;\n}\n\n/**\n * other 配置\n * @param params\n */\nfunction coordinate(params: Params<ProgressOptions>): Params<ProgressOptions> {\n const { chart } = params;\n\n chart.coordinate('rect').transpose();\n\n return params;\n}\n\n/**\n * 进度图适配器\n * @param chart\n * @param options\n */\nexport function adaptor(params: Params<ProgressOptions>) {\n // @ts-ignore\n return flow(geometry, scale({}), coordinate, animation, theme, annotation())(params);\n}\n"]}
@@ -1,12 +1,21 @@
1
1
  import { Options, StyleAttr, ColorAttr } from '../../types';
2
2
  /** mini 图类型定义需要 omit 很多的 G2 Options 配置 */
3
3
  export interface ProgressOptions extends Omit<Options, 'data' | 'color'> {
4
- /** 进度百分比 */
4
+ /**
5
+ * @title 进度百分比
6
+ */
5
7
  readonly percent: number;
6
- /** 条图宽度占比 [0-1] */
8
+ /**
9
+ * @title 条图宽度占比
10
+ * @description 范围[0-1]
11
+ */
7
12
  readonly barWidthRatio?: number;
8
- /** 进度条颜色 */
13
+ /**
14
+ * @title 进度条颜色
15
+ */
9
16
  readonly color?: ColorAttr;
10
- /** 进度条样式 */
17
+ /**
18
+ * @title 进度条样式
19
+ */
11
20
  readonly progressStyle?: StyleAttr;
12
21
  }
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/plots/progress/types.ts"],"names":[],"mappings":"","sourcesContent":["import { Options, StyleAttr, ColorAttr } from '../../types';\n\n/** mini 图类型定义需要 omit 很多的 G2 Options 配置 */\nexport interface ProgressOptions extends Omit<Options, 'data' | 'color'> {\n /** 进度百分比 */\n readonly percent: number;\n /** 条图宽度占比 [0-1] */\n readonly barWidthRatio?: number;\n /** 进度条颜色 */\n readonly color?: ColorAttr;\n /** 进度条样式 */\n readonly progressStyle?: StyleAttr;\n}\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/plots/progress/types.ts"],"names":[],"mappings":"","sourcesContent":["import { Options, StyleAttr, ColorAttr } from '../../types';\n\n/** mini 图类型定义需要 omit 很多的 G2 Options 配置 */\nexport interface ProgressOptions extends Omit<Options, 'data' | 'color'> {\n /**\n * @title 进度百分比\n */\n readonly percent: number;\n /**\n * @title 条图宽度占比\n * @description 范围[0-1]\n */\n readonly barWidthRatio?: number;\n /**\n * @title 进度条颜色\n */\n readonly color?: ColorAttr;\n /**\n * @title 进度条样式\n */\n readonly progressStyle?: StyleAttr;\n}\n"]}
@@ -1,28 +1,55 @@
1
1
  import { PointGeometryOptions, AreaGeometryOptions } from '../../adaptor/geometries';
2
2
  import { Options, ShapeStyle } from '../../types';
3
3
  export interface RadarOptions extends Options {
4
- /** x 字段 */
4
+ /**
5
+ * @title x轴字段
6
+ */
5
7
  readonly xField: string;
6
- /** y 字段,映射雷达图的射线长度 */
8
+ /**
9
+ * @title y轴字段
10
+ * @description 映射雷达图的射线长度
11
+ */
7
12
  readonly yField: string;
8
- /** 分组字段 */
13
+ /**
14
+ * @title 分组字段
15
+ */
9
16
  readonly seriesField?: string;
10
- /** 是否平滑 */
17
+ /**
18
+ * @title 是否平滑
19
+ * @default false
20
+ */
11
21
  readonly smooth?: boolean;
12
- /** 折线图形样式 */
22
+ /**
23
+ * @title 折线图形样式
24
+ */
13
25
  readonly lineStyle?: ShapeStyle | ((x: any, y: any, series?: any) => ShapeStyle);
14
- /** 数据点图形样式 */
26
+ /**
27
+ * @title 数据点图形样式
28
+ */
15
29
  readonly point?: PointGeometryOptions['point'] & Pick<PointGeometryOptions, 'state'>;
16
- /** area 图形样式, 均提供回调的方式, 不开放 field 映射配置 */
30
+ /**
31
+ * @title area 图形样式
32
+ * @description 均提供回调的方式, 不开放 field 映射配置
33
+ */
17
34
  readonly area?: AreaGeometryOptions['area'];
18
- /** 角度轴配置 */
35
+ /**
36
+ * @title 角度轴配置
37
+ */
19
38
  readonly xAxis?: any;
20
- /** 径向轴配置 */
39
+ /**
40
+ * @title 径向轴配置
41
+ */
21
42
  readonly yAxis?: any;
22
- /** 雷达图半径 */
43
+ /**
44
+ * @title 雷达图半径
45
+ */
23
46
  readonly radius?: number;
24
- /** 雷达图开始角度 */
47
+ /**
48
+ * @title 雷达图开始角度
49
+ */
25
50
  readonly startAngle?: number;
26
- /** 雷达图结束角度 */
51
+ /**
52
+ * @title 雷达图结束角度
53
+ */
27
54
  readonly endAngle?: number;
28
55
  }
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/plots/radar/types.ts"],"names":[],"mappings":"","sourcesContent":["import { PointGeometryOptions, AreaGeometryOptions } from '../../adaptor/geometries';\nimport { Options, ShapeStyle } from '../../types';\n\nexport interface RadarOptions extends Options {\n /** x 字段 */\n readonly xField: string;\n /** y 字段,映射雷达图的射线长度 */\n readonly yField: string;\n /** 分组字段 */\n readonly seriesField?: string;\n /** 是否平滑 */\n readonly smooth?: boolean;\n /** 折线图形样式 */\n readonly lineStyle?: ShapeStyle | ((x: any, y: any, series?: any) => ShapeStyle);\n /** 数据点图形样式 */\n readonly point?: PointGeometryOptions['point'] & Pick<PointGeometryOptions, 'state'>;\n /** area 图形样式, 均提供回调的方式, 不开放 field 映射配置 */\n readonly area?: AreaGeometryOptions['area'];\n /** 角度轴配置 */\n readonly xAxis?: any;\n /** 径向轴配置 */\n readonly yAxis?: any;\n /** 雷达图半径 */\n readonly radius?: number;\n /** 雷达图开始角度 */\n readonly startAngle?: number;\n /** 雷达图结束角度 */\n readonly endAngle?: number;\n}\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/plots/radar/types.ts"],"names":[],"mappings":"","sourcesContent":["import { PointGeometryOptions, AreaGeometryOptions } from '../../adaptor/geometries';\nimport { Options, ShapeStyle } from '../../types';\n\nexport interface RadarOptions extends Options {\n /**\n * @title x轴字段\n */\n readonly xField: string;\n /**\n * @title y轴字段\n * @description 映射雷达图的射线长度\n */\n readonly yField: string;\n /**\n * @title 分组字段\n */\n readonly seriesField?: string;\n /**\n * @title 是否平滑\n * @default false\n */\n readonly smooth?: boolean;\n /**\n * @title 折线图形样式\n */\n readonly lineStyle?: ShapeStyle | ((x: any, y: any, series?: any) => ShapeStyle);\n /**\n * @title 数据点图形样式\n */\n readonly point?: PointGeometryOptions['point'] & Pick<PointGeometryOptions, 'state'>;\n /**\n * @title area 图形样式\n * @description 均提供回调的方式, 不开放 field 映射配置\n */\n readonly area?: AreaGeometryOptions['area'];\n /**\n * @title 角度轴配置\n */\n readonly xAxis?: any;\n /**\n * @title 径向轴配置\n */\n readonly yAxis?: any;\n /**\n * @title 雷达图半径\n */\n readonly radius?: number;\n /**\n * @title 雷达图开始角度\n */\n readonly startAngle?: number;\n /**\n * @title 雷达图结束角度\n */\n readonly endAngle?: number;\n}\n"]}
@@ -3,28 +3,55 @@ import { Options } from '../../types';
3
3
  import { BarOptions } from '../bar';
4
4
  /** 配置类型定义 */
5
5
  export interface RadialBarOptions extends Options, Pick<BarOptions, 'barBackground' | 'minBarWidth' | 'maxBarWidth'> {
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 barStyle?: ShapeAttrs;
12
- /** 最大旋转角度 0~360 */
18
+ /**
19
+ * @title 最大旋转角度
20
+ * @description 范围0-360
21
+ */
13
22
  readonly maxAngle?: number;
14
- /** 圆半径 */
23
+ /**
24
+ * @title 圆半径
25
+ */
15
26
  readonly radius?: number;
16
- /** 圆内半径 */
27
+ /**
28
+ * @title 圆内半径
29
+ */
17
30
  readonly innerRadius?: number;
18
- /** 圆环的开始角度 */
31
+ /**
32
+ * @title 圆环的开始角度
33
+ */
19
34
  readonly startAngle?: number;
20
- /** 圆环的结束角度 */
35
+ /**
36
+ * @title 圆环的结束角度
37
+ */
21
38
  readonly endAngle?: number;
22
- /** 颜色字段 */
39
+ /**
40
+ * @title 颜色字段
41
+ */
23
42
  readonly colorField?: string;
24
- /** 类型 */
43
+ /**
44
+ * @title 类型
45
+ */
25
46
  readonly type?: string;
26
- /** 叠加 */
47
+ /**
48
+ * @title 是否叠加
49
+ * @default false
50
+ */
27
51
  readonly isStack?: boolean;
28
- /** 分组 */
52
+ /**
53
+ * @title 是否分组
54
+ * @default false
55
+ */
29
56
  readonly isGroup?: boolean;
30
57
  }
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/plots/radial-bar/types.ts"],"names":[],"mappings":"","sourcesContent":["import { ShapeAttrs } from '@antv/g-base';\nimport { Options } from '../../types';\nimport { BarOptions } from '../bar';\n\n/** 配置类型定义 */\nexport interface RadialBarOptions extends Options, Pick<BarOptions, 'barBackground' | 'minBarWidth' | 'maxBarWidth'> {\n /** x 轴字段 */\n readonly xField?: string;\n /** y 轴字段 */\n readonly yField?: string;\n /** 样式 */\n readonly barStyle?: ShapeAttrs;\n /** 最大旋转角度 0~360 */\n readonly maxAngle?: number;\n /** 圆半径 */\n readonly radius?: number;\n /** 圆内半径 */\n readonly innerRadius?: number;\n /** 圆环的开始角度 */\n readonly startAngle?: number;\n /** 圆环的结束角度 */\n readonly endAngle?: number;\n /** 颜色字段 */\n readonly colorField?: string;\n /** 类型 */\n readonly type?: string;\n /** 叠加 */\n readonly isStack?: boolean;\n /** 分组 */\n readonly isGroup?: boolean;\n}\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/plots/radial-bar/types.ts"],"names":[],"mappings":"","sourcesContent":["import { ShapeAttrs } from '@antv/g-base';\nimport { Options } from '../../types';\nimport { BarOptions } from '../bar';\n\n/** 配置类型定义 */\nexport interface RadialBarOptions extends Options, Pick<BarOptions, 'barBackground' | 'minBarWidth' | 'maxBarWidth'> {\n /**\n * @title x轴字段\n */\n readonly xField?: string;\n /**\n * @title y轴字段\n */\n readonly yField?: string;\n /**\n * @title 样式\n */\n readonly barStyle?: ShapeAttrs;\n /**\n * @title 最大旋转角度\n * @description 范围0-360\n */\n readonly maxAngle?: number;\n /**\n * @title 圆半径\n */\n readonly radius?: number;\n /**\n * @title 圆内半径\n */\n readonly innerRadius?: number;\n /**\n * @title 圆环的开始角度\n */\n readonly startAngle?: number;\n /**\n * @title 圆环的结束角度\n */\n readonly endAngle?: number;\n /**\n * @title 颜色字段\n */\n readonly colorField?: string;\n /**\n * @title 类型\n */\n readonly type?: string;\n /**\n * @title 是否叠加\n * @default false\n */\n readonly isStack?: boolean;\n /**\n * @title 是否分组\n * @default false\n */\n readonly isGroup?: boolean;\n}\n"]}
@@ -1,16 +1,28 @@
1
1
  import { Options, StyleAttr, ColorAttr, Statistic } from '../../types';
2
2
  /** mini 图类型定义需要 omit 很多的 G2 Options 配置 */
3
3
  export interface RingProgressOptions extends Omit<Options, 'data' | 'tooltip' | 'legend' | 'label' | 'color'> {
4
- /** 进度百分比 */
4
+ /**
5
+ * @title 进度百分比
6
+ */
5
7
  readonly percent: number;
6
- /** 外环的半径 */
8
+ /**
9
+ * @title 外环的半径
10
+ */
7
11
  readonly radius?: number;
8
- /** 内环的半径 */
12
+ /**
13
+ * @title 内环的半径
14
+ */
9
15
  readonly innerRadius?: number;
10
- /** 进度条颜色 */
16
+ /**
17
+ * @title 进度条颜色
18
+ */
11
19
  readonly color?: ColorAttr;
12
- /** 进度条样式 */
20
+ /**
21
+ * @title 进度条样式
22
+ */
13
23
  readonly progressStyle?: StyleAttr;
14
- /** 统计内容组件 */
24
+ /**
25
+ * @title 统计内容组件
26
+ */
15
27
  readonly statistic?: Statistic;
16
28
  }
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/plots/ring-progress/types.ts"],"names":[],"mappings":"","sourcesContent":["import { Options, StyleAttr, ColorAttr, Statistic } from '../../types';\n\n/** mini 图类型定义需要 omit 很多的 G2 Options 配置 */\nexport interface RingProgressOptions extends Omit<Options, 'data' | 'tooltip' | 'legend' | 'label' | 'color'> {\n /** 进度百分比 */\n readonly percent: number;\n /** 外环的半径 */\n readonly radius?: number;\n /** 内环的半径 */\n readonly innerRadius?: number;\n /** 进度条颜色 */\n readonly color?: ColorAttr;\n /** 进度条样式 */\n readonly progressStyle?: StyleAttr;\n /** 统计内容组件 */\n readonly statistic?: Statistic;\n}\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/plots/ring-progress/types.ts"],"names":[],"mappings":"","sourcesContent":["import { Options, StyleAttr, ColorAttr, Statistic } from '../../types';\n\n/** mini 图类型定义需要 omit 很多的 G2 Options 配置 */\nexport interface RingProgressOptions extends Omit<Options, 'data' | 'tooltip' | 'legend' | 'label' | 'color'> {\n /**\n * @title 进度百分比\n */\n readonly percent: number;\n /**\n * @title 外环的半径\n */\n readonly radius?: number;\n /**\n * @title 内环的半径\n */\n readonly innerRadius?: number;\n /**\n * @title 进度条颜色\n */\n readonly color?: ColorAttr;\n /**\n * @title 进度条样式\n */\n readonly progressStyle?: StyleAttr;\n /**\n * @title 统计内容组件\n */\n readonly statistic?: Statistic;\n}\n"]}
@@ -11,6 +11,7 @@ exports.DEFAULT_OPTIONS = utils_1.deepAssign({}, plot_1.Plot.getDefaultOptions()
11
11
  yAxis: false,
12
12
  legend: {
13
13
  position: 'right',
14
+ radio: {},
14
15
  },
15
16
  sectorStyle: {
16
17
  stroke: '#fff',
@@ -1 +1 @@
1
- {"version":3,"file":"constant.js","sourceRoot":"","sources":["../../../src/plots/rose/constant.ts"],"names":[],"mappings":";;;AAAA,wCAAuC;AACvC,qCAAyC;AAEzC;;GAEG;AACU,QAAA,eAAe,GAAG,kBAAU,CAAC,EAAE,EAAE,WAAI,CAAC,iBAAiB,EAAE,EAAE;IACtE,KAAK,EAAE,KAAK;IACZ,KAAK,EAAE,KAAK;IACZ,MAAM,EAAE;QACN,QAAQ,EAAE,OAAO;KAClB;IACD,WAAW,EAAE;QACX,MAAM,EAAE,MAAM;QACd,SAAS,EAAE,CAAC;KACb;IACD,KAAK,EAAE;QACL,MAAM,EAAE;YACN,IAAI,EAAE,gBAAgB;SACvB;KACF;IACD,OAAO,EAAE;QACP,MAAM,EAAE,IAAI;QACZ,WAAW,EAAE,KAAK;KACnB;IACD,YAAY,EAAE,CAAC,EAAE,IAAI,EAAE,eAAe,EAAE,CAAC;CAC1C,CAAC,CAAC","sourcesContent":["import { Plot } from '../../core/plot';\nimport { deepAssign } from '../../utils';\n\n/**\n * 玫瑰图 默认配置项\n */\nexport const DEFAULT_OPTIONS = deepAssign({}, Plot.getDefaultOptions(), {\n xAxis: false,\n yAxis: false,\n legend: {\n position: 'right',\n },\n sectorStyle: {\n stroke: '#fff',\n lineWidth: 1,\n },\n label: {\n layout: {\n type: 'limit-in-shape',\n },\n },\n tooltip: {\n shared: true,\n showMarkers: false,\n },\n interactions: [{ type: 'active-region' }],\n});\n"]}
1
+ {"version":3,"file":"constant.js","sourceRoot":"","sources":["../../../src/plots/rose/constant.ts"],"names":[],"mappings":";;;AAAA,wCAAuC;AACvC,qCAAyC;AAEzC;;GAEG;AACU,QAAA,eAAe,GAAG,kBAAU,CAAC,EAAE,EAAE,WAAI,CAAC,iBAAiB,EAAE,EAAE;IACtE,KAAK,EAAE,KAAK;IACZ,KAAK,EAAE,KAAK;IACZ,MAAM,EAAE;QACN,QAAQ,EAAE,OAAO;QACjB,KAAK,EAAE,EAAE;KACV;IACD,WAAW,EAAE;QACX,MAAM,EAAE,MAAM;QACd,SAAS,EAAE,CAAC;KACb;IACD,KAAK,EAAE;QACL,MAAM,EAAE;YACN,IAAI,EAAE,gBAAgB;SACvB;KACF;IACD,OAAO,EAAE;QACP,MAAM,EAAE,IAAI;QACZ,WAAW,EAAE,KAAK;KACnB;IACD,YAAY,EAAE,CAAC,EAAE,IAAI,EAAE,eAAe,EAAE,CAAC;CAC1C,CAAC,CAAC","sourcesContent":["import { Plot } from '../../core/plot';\nimport { deepAssign } from '../../utils';\n\n/**\n * 玫瑰图 默认配置项\n */\nexport const DEFAULT_OPTIONS = deepAssign({}, Plot.getDefaultOptions(), {\n xAxis: false,\n yAxis: false,\n legend: {\n position: 'right',\n radio: {},\n },\n sectorStyle: {\n stroke: '#fff',\n lineWidth: 1,\n },\n label: {\n layout: {\n type: 'limit-in-shape',\n },\n },\n tooltip: {\n shared: true,\n showMarkers: false,\n },\n interactions: [{ type: 'active-region' }],\n});\n"]}
@@ -1,29 +1,49 @@
1
1
  import { Options, StyleAttr } from '../../types';
2
2
  export interface RoseOptions extends Options {
3
- /** 扇形切片分类所对应的数据字段名(每个扇形的弧度相等) */
3
+ /**
4
+ * @title 扇形切片分类所对应的数据字段名
5
+ * @description 每个扇形的弧度相等
6
+ */
4
7
  readonly xField: string;
5
- /** 扇形切片半径长度所对应的数据字段名 */
8
+ /**
9
+ * @title 扇形切片半径长度所对应的数据字段名
10
+ */
6
11
  readonly yField: string;
7
- /** 拆分字段 */
12
+ /**
13
+ * @title 拆分字段
14
+ */
8
15
  readonly seriesField?: string;
9
- /** 是否分组玫瑰图 */
16
+ /**
17
+ * @title 是否分组玫瑰图
18
+ * @default false
19
+ */
10
20
  readonly isGroup?: boolean;
11
- /** 是否堆积玫瑰图 */
21
+ /**
22
+ * @title 是否堆积玫瑰图
23
+ * @default false
24
+ */
12
25
  readonly isStack?: boolean;
13
26
  /**
14
- * 玫瑰图的半径,原点为画布中心。配置值域为 (0,1]
15
- * 1 代表玫瑰图大小为 1,即撑满绘图区域
27
+ * @title 玫瑰图的半径
28
+ * @description 原点为画布中心。配置值域为 (0,1] 1 代表玫瑰图大小为 1,即撑满绘图区域
16
29
  */
17
30
  readonly radius?: number;
18
- /** 内部空心圆的半径,规则与 radius 一致 */
31
+ /**
32
+ * @title 内部空心圆的半径
33
+ * @description 规则与 radius 一致
34
+ */
19
35
  readonly innerRadius?: number;
20
- /** 玫瑰图开始角度 */
36
+ /**
37
+ * @title 玫瑰图开始角度
38
+ */
21
39
  readonly startAngle?: number;
22
- /** 玫瑰图结束角度 */
40
+ /**
41
+ * @title 玫瑰图结束角度
42
+ */
23
43
  readonly endAngle?: number;
24
44
  /**
25
- * 设置扇形样式。sectorStyle 中的fill会覆盖 color 的配置
26
- * sectorStyle 可以直接指定,也可以通过 callback 的方式,根据数据为每个扇形切片指定单独的样式
45
+ * @title 设置扇形样式
46
+ * @description sectorStyle 中的fill会覆盖 color 的配置,sectorStyle 可以直接指定,也可以通过 callback 的方式,根据数据为每个扇形切片指定单独的样式
27
47
  */
28
48
  readonly sectorStyle?: StyleAttr;
29
49
  }
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/plots/rose/types.ts"],"names":[],"mappings":"","sourcesContent":["import { Options, StyleAttr } from '../../types';\n\nexport interface RoseOptions extends Options {\n /** 扇形切片分类所对应的数据字段名(每个扇形的弧度相等) */\n readonly xField: string;\n /** 扇形切片半径长度所对应的数据字段名 */\n readonly yField: string;\n /** 拆分字段 */\n readonly seriesField?: string;\n /** 是否分组玫瑰图 */\n readonly isGroup?: boolean;\n /** 是否堆积玫瑰图 */\n readonly isStack?: boolean;\n /**\n * 玫瑰图的半径,原点为画布中心。配置值域为 (0,1]\n * 1 代表玫瑰图大小为 1,即撑满绘图区域\n */\n readonly radius?: number;\n /** 内部空心圆的半径,规则与 radius 一致 */\n readonly innerRadius?: number;\n /** 玫瑰图开始角度 */\n readonly startAngle?: number;\n /** 玫瑰图结束角度 */\n readonly endAngle?: number;\n /**\n * 设置扇形样式。sectorStyle 中的fill会覆盖 color 的配置\n * sectorStyle 可以直接指定,也可以通过 callback 的方式,根据数据为每个扇形切片指定单独的样式\n */\n readonly sectorStyle?: StyleAttr;\n}\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/plots/rose/types.ts"],"names":[],"mappings":"","sourcesContent":["import { Options, StyleAttr } from '../../types';\n\nexport interface RoseOptions extends Options {\n /**\n * @title 扇形切片分类所对应的数据字段名\n * @description 每个扇形的弧度相等\n */\n readonly xField: string;\n /**\n * @title 扇形切片半径长度所对应的数据字段名\n */\n readonly yField: string;\n /**\n * @title 拆分字段\n */\n readonly seriesField?: string;\n /**\n * @title 是否分组玫瑰图\n * @default false\n */\n readonly isGroup?: boolean;\n /**\n * @title 是否堆积玫瑰图\n * @default false\n */\n readonly isStack?: boolean;\n /**\n * @title 玫瑰图的半径\n * @description 原点为画布中心。配置值域为 (0,1] 1 代表玫瑰图大小为 1,即撑满绘图区域\n */\n readonly radius?: number;\n /**\n * @title 内部空心圆的半径\n * @description 规则与 radius 一致\n */\n readonly innerRadius?: number;\n /**\n * @title 玫瑰图开始角度\n */\n readonly startAngle?: number;\n /**\n * @title 玫瑰图结束角度\n */\n readonly endAngle?: number;\n /**\n * @title 设置扇形样式\n * @description sectorStyle 中的fill会覆盖 color 的配置,sectorStyle 可以直接指定,也可以通过 callback 的方式,根据数据为每个扇形切片指定单独的样式\n */\n readonly sectorStyle?: StyleAttr;\n}\n"]}
@@ -126,6 +126,35 @@ function nodeDraggable(params) {
126
126
  return params;
127
127
  }
128
128
  exports.nodeDraggable = nodeDraggable;
129
+ /**
130
+ * Interaction 配置
131
+ * @param params
132
+ */
133
+ function interaction(params) {
134
+ var chart = params.chart, options = params.options;
135
+ var _a = options.interactions, interactions = _a === void 0 ? [] : _a;
136
+ var nodeInteractions = [].concat(interactions, options.nodeInteractions || []);
137
+ var edgeInteractions = [].concat(interactions, options.edgeInteractions || []);
138
+ var nodeView = utils_1.findViewById(chart, constant_1.NODES_VIEW_ID);
139
+ var edgeView = utils_1.findViewById(chart, constant_1.EDGES_VIEW_ID);
140
+ nodeInteractions.forEach(function (i) {
141
+ if ((i === null || i === void 0 ? void 0 : i.enable) === false) {
142
+ nodeView.removeInteraction(i.type);
143
+ }
144
+ else {
145
+ nodeView.interaction(i.type, i.cfg || {});
146
+ }
147
+ });
148
+ edgeInteractions.forEach(function (i) {
149
+ if ((i === null || i === void 0 ? void 0 : i.enable) === false) {
150
+ edgeView.removeInteraction(i.type);
151
+ }
152
+ else {
153
+ edgeView.interaction(i.type, i.cfg || {});
154
+ }
155
+ });
156
+ return params;
157
+ }
129
158
  /**
130
159
  * 图适配器
131
160
  * @param chart
@@ -133,7 +162,7 @@ exports.nodeDraggable = nodeDraggable;
133
162
  */
134
163
  function adaptor(params) {
135
164
  // flow 的方式处理所有的配置到 G2 API
136
- return utils_1.flow(defaultOptions, geometry, common_1.interaction, nodeDraggable, animation, common_1.theme
165
+ return utils_1.flow(defaultOptions, geometry, interaction, nodeDraggable, animation, common_1.theme
137
166
  // ... 其他的 adaptor flow
138
167
  )(params);
139
168
  }