@antv/g2 5.0.0-beta.7 → 5.0.0-beta.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 (473) hide show
  1. package/dist/g2-lite.min.js +3 -3
  2. package/dist/g2.min.js +4 -4
  3. package/esm/animation/morphing.js +22 -2
  4. package/esm/animation/morphing.js.map +1 -1
  5. package/esm/api/chart.d.ts +8 -3
  6. package/esm/api/chart.js +35 -16
  7. package/esm/api/chart.js.map +1 -1
  8. package/esm/api/composition/base.d.ts +18 -1
  9. package/esm/api/composition/base.js +44 -1
  10. package/esm/api/composition/base.js.map +1 -1
  11. package/esm/api/mark/base.d.ts +22 -0
  12. package/esm/api/mark/base.js +54 -0
  13. package/esm/api/mark/base.js.map +1 -0
  14. package/esm/api/mark/mark.d.ts +1 -7
  15. package/esm/api/mark/mark.js +1 -13
  16. package/esm/api/mark/mark.js.map +1 -1
  17. package/esm/api/props.js +0 -20
  18. package/esm/api/props.js.map +1 -1
  19. package/esm/component/axis.d.ts +5 -7
  20. package/esm/component/axis.js +126 -94
  21. package/esm/component/axis.js.map +1 -1
  22. package/esm/component/axisArc.d.ts +7 -0
  23. package/esm/component/axisArc.js +9 -0
  24. package/esm/component/axisArc.js.map +1 -0
  25. package/esm/component/axisRadar.d.ts +9 -0
  26. package/esm/component/axisRadar.js +46 -0
  27. package/esm/component/axisRadar.js.map +1 -0
  28. package/esm/component/axisX.d.ts +2 -1
  29. package/esm/component/axisX.js +5 -4
  30. package/esm/component/axisX.js.map +1 -1
  31. package/esm/component/axisY.d.ts +1 -1
  32. package/esm/component/axisY.js +4 -4
  33. package/esm/component/axisY.js.map +1 -1
  34. package/esm/component/index.d.ts +8 -0
  35. package/esm/component/index.js +5 -0
  36. package/esm/component/index.js.map +1 -1
  37. package/esm/component/legendCategory.d.ts +5 -3
  38. package/esm/component/legendCategory.js +80 -36
  39. package/esm/component/legendCategory.js.map +1 -1
  40. package/esm/component/legendContinuous.d.ts +4 -2
  41. package/esm/component/legendContinuous.js +76 -24
  42. package/esm/component/legendContinuous.js.map +1 -1
  43. package/esm/component/legendContinuousBlock.d.ts +4 -0
  44. package/esm/component/legendContinuousBlock.js +6 -0
  45. package/esm/component/legendContinuousBlock.js.map +1 -0
  46. package/esm/component/legendContinuousBlockSize.d.ts +4 -0
  47. package/esm/component/legendContinuousBlockSize.js +6 -0
  48. package/esm/component/legendContinuousBlockSize.js.map +1 -0
  49. package/esm/component/legendContinuousSize.d.ts +4 -0
  50. package/esm/component/legendContinuousSize.js +10 -0
  51. package/esm/component/legendContinuousSize.js.map +1 -0
  52. package/esm/component/scrollbar.js +1 -1
  53. package/esm/component/scrollbar.js.map +1 -1
  54. package/esm/component/slider.js +1 -1
  55. package/esm/component/slider.js.map +1 -1
  56. package/esm/component/title.js +1 -1
  57. package/esm/component/title.js.map +1 -1
  58. package/esm/component/utils.d.ts +12 -0
  59. package/esm/component/utils.js +35 -0
  60. package/esm/component/utils.js.map +1 -1
  61. package/esm/composition/facetCircle.js +1 -1
  62. package/esm/composition/facetCircle.js.map +1 -1
  63. package/esm/coordinate/index.d.ts +3 -3
  64. package/esm/coordinate/index.js +3 -3
  65. package/esm/coordinate/index.js.map +1 -1
  66. package/esm/coordinate/polar.d.ts +6 -0
  67. package/esm/coordinate/polar.js +18 -6
  68. package/esm/coordinate/polar.js.map +1 -1
  69. package/esm/coordinate/radial.d.ts +6 -0
  70. package/esm/coordinate/radial.js +17 -5
  71. package/esm/coordinate/radial.js.map +1 -1
  72. package/esm/coordinate/theta.d.ts +7 -0
  73. package/esm/coordinate/theta.js +16 -4
  74. package/esm/coordinate/theta.js.map +1 -1
  75. package/esm/interaction/builtin/elementHighlight.d.ts +2 -0
  76. package/esm/interaction/builtin/elementHighlightByColor.d.ts +2 -0
  77. package/esm/interaction/builtin/elementHighlightByX.d.ts +2 -0
  78. package/esm/interaction/index.d.ts +2 -0
  79. package/esm/interaction/index.js +2 -0
  80. package/esm/interaction/index.js.map +1 -1
  81. package/esm/interaction/native/brushAxisHighlight.js +6 -1
  82. package/esm/interaction/native/brushAxisHighlight.js.map +1 -1
  83. package/esm/interaction/native/brushFilter.js +1 -1
  84. package/esm/interaction/native/brushFilter.js.map +1 -1
  85. package/esm/interaction/native/elementHighlight.d.ts +7 -2
  86. package/esm/interaction/native/elementHighlight.js +72 -19
  87. package/esm/interaction/native/elementHighlight.js.map +1 -1
  88. package/esm/interaction/native/elementHighlightByColor.d.ts +4 -1
  89. package/esm/interaction/native/elementHighlightByColor.js +19 -3
  90. package/esm/interaction/native/elementHighlightByColor.js.map +1 -1
  91. package/esm/interaction/native/elementHighlightByX.d.ts +3 -3
  92. package/esm/interaction/native/elementHighlightByX.js +19 -3
  93. package/esm/interaction/native/elementHighlightByX.js.map +1 -1
  94. package/esm/interaction/native/elementSelect.d.ts +1 -1
  95. package/esm/interaction/native/elementSelect.js +42 -21
  96. package/esm/interaction/native/elementSelect.js.map +1 -1
  97. package/esm/interaction/native/elementSelectByColor.js +3 -2
  98. package/esm/interaction/native/elementSelectByColor.js.map +1 -1
  99. package/esm/interaction/native/elementSelectByX.js +3 -2
  100. package/esm/interaction/native/elementSelectByX.js.map +1 -1
  101. package/esm/interaction/native/legendFilter.d.ts +6 -0
  102. package/esm/interaction/native/legendFilter.js +26 -7
  103. package/esm/interaction/native/legendFilter.js.map +1 -1
  104. package/esm/interaction/native/legendHighlight.d.ts +4 -0
  105. package/esm/interaction/native/legendHighlight.js +93 -0
  106. package/esm/interaction/native/legendHighlight.js.map +1 -0
  107. package/esm/interaction/native/poptip.d.ts +5 -0
  108. package/esm/interaction/native/poptip.js +91 -0
  109. package/esm/interaction/native/poptip.js.map +1 -0
  110. package/esm/interaction/native/utils.d.ts +13 -2
  111. package/esm/interaction/native/utils.js +151 -26
  112. package/esm/interaction/native/utils.js.map +1 -1
  113. package/esm/label-transform/overlapDodgeY.js +0 -8
  114. package/esm/label-transform/overlapDodgeY.js.map +1 -1
  115. package/esm/mark/area.js +1 -1
  116. package/esm/mark/area.js.map +1 -1
  117. package/esm/mark/pack.js +0 -1
  118. package/esm/mark/pack.js.map +1 -1
  119. package/esm/mark/treemap.js +0 -1
  120. package/esm/mark/treemap.js.map +1 -1
  121. package/esm/runtime/component.d.ts +3 -0
  122. package/esm/runtime/component.js +246 -103
  123. package/esm/runtime/component.js.map +1 -1
  124. package/esm/runtime/coordinate.d.ts +11 -0
  125. package/esm/runtime/coordinate.js +23 -16
  126. package/esm/runtime/coordinate.js.map +1 -1
  127. package/esm/runtime/layout.d.ts +1 -1
  128. package/esm/runtime/layout.js +145 -76
  129. package/esm/runtime/layout.js.map +1 -1
  130. package/esm/runtime/plot.js +5 -4
  131. package/esm/runtime/plot.js.map +1 -1
  132. package/esm/runtime/render.js +18 -13
  133. package/esm/runtime/render.js.map +1 -1
  134. package/esm/runtime/scale.d.ts +2 -1
  135. package/esm/runtime/scale.js +35 -0
  136. package/esm/runtime/scale.js.map +1 -1
  137. package/esm/runtime/transform.js +1 -1
  138. package/esm/runtime/transform.js.map +1 -1
  139. package/esm/runtime/types/common.d.ts +11 -2
  140. package/esm/runtime/types/component.d.ts +9 -7
  141. package/esm/runtime/types/options.d.ts +8 -6
  142. package/esm/runtime/types/scale.d.ts +18 -0
  143. package/esm/runtime/types/scale.js +19 -0
  144. package/esm/runtime/types/scale.js.map +1 -0
  145. package/esm/runtime/types/theme.d.ts +2 -1
  146. package/esm/shape/area/hv.d.ts +3 -0
  147. package/esm/shape/area/hv.js +9 -0
  148. package/esm/shape/area/hv.js.map +1 -0
  149. package/esm/shape/area/hvh.d.ts +3 -0
  150. package/esm/shape/area/{step.js → hvh.js} +3 -3
  151. package/esm/shape/area/hvh.js.map +1 -0
  152. package/esm/shape/area/vh.d.ts +3 -0
  153. package/esm/shape/area/vh.js +9 -0
  154. package/esm/shape/area/vh.js.map +1 -0
  155. package/esm/shape/connector/connector.js +1 -1
  156. package/esm/shape/index.d.ts +6 -2
  157. package/esm/shape/index.js +3 -1
  158. package/esm/shape/index.js.map +1 -1
  159. package/esm/shape/interval/color.d.ts +1 -0
  160. package/esm/shape/interval/color.js +65 -53
  161. package/esm/shape/interval/color.js.map +1 -1
  162. package/esm/shape/utils.js.map +1 -1
  163. package/esm/spec/composition.d.ts +0 -3
  164. package/esm/spec/geometry.d.ts +1 -1
  165. package/esm/spec/interaction.d.ts +33 -15
  166. package/esm/spec/transform.d.ts +13 -3
  167. package/esm/stdlib/index.js +4 -9
  168. package/esm/stdlib/index.js.map +1 -1
  169. package/esm/theme/academy.js +10 -4
  170. package/esm/theme/academy.js.map +1 -1
  171. package/esm/theme/dark.js +10 -4
  172. package/esm/theme/dark.js.map +1 -1
  173. package/esm/theme/light.js +12 -4
  174. package/esm/theme/light.js.map +1 -1
  175. package/esm/transform/sample.js +42 -26
  176. package/esm/transform/sample.js.map +1 -1
  177. package/esm/transform/utils/lttb.d.ts +5 -0
  178. package/esm/transform/utils/lttb.js +56 -0
  179. package/esm/transform/utils/lttb.js.map +1 -0
  180. package/esm/utils/angle.d.ts +2 -0
  181. package/esm/utils/angle.js +7 -0
  182. package/esm/utils/angle.js.map +1 -0
  183. package/esm/utils/array.d.ts +8 -0
  184. package/esm/utils/array.js +35 -0
  185. package/esm/utils/array.js.map +1 -1
  186. package/esm/utils/coordinate.d.ts +4 -0
  187. package/esm/utils/coordinate.js +19 -0
  188. package/esm/utils/coordinate.js.map +1 -1
  189. package/esm/utils/event.d.ts +0 -2
  190. package/esm/utils/event.js +0 -18
  191. package/esm/utils/event.js.map +1 -1
  192. package/esm/utils/scale.d.ts +1 -0
  193. package/esm/utils/scale.js +3 -3
  194. package/esm/utils/scale.js.map +1 -1
  195. package/esm/utils/vector.d.ts +1 -1
  196. package/esm/utils/vector.js +1 -1
  197. package/lib/animation/morphing.js +22 -2
  198. package/lib/animation/morphing.js.map +1 -1
  199. package/lib/api/chart.d.ts +8 -3
  200. package/lib/api/chart.js +37 -15
  201. package/lib/api/chart.js.map +1 -1
  202. package/lib/api/composition/base.d.ts +18 -1
  203. package/lib/api/composition/base.js +44 -1
  204. package/lib/api/composition/base.js.map +1 -1
  205. package/lib/api/mark/base.d.ts +22 -0
  206. package/lib/api/mark/base.js +58 -0
  207. package/lib/api/mark/base.js.map +1 -0
  208. package/lib/api/mark/mark.d.ts +1 -7
  209. package/lib/api/mark/mark.js +28 -41
  210. package/lib/api/mark/mark.js.map +1 -1
  211. package/lib/api/props.js +0 -20
  212. package/lib/api/props.js.map +1 -1
  213. package/lib/component/axis.d.ts +5 -7
  214. package/lib/component/axis.js +127 -96
  215. package/lib/component/axis.js.map +1 -1
  216. package/lib/component/axisArc.d.ts +7 -0
  217. package/lib/component/axisArc.js +13 -0
  218. package/lib/component/axisArc.js.map +1 -0
  219. package/lib/component/axisRadar.d.ts +9 -0
  220. package/lib/component/axisRadar.js +50 -0
  221. package/lib/component/axisRadar.js.map +1 -0
  222. package/lib/component/axisX.d.ts +2 -1
  223. package/lib/component/axisX.js +6 -4
  224. package/lib/component/axisX.js.map +1 -1
  225. package/lib/component/axisY.d.ts +1 -1
  226. package/lib/component/axisY.js +3 -3
  227. package/lib/component/axisY.js.map +1 -1
  228. package/lib/component/index.d.ts +8 -0
  229. package/lib/component/index.js +12 -1
  230. package/lib/component/index.js.map +1 -1
  231. package/lib/component/legendCategory.d.ts +5 -3
  232. package/lib/component/legendCategory.js +79 -35
  233. package/lib/component/legendCategory.js.map +1 -1
  234. package/lib/component/legendContinuous.d.ts +4 -2
  235. package/lib/component/legendContinuous.js +75 -23
  236. package/lib/component/legendContinuous.js.map +1 -1
  237. package/lib/component/legendContinuousBlock.d.ts +4 -0
  238. package/lib/component/legendContinuousBlock.js +10 -0
  239. package/lib/component/legendContinuousBlock.js.map +1 -0
  240. package/lib/component/legendContinuousBlockSize.d.ts +4 -0
  241. package/lib/component/legendContinuousBlockSize.js +10 -0
  242. package/lib/component/legendContinuousBlockSize.js.map +1 -0
  243. package/lib/component/legendContinuousSize.d.ts +4 -0
  244. package/lib/component/legendContinuousSize.js +14 -0
  245. package/lib/component/legendContinuousSize.js.map +1 -0
  246. package/lib/component/scrollbar.js +1 -1
  247. package/lib/component/scrollbar.js.map +1 -1
  248. package/lib/component/slider.js +1 -1
  249. package/lib/component/slider.js.map +1 -1
  250. package/lib/component/title.js +1 -1
  251. package/lib/component/title.js.map +1 -1
  252. package/lib/component/utils.d.ts +12 -0
  253. package/lib/component/utils.js +39 -1
  254. package/lib/component/utils.js.map +1 -1
  255. package/lib/composition/facetCircle.js +1 -1
  256. package/lib/composition/facetCircle.js.map +1 -1
  257. package/lib/coordinate/index.d.ts +3 -3
  258. package/lib/coordinate/index.js +4 -1
  259. package/lib/coordinate/index.js.map +1 -1
  260. package/lib/coordinate/polar.d.ts +6 -0
  261. package/lib/coordinate/polar.js +20 -7
  262. package/lib/coordinate/polar.js.map +1 -1
  263. package/lib/coordinate/radial.d.ts +6 -0
  264. package/lib/coordinate/radial.js +19 -6
  265. package/lib/coordinate/radial.js.map +1 -1
  266. package/lib/coordinate/theta.d.ts +7 -0
  267. package/lib/coordinate/theta.js +18 -5
  268. package/lib/coordinate/theta.js.map +1 -1
  269. package/lib/interaction/builtin/elementHighlight.d.ts +2 -0
  270. package/lib/interaction/builtin/elementHighlightByColor.d.ts +2 -0
  271. package/lib/interaction/builtin/elementHighlightByX.d.ts +2 -0
  272. package/lib/interaction/index.d.ts +2 -0
  273. package/lib/interaction/index.js +5 -1
  274. package/lib/interaction/index.js.map +1 -1
  275. package/lib/interaction/native/brushAxisHighlight.js +6 -1
  276. package/lib/interaction/native/brushAxisHighlight.js.map +1 -1
  277. package/lib/interaction/native/brushFilter.js +1 -1
  278. package/lib/interaction/native/brushFilter.js.map +1 -1
  279. package/lib/interaction/native/elementHighlight.d.ts +7 -2
  280. package/lib/interaction/native/elementHighlight.js +71 -18
  281. package/lib/interaction/native/elementHighlight.js.map +1 -1
  282. package/lib/interaction/native/elementHighlightByColor.d.ts +4 -1
  283. package/lib/interaction/native/elementHighlightByColor.js +18 -2
  284. package/lib/interaction/native/elementHighlightByColor.js.map +1 -1
  285. package/lib/interaction/native/elementHighlightByX.d.ts +3 -3
  286. package/lib/interaction/native/elementHighlightByX.js +18 -2
  287. package/lib/interaction/native/elementHighlightByX.js.map +1 -1
  288. package/lib/interaction/native/elementSelect.d.ts +1 -1
  289. package/lib/interaction/native/elementSelect.js +41 -20
  290. package/lib/interaction/native/elementSelect.js.map +1 -1
  291. package/lib/interaction/native/elementSelectByColor.js +2 -1
  292. package/lib/interaction/native/elementSelectByColor.js.map +1 -1
  293. package/lib/interaction/native/elementSelectByX.js +2 -1
  294. package/lib/interaction/native/elementSelectByX.js.map +1 -1
  295. package/lib/interaction/native/legendFilter.d.ts +6 -0
  296. package/lib/interaction/native/legendFilter.js +31 -6
  297. package/lib/interaction/native/legendFilter.js.map +1 -1
  298. package/lib/interaction/native/legendHighlight.d.ts +4 -0
  299. package/lib/interaction/native/legendHighlight.js +97 -0
  300. package/lib/interaction/native/legendHighlight.js.map +1 -0
  301. package/lib/interaction/native/poptip.d.ts +5 -0
  302. package/lib/interaction/native/poptip.js +95 -0
  303. package/lib/interaction/native/poptip.js.map +1 -0
  304. package/lib/interaction/native/utils.d.ts +13 -2
  305. package/lib/interaction/native/utils.js +154 -27
  306. package/lib/interaction/native/utils.js.map +1 -1
  307. package/lib/label-transform/overlapDodgeY.js +0 -8
  308. package/lib/label-transform/overlapDodgeY.js.map +1 -1
  309. package/lib/mark/area.js +1 -1
  310. package/lib/mark/area.js.map +1 -1
  311. package/lib/mark/pack.js +0 -1
  312. package/lib/mark/pack.js.map +1 -1
  313. package/lib/mark/treemap.js +0 -1
  314. package/lib/mark/treemap.js.map +1 -1
  315. package/lib/runtime/component.d.ts +3 -0
  316. package/lib/runtime/component.js +250 -107
  317. package/lib/runtime/component.js.map +1 -1
  318. package/lib/runtime/coordinate.d.ts +11 -0
  319. package/lib/runtime/coordinate.js +26 -17
  320. package/lib/runtime/coordinate.js.map +1 -1
  321. package/lib/runtime/layout.d.ts +1 -1
  322. package/lib/runtime/layout.js +146 -77
  323. package/lib/runtime/layout.js.map +1 -1
  324. package/lib/runtime/plot.js +4 -3
  325. package/lib/runtime/plot.js.map +1 -1
  326. package/lib/runtime/render.js +20 -12
  327. package/lib/runtime/render.js.map +1 -1
  328. package/lib/runtime/scale.d.ts +2 -1
  329. package/lib/runtime/scale.js +37 -1
  330. package/lib/runtime/scale.js.map +1 -1
  331. package/lib/runtime/transform.js +1 -1
  332. package/lib/runtime/transform.js.map +1 -1
  333. package/lib/runtime/types/common.d.ts +11 -2
  334. package/lib/runtime/types/component.d.ts +9 -7
  335. package/lib/runtime/types/options.d.ts +8 -6
  336. package/lib/runtime/types/scale.d.ts +18 -0
  337. package/lib/runtime/types/scale.js +22 -0
  338. package/lib/runtime/types/scale.js.map +1 -0
  339. package/lib/runtime/types/theme.d.ts +2 -1
  340. package/lib/shape/area/hv.d.ts +3 -0
  341. package/lib/shape/area/hv.js +13 -0
  342. package/lib/shape/area/hv.js.map +1 -0
  343. package/lib/shape/area/hvh.d.ts +3 -0
  344. package/lib/shape/area/{step.js → hvh.js} +5 -5
  345. package/lib/shape/area/hvh.js.map +1 -0
  346. package/lib/shape/area/vh.d.ts +3 -0
  347. package/lib/shape/area/vh.js +13 -0
  348. package/lib/shape/area/vh.js.map +1 -0
  349. package/lib/shape/connector/connector.js +1 -1
  350. package/lib/shape/index.d.ts +6 -2
  351. package/lib/shape/index.js +7 -3
  352. package/lib/shape/index.js.map +1 -1
  353. package/lib/shape/interval/color.d.ts +1 -0
  354. package/lib/shape/interval/color.js +67 -54
  355. package/lib/shape/interval/color.js.map +1 -1
  356. package/lib/shape/utils.js.map +1 -1
  357. package/lib/spec/composition.d.ts +0 -3
  358. package/lib/spec/geometry.d.ts +1 -1
  359. package/lib/spec/interaction.d.ts +33 -15
  360. package/lib/spec/transform.d.ts +13 -3
  361. package/lib/stdlib/index.js +1 -1
  362. package/lib/stdlib/index.js.map +1 -1
  363. package/lib/theme/academy.js +10 -4
  364. package/lib/theme/academy.js.map +1 -1
  365. package/lib/theme/dark.js +10 -4
  366. package/lib/theme/dark.js.map +1 -1
  367. package/lib/theme/light.js +12 -4
  368. package/lib/theme/light.js.map +1 -1
  369. package/lib/transform/sample.js +42 -26
  370. package/lib/transform/sample.js.map +1 -1
  371. package/lib/transform/utils/lttb.d.ts +5 -0
  372. package/lib/transform/utils/lttb.js +60 -0
  373. package/lib/transform/utils/lttb.js.map +1 -0
  374. package/lib/utils/angle.d.ts +2 -0
  375. package/lib/utils/angle.js +12 -0
  376. package/lib/utils/angle.js.map +1 -0
  377. package/lib/utils/array.d.ts +8 -0
  378. package/lib/utils/array.js +38 -1
  379. package/lib/utils/array.js.map +1 -1
  380. package/lib/utils/coordinate.d.ts +4 -0
  381. package/lib/utils/coordinate.js +24 -1
  382. package/lib/utils/coordinate.js.map +1 -1
  383. package/lib/utils/event.d.ts +0 -2
  384. package/lib/utils/event.js +1 -21
  385. package/lib/utils/event.js.map +1 -1
  386. package/lib/utils/scale.d.ts +1 -0
  387. package/lib/utils/scale.js +5 -4
  388. package/lib/utils/scale.js.map +1 -1
  389. package/lib/utils/vector.d.ts +1 -1
  390. package/lib/utils/vector.js +1 -1
  391. package/package.json +7 -7
  392. package/src/animation/morphing.ts +23 -2
  393. package/src/api/chart.ts +43 -20
  394. package/src/api/composition/base.ts +46 -1
  395. package/src/api/mark/base.ts +58 -0
  396. package/src/api/mark/mark.ts +1 -20
  397. package/src/api/props.ts +0 -23
  398. package/src/component/axis.ts +199 -118
  399. package/src/component/axisArc.ts +16 -0
  400. package/src/component/axisRadar.ts +73 -0
  401. package/src/component/axisX.ts +7 -4
  402. package/src/component/axisY.ts +4 -4
  403. package/src/component/index.ts +8 -0
  404. package/src/component/legendCategory.ts +156 -35
  405. package/src/component/legendContinuous.ts +133 -32
  406. package/src/component/legendContinuousBlock.ts +17 -0
  407. package/src/component/legendContinuousBlockSize.ts +22 -0
  408. package/src/component/legendContinuousSize.ts +27 -0
  409. package/src/component/scrollbar.ts +1 -1
  410. package/src/component/slider.ts +1 -1
  411. package/src/component/title.ts +1 -1
  412. package/src/component/utils.ts +46 -0
  413. package/src/composition/facetCircle.ts +1 -1
  414. package/src/coordinate/index.ts +3 -3
  415. package/src/coordinate/polar.ts +19 -11
  416. package/src/coordinate/radial.ts +19 -10
  417. package/src/coordinate/theta.ts +18 -9
  418. package/src/interaction/index.ts +2 -0
  419. package/src/interaction/native/brushAxisHighlight.ts +9 -1
  420. package/src/interaction/native/brushFilter.ts +1 -1
  421. package/src/interaction/native/elementHighlight.ts +78 -12
  422. package/src/interaction/native/elementHighlightByColor.ts +9 -4
  423. package/src/interaction/native/elementHighlightByX.ts +9 -5
  424. package/src/interaction/native/elementSelect.ts +58 -15
  425. package/src/interaction/native/elementSelectByColor.ts +4 -1
  426. package/src/interaction/native/elementSelectByX.ts +4 -1
  427. package/src/interaction/native/legendFilter.ts +29 -7
  428. package/src/interaction/native/legendHighlight.ts +86 -0
  429. package/src/interaction/native/poptip.ts +87 -0
  430. package/src/interaction/native/utils.ts +183 -26
  431. package/src/label-transform/overlapDodgeY.ts +0 -7
  432. package/src/mark/area.ts +1 -1
  433. package/src/mark/pack.ts +0 -1
  434. package/src/mark/treemap.ts +0 -1
  435. package/src/runtime/component.ts +335 -124
  436. package/src/runtime/coordinate.ts +29 -16
  437. package/src/runtime/layout.ts +206 -97
  438. package/src/runtime/plot.ts +5 -4
  439. package/src/runtime/render.ts +26 -13
  440. package/src/runtime/scale.ts +41 -0
  441. package/src/runtime/transform.ts +3 -0
  442. package/src/runtime/types/common.ts +23 -10
  443. package/src/runtime/types/component.ts +19 -10
  444. package/src/runtime/types/options.ts +24 -16
  445. package/src/runtime/types/scale.ts +20 -0
  446. package/src/runtime/types/theme.ts +2 -1
  447. package/src/shape/area/hv.ts +20 -0
  448. package/src/shape/area/{step.ts → hvh.ts} +3 -3
  449. package/src/shape/area/vh.ts +20 -0
  450. package/src/shape/connector/connector.ts +1 -1
  451. package/src/shape/index.ts +7 -2
  452. package/src/shape/interval/color.ts +86 -54
  453. package/src/shape/utils.ts +2 -0
  454. package/src/spec/composition.ts +0 -1
  455. package/src/spec/geometry.ts +3 -1
  456. package/src/spec/interaction.ts +51 -19
  457. package/src/spec/transform.ts +27 -2
  458. package/src/stdlib/index.ts +22 -6
  459. package/src/theme/academy.ts +10 -4
  460. package/src/theme/dark.ts +10 -4
  461. package/src/theme/light.ts +12 -4
  462. package/src/transform/sample.ts +54 -18
  463. package/src/transform/utils/lttb.ts +73 -0
  464. package/src/utils/angle.ts +7 -0
  465. package/src/utils/array.ts +39 -0
  466. package/src/utils/coordinate.ts +29 -0
  467. package/src/utils/event.ts +0 -26
  468. package/src/utils/scale.ts +4 -4
  469. package/src/utils/vector.ts +1 -1
  470. package/esm/shape/area/step.d.ts +0 -3
  471. package/esm/shape/area/step.js.map +0 -1
  472. package/lib/shape/area/step.d.ts +0 -3
  473. package/lib/shape/area/step.js.map +0 -1
@@ -2,30 +2,34 @@ import { Coordinate } from '@antv/coord';
2
2
  import { Axis as AxisComponent } from '@antv/gui';
3
3
  import { Linear as LinearScale } from '@antv/scale';
4
4
  import { deepMix } from '@antv/util';
5
- import { format } from 'd3-format';
6
5
  import { extent } from 'd3-array';
6
+ import { format } from 'd3-format';
7
7
  import {
8
+ BBox,
9
+ G2Theme,
10
+ GuideComponentComponent as GCC,
11
+ GuideComponentOrientation as GCO,
12
+ GuideComponentPosition as GCP,
13
+ Scale,
14
+ } from '../runtime';
15
+ import {
16
+ angleOf,
17
+ isFisheye,
8
18
  isParallel,
9
19
  isPolar,
10
- isTranspose,
11
- isTheta,
12
20
  isRadial,
13
- isFisheye,
21
+ isTheta,
22
+ isTranspose,
23
+ isNonCartesian,
24
+ radiusOf,
14
25
  } from '../utils/coordinate';
15
26
  import { capitalizeFirst } from '../utils/helper';
16
- import {
17
- BBox,
18
- GuideComponentComponent as GCC,
19
- GuideComponentPosition,
20
- Scale,
21
- } from '../runtime';
22
27
  import { titleContent } from './utils';
23
28
 
24
29
  export type AxisOptions = {
25
- position?: GuideComponentPosition;
30
+ position?: GCP;
26
31
  zIndex?: number;
27
32
  title?: string | string[];
28
- d;
29
33
  direction?: 'left' | 'center' | 'right';
30
34
  labelFormatter?: (d: any, index: number, array: any) => string;
31
35
  tickFilter?: (datum: any, index: number, array: any) => boolean;
@@ -36,25 +40,11 @@ export type AxisOptions = {
36
40
  ) => number[];
37
41
  tickCount?: number;
38
42
  grid: any;
43
+ // options won't be overridden
44
+ important: Record<string, any>;
39
45
  [key: string]: any;
40
46
  };
41
47
 
42
- function angleOf(coordinate: Coordinate): [number, number] {
43
- const { transformations } = coordinate.getOptions();
44
- const [, startAngle, endAngle] = transformations.find(
45
- (d) => d[0] === 'polar',
46
- );
47
- return [(+startAngle * 180) / Math.PI, (+endAngle * 180) / Math.PI];
48
- }
49
-
50
- function radiusOf(coordinate: Coordinate): [number, number] {
51
- const { transformations } = coordinate.getOptions();
52
- const [, , , innerRadius, outerRadius] = transformations.find(
53
- (d) => d[0] === 'polar',
54
- );
55
- return [+innerRadius, +outerRadius];
56
- }
57
-
58
48
  function sizeOf(coordinate: Coordinate): [number, number] {
59
49
  // @ts-ignore
60
50
  const { innerWidth, innerHeight } = coordinate.getOptions();
@@ -102,6 +92,14 @@ function ticksOf(
102
92
  return tickMethod(min, max, tickCount);
103
93
  }
104
94
 
95
+ function isHorizontal(orientation: GCO) {
96
+ return orientation === 'horizontal' || orientation === 0;
97
+ }
98
+
99
+ function isVertical(orientation: GCO) {
100
+ return orientation === 'vertical' || orientation === -Math.PI / 2;
101
+ }
102
+
105
103
  function prettyNumber(n: number) {
106
104
  if (typeof n !== 'number') return n;
107
105
  return Math.abs(n) < 1e-15 ? n : parseFloat(n.toFixed(15));
@@ -139,7 +137,7 @@ function getTicks(
139
137
  defaultTickFormatter: AxisOptions['labelFormatter'],
140
138
  tickFilter: AxisOptions['tickFilter'],
141
139
  tickMethod: AxisOptions['tickMethod'],
142
- position: GuideComponentPosition,
140
+ position: GCP,
143
141
  coordinate: Coordinate,
144
142
  ) {
145
143
  if (tickCount !== undefined || tickMethod !== undefined) {
@@ -167,7 +165,7 @@ function getTicks(
167
165
  });
168
166
  // @todo GUI should consider the overlap problem for the first
169
167
  // and label of arc axis.
170
- return isRadial(coordinate) && position === 'arcY'
168
+ return isRadial(coordinate) && position === 'center'
171
169
  ? reverseTicks(axisTicks)
172
170
  : axisTicks;
173
171
  }
@@ -183,9 +181,9 @@ function getTicks(
183
181
  });
184
182
  }
185
183
 
186
- function getGridLength(position: GuideComponentPosition, coordinate) {
184
+ function inferGridLength(position: GCP, coordinate: Coordinate) {
187
185
  const [width, height] = sizeOf(coordinate);
188
- if (position === 'bottom' || position === 'top') return height;
186
+ if (position.includes('bottom') || position.includes('top')) return height;
189
187
  return width;
190
188
  }
191
189
 
@@ -198,15 +196,24 @@ function labelTransforms(autoHide?: boolean, autoRotate?: boolean) {
198
196
  }
199
197
 
200
198
  function inferArcStyle(
201
- position: GuideComponentPosition,
199
+ position: GCP,
200
+ bbox: BBox,
202
201
  innerRadius: number,
203
202
  outerRadius: number,
204
203
  coordinate: Coordinate,
205
204
  ) {
205
+ const { x, y, width, height } = bbox;
206
+ const center: [number, number] = [x + width / 2, y + height / 2];
207
+ const radius = Math.min(width, height) / 2;
208
+ const [startAngle, endAngle] = angleOf(coordinate);
209
+
206
210
  const [w, h] = sizeOf(coordinate);
207
211
  const r = Math.min(w, h) / 2;
208
212
 
209
213
  const common = {
214
+ center,
215
+ radius,
216
+ angleRange: [startAngle, endAngle],
210
217
  titleFillOpacity: 0,
211
218
  titlePosition: 'inner',
212
219
  showLine: false,
@@ -214,7 +221,7 @@ function inferArcStyle(
214
221
  gridLength: (outerRadius - innerRadius) * r,
215
222
  };
216
223
 
217
- if (position === 'arcInner') {
224
+ if (position === 'inner') {
218
225
  const [w, h] = sizeOf(coordinate);
219
226
  const r = Math.min(w, h) / 2;
220
227
  return {
@@ -227,6 +234,7 @@ function inferArcStyle(
227
234
  };
228
235
  }
229
236
 
237
+ // arc outer
230
238
  return {
231
239
  ...common,
232
240
  labelAlign: 'parallel',
@@ -243,67 +251,111 @@ function inferGrid(value: boolean, coordinate: Coordinate, scale: Scale) {
243
251
  return value === undefined ? !!scale.getTicks : value;
244
252
  }
245
253
 
246
- function inferOverrideStyle(
247
- position: GuideComponentPosition,
254
+ function inferAxisLinearOverrideStyle(
255
+ position: GCP,
256
+ orientation: GCO,
248
257
  bbox: BBox,
249
258
  coordinate: Coordinate,
250
259
  ): {
251
- startPos: [number, number];
252
- endPos: [number, number];
260
+ startPos?: [number, number];
261
+ endPos?: [number, number];
253
262
  showLine?: boolean;
254
263
  [k: string]: any;
255
264
  } {
256
- const [, cy] = coordinate.getCenter();
257
265
  const { x, y, width, height } = bbox;
258
266
 
259
267
  if (position === 'bottom') {
260
- return {
261
- startPos: [x, y],
262
- endPos: [x + width, y],
263
- };
264
- } else if (position === 'left' || position === 'centerVertical') {
265
- return {
266
- startPos: [x + width, y],
267
- endPos: [x + width, y + height],
268
- showLine: position === 'centerVertical' ? true : undefined,
269
- };
270
- } else if (position === 'right') {
271
- return {
272
- endPos: [x, y + height],
273
- startPos: [x, y],
274
- };
275
- } else if (position === 'arcY') {
276
- return {
277
- startPos: [x, y],
278
- endPos: [x + width, y + height],
279
- gridCenter: [bbox.x, cy + bbox.y],
280
- };
268
+ return { startPos: [x, y], endPos: [x + width, y] };
269
+ }
270
+ if (position === 'left') {
271
+ return { startPos: [x + width, y], endPos: [x + width, y + height] };
272
+ }
273
+ if (position === 'right') {
274
+ return { endPos: [x, y + height], startPos: [x, y] };
275
+ }
276
+ if (position === 'top') {
277
+ return { startPos: [x, y + height], endPos: [x + width, y + height] };
278
+ }
279
+ // linear axis, maybe in parallel, polar, radial or radar systems.
280
+ if (position === 'center') {
281
+ // axisY
282
+ if (orientation === 'vertical') {
283
+ return {
284
+ startPos: [x + width, y],
285
+ endPos: [x + width, y + height],
286
+ showLine: true,
287
+ };
288
+ }
289
+ // axisX
290
+ else if (orientation === 'horizontal') {
291
+ return {
292
+ startPos: [x, y + height],
293
+ endPos: [x + width, y + height],
294
+ showLine: true,
295
+ };
296
+ }
297
+ // axis with rotate
298
+ else if (typeof orientation === 'number') {
299
+ const [cx, cy] = coordinate.getCenter();
300
+ const [innerRadius, outerRadius] = radiusOf(coordinate);
301
+ const [startAngle, endAngle] = angleOf(coordinate);
302
+ const r = height / 2;
303
+
304
+ const innerR = innerRadius * r;
305
+ const outerR = outerRadius * r;
306
+
307
+ const [actualCx, actualCy] = [cx + x, cy + y];
308
+ const [cos, sin] = [Math.cos(orientation), Math.sin(orientation)];
309
+
310
+ const startPos: [number, number] = [
311
+ actualCx + outerR * cos,
312
+ actualCy + outerR * sin,
313
+ ];
314
+ const endPos: [number, number] = [
315
+ actualCx + innerR * cos,
316
+ actualCy + innerR * sin,
317
+ ];
318
+
319
+ return {
320
+ startPos,
321
+ endPos,
322
+ gridClosed: endAngle - startAngle === 360,
323
+ gridCenter: [cx + x, y + cy],
324
+ gridControlAngles: new Array(3)
325
+ .fill(0)
326
+ .map(
327
+ (d, i, arr) =>
328
+ 90 +
329
+ startAngle +
330
+ ((endAngle - startAngle) / (arr.length - 1)) * i,
331
+ ),
332
+ };
333
+ }
281
334
  }
282
335
 
283
- return {
284
- startPos: [x, y + height],
285
- endPos: [x + width, y + height],
286
- showLine: position === 'centerHorizontal' ? true : undefined,
287
- };
336
+ // position is inner or outer for arc axis won't be here
337
+
338
+ return {};
288
339
  }
289
340
 
290
- const ArcAxis = (options) => {
341
+ const ArcAxisComponent: GCC<AxisOptions> = (options) => {
291
342
  const {
292
343
  order,
293
344
  size,
294
345
  position,
346
+ orientation,
295
347
  labelFormatter = (d) => `${d}`,
296
348
  tickFilter,
297
349
  tickCount,
298
350
  tickMethod,
299
351
  title,
300
352
  grid: showGrid = false,
353
+ important = {},
301
354
  ...rest
302
355
  } = options;
303
- return (scale, value, coordinate, theme) => {
304
- const { domain, bbox } = value;
305
- const { x, y, width, height } = bbox;
306
- const center: [number, number] = [x + width / 2, y + height / 2];
356
+ return ([scale], value, coordinate, theme) => {
357
+ const { bbox } = value;
358
+ const { domain } = scale.getOptions();
307
359
  const ticks = getTicks(
308
360
  scale,
309
361
  domain,
@@ -315,39 +367,62 @@ const ArcAxis = (options) => {
315
367
  coordinate,
316
368
  );
317
369
 
318
- const radius = Math.min(width, height) / 2;
319
- const [startAngle, endAngle] = angleOf(coordinate);
320
370
  const [innerRadius, outerRadius] = radiusOf(coordinate);
321
371
 
322
372
  const defaultStyle = inferArcStyle(
323
373
  position,
374
+ bbox,
324
375
  innerRadius,
325
376
  outerRadius,
326
377
  coordinate,
327
378
  );
379
+
328
380
  const { axis: axisTheme } = theme;
329
381
  return new AxisComponent({
330
382
  style: deepMix({}, axisTheme, defaultStyle, {
331
383
  type: 'arc',
332
- center,
333
- radius,
334
- angleRange: [startAngle, endAngle],
335
384
  data: ticks,
336
385
  title: titleContent(title),
337
386
  showGrid,
338
387
  ...rest,
388
+ ...important,
339
389
  }),
340
390
  });
341
391
  };
342
392
  };
343
393
 
344
- function inferDefaultStyle(scale, theme, position, direction) {
345
- const p = position === 'centerVertical' ? 'left' : position;
394
+ function inferThemeStyle(
395
+ scale: Scale,
396
+ coordinate: Coordinate,
397
+ theme: G2Theme,
398
+ direction,
399
+ position: GCP,
400
+ orientation: GCO,
401
+ ) {
402
+ const baseStyle = theme.axis;
403
+ let furtherStyle = theme.axisLinear;
346
404
 
347
- const themeStyle = Object.assign(
348
- {},
349
- theme.axis,
350
- theme[`axis${capitalizeFirst(p)}`] || theme.axisTop,
405
+ if (['top', 'right', 'bottom', 'left'].includes(position)) {
406
+ furtherStyle = theme[`axis${capitalizeFirst(position)}`];
407
+ }
408
+ return Object.assign({}, baseStyle, furtherStyle);
409
+ }
410
+
411
+ function inferDefaultStyle(
412
+ scale: Scale,
413
+ coordinate: Coordinate,
414
+ theme: G2Theme,
415
+ direction,
416
+ position: GCP,
417
+ orientation: GCO,
418
+ ) {
419
+ const themeStyle = inferThemeStyle(
420
+ scale,
421
+ coordinate,
422
+ theme,
423
+ direction,
424
+ position,
425
+ orientation,
351
426
  );
352
427
 
353
428
  if (position === 'bottom') {
@@ -357,48 +432,41 @@ function inferDefaultStyle(scale, theme, position, direction) {
357
432
  titleTransformOrigin: 'center',
358
433
  titleTransform: scale.getTicks ? 'translate(-100%, 0)' : undefined,
359
434
  };
360
- } else if (position === 'arcY') {
435
+ }
436
+ if (position === 'center') {
361
437
  return {
362
438
  ...themeStyle,
363
439
  labelDirection: direction === 'right' ? 'negative' : 'positive',
364
440
  labelTransform: direction === 'center' ? 'translate(50%, 0)' : '',
365
441
  tickDirection: direction === 'right' ? 'negative' : 'positive',
366
442
  labelSpacing: direction === 'center' ? 0 : 4,
443
+ titleSpacing: isVertical(orientation) ? 10 : 0,
367
444
  tick: direction === 'center' ? false : undefined,
368
445
  };
369
446
  }
370
-
371
447
  return themeStyle;
372
448
  }
373
449
 
374
- function isHorizontal(position): boolean {
375
- switch (position) {
376
- case 'top':
377
- case 'bottom':
378
- case 'centerHorizontal':
379
- return true;
380
- default:
381
- return false;
382
- }
383
- }
384
-
385
- const LinearAxis: GCC<AxisOptions> = (options) => {
450
+ const LinearAxisComponent: GCC<AxisOptions> = (options) => {
386
451
  const {
387
452
  order,
388
453
  size,
389
454
  transform,
390
455
  position,
456
+ orientation,
391
457
  title,
392
458
  labelFormatter = (d) => `${d}`,
393
459
  direction = 'left',
394
460
  tickCount,
395
461
  tickFilter,
396
462
  tickMethod,
463
+ important = {},
397
464
  ...userDefinitions
398
465
  } = options;
399
466
 
400
- return (scale, value, coordinate, theme) => {
401
- const { domain, bbox } = value;
467
+ return ([scale], value, coordinate, theme) => {
468
+ const { bbox } = value;
469
+ const { domain } = scale.getOptions();
402
470
 
403
471
  const ticks = getTicks(
404
472
  scale,
@@ -411,7 +479,14 @@ const LinearAxis: GCC<AxisOptions> = (options) => {
411
479
  coordinate,
412
480
  );
413
481
 
414
- const defaultStyle = inferDefaultStyle(scale, theme, position, direction);
482
+ const defaultStyle = inferDefaultStyle(
483
+ scale,
484
+ coordinate,
485
+ theme,
486
+ direction,
487
+ position,
488
+ orientation,
489
+ );
415
490
  const {
416
491
  labelAutoRotate = true,
417
492
  labelAutoHide = false,
@@ -422,14 +497,14 @@ const LinearAxis: GCC<AxisOptions> = (options) => {
422
497
  } = Object.assign({}, defaultStyle, userDefinitions);
423
498
 
424
499
  const showGrid = inferGrid(grid, coordinate, scale);
425
- const gridLength = getGridLength(position, coordinate);
500
+ const gridLength = inferGridLength(position, coordinate);
426
501
 
427
- const { showLine = line, ...overrideStyle } = inferOverrideStyle(
502
+ const { showLine = line, ...overrideStyle } = inferAxisLinearOverrideStyle(
428
503
  position,
504
+ orientation,
429
505
  bbox,
430
506
  coordinate,
431
507
  );
432
-
433
508
  const axisStyle = {
434
509
  ...defaultStyle,
435
510
  type: 'linear' as const,
@@ -445,34 +520,40 @@ const LinearAxis: GCC<AxisOptions> = (options) => {
445
520
  showLine: true,
446
521
  ...(!showLine ? { lineOpacity: 0 } : null),
447
522
  ...overrideStyle,
523
+ ...important,
448
524
  };
449
525
 
450
526
  return new AxisComponent({
451
527
  className: 'axis',
452
- style: {
453
- ...axisStyle,
454
- horizontal: isHorizontal(position),
455
- },
528
+ style: axisStyle,
456
529
  });
457
530
  };
458
531
  };
459
532
 
460
- /**
461
- * Guide Component for position channel(e.g. x, y).
462
- */
463
- export const Axis: GCC<AxisOptions> = (options) => {
464
- const { position, labelFormatter: f = (d) => `${d}` } = options;
465
- const labelFormatter = typeof f === 'string' ? format(f) : f;
466
- const normalizedOptions = { ...options, labelFormatter };
467
- return (scale, value, coordinate, theme) => {
468
- return position === 'arc' || position === 'arcInner'
469
- ? ArcAxis(normalizedOptions)(scale, value, coordinate, theme)
470
- : LinearAxis(normalizedOptions)(scale, value, coordinate, theme);
533
+ const axisFactor: (
534
+ axis: typeof ArcAxisComponent | typeof LinearAxisComponent,
535
+ ) => GCC<AxisOptions> = (axis) => {
536
+ return (options) => {
537
+ const { labelFormatter: f = (d) => `${d}` } = options;
538
+ const labelFormatter = typeof f === 'string' ? format(f) : f;
539
+ const normalizedOptions = { ...options, labelFormatter };
540
+ return (...args) => axis(normalizedOptions)(...args);
471
541
  };
472
542
  };
473
543
 
474
- Axis.props = {
475
- defaultPosition: 'left',
544
+ export const LinearAxis = axisFactor(LinearAxisComponent);
545
+
546
+ export const ArcAxis = axisFactor(ArcAxisComponent);
547
+
548
+ LinearAxis.props = {
549
+ defaultPosition: 'center',
550
+ defaultSize: 45,
551
+ defaultOrder: 0,
552
+ };
553
+
554
+ ArcAxis.props = {
555
+ defaultPosition: 'outer',
556
+ defaultOrientation: 'vertical',
476
557
  defaultSize: 45,
477
558
  defaultOrder: 0,
478
559
  };
@@ -0,0 +1,16 @@
1
+ import { GuideComponentComponent as GCC } from '../runtime';
2
+ import { ArcAxis, AxisOptions } from './axis';
3
+
4
+ export type AxisYOptions = AxisOptions;
5
+
6
+ /**
7
+ * ArcAxis component bind to x scale.
8
+ */
9
+ export const AxisArc: GCC<AxisYOptions> = (options) => {
10
+ return ArcAxis(options);
11
+ };
12
+
13
+ AxisArc.props = {
14
+ ...ArcAxis.props,
15
+ defaultPosition: 'left',
16
+ };
@@ -0,0 +1,73 @@
1
+ import { Coordinate } from '@antv/coord';
2
+ import { G2Theme, GuideComponentComponent as GCC } from '../runtime';
3
+ import { angleOf } from '../utils/coordinate';
4
+ import { AxisOptions, LinearAxis } from './axis';
5
+
6
+ export type AxisRadarOptions = AxisOptions & {
7
+ radar: {
8
+ count: number;
9
+ index: number;
10
+ };
11
+ };
12
+
13
+ function inferTitleTransform(orientation: number) {
14
+ const internalOrientation = orientation % (Math.PI * 2);
15
+
16
+ if (internalOrientation === Math.PI / 2) {
17
+ return { titleTransform: 'translate(0, 50%)' };
18
+ }
19
+ if (internalOrientation > -Math.PI / 2 && internalOrientation < Math.PI / 2) {
20
+ return { titleTransform: 'translate(50%, 0)' };
21
+ }
22
+ if (
23
+ internalOrientation > Math.PI / 2 &&
24
+ internalOrientation < (Math.PI * 3) / 2
25
+ ) {
26
+ return { titleTransform: 'translate(-50%, 0)' };
27
+ }
28
+ return {};
29
+ }
30
+
31
+ function inferAxisStyle(
32
+ options: AxisRadarOptions,
33
+ theme: G2Theme,
34
+ coordinate: Coordinate,
35
+ value: Record<string, any>,
36
+ ) {
37
+ const { radar } = options;
38
+ const {
39
+ scales: [{ name }],
40
+ } = value;
41
+ const [startAngle, endAngle] = angleOf(coordinate);
42
+ const { axisRadar: radarTheme = {} } = theme;
43
+
44
+ return {
45
+ ...radarTheme,
46
+ showGrid: name === 'position',
47
+ gridConnect: 'line',
48
+ gridControlAngles: new Array(radar.count).fill(0).map((_, i) => {
49
+ const angle = (endAngle - startAngle) / radar.count;
50
+ // the zero angle of grid is 90 degree
51
+ return startAngle + angle * i + 90;
52
+ }),
53
+ };
54
+ }
55
+
56
+ export const AxisRadar: GCC<AxisRadarOptions> = (options) => {
57
+ const { important = {}, ...restOptions } = options;
58
+ return (scales, value, coordinate, theme) => {
59
+ return LinearAxis({
60
+ ...restOptions,
61
+ ...inferTitleTransform(options.orientation),
62
+ important: {
63
+ ...inferAxisStyle(options, theme, coordinate, value),
64
+ ...important,
65
+ },
66
+ })(scales, value, coordinate, theme);
67
+ };
68
+ };
69
+
70
+ AxisRadar.props = {
71
+ ...LinearAxis.props,
72
+ defaultPosition: 'center',
73
+ };
@@ -1,16 +1,19 @@
1
+ import { Axis } from '@antv/gui';
1
2
  import { GuideComponentComponent as GCC } from '../runtime';
2
- import { Axis, AxisOptions } from './axis';
3
+ import { LinearAxis, AxisOptions } from './axis';
3
4
 
4
5
  export type AxisXOptions = AxisOptions;
5
6
 
6
7
  /**
7
- * Axis component bind to x scale.
8
+ * LinearAxis component bind to x scale.
8
9
  */
9
10
  export const AxisX: GCC<AxisXOptions> = (options) => {
10
- return Axis(options);
11
+ return LinearAxis(options);
11
12
  };
12
13
 
13
14
  AxisX.props = {
14
- ...Axis.props,
15
+ ...LinearAxis.props,
15
16
  defaultPosition: 'bottom',
16
17
  };
18
+
19
+ export function axisXConfig() {}
@@ -1,16 +1,16 @@
1
1
  import { GuideComponentComponent as GCC } from '../runtime';
2
- import { Axis, AxisOptions } from './axis';
2
+ import { AxisOptions, LinearAxis } from './axis';
3
3
 
4
4
  export type AxisYOptions = AxisOptions;
5
5
 
6
6
  /**
7
- * Axis component bind to y scale.
7
+ * LinearAxis component bind to y scale.
8
8
  */
9
9
  export const AxisY: GCC<AxisYOptions> = (options) => {
10
- return Axis(options);
10
+ return LinearAxis(options);
11
11
  };
12
12
 
13
13
  AxisY.props = {
14
- ...Axis.props,
14
+ ...LinearAxis.props,
15
15
  defaultPosition: 'left',
16
16
  };
@@ -1,7 +1,12 @@
1
+ export { LinearAxis as AxisLinear, ArcAxis as AxisArc } from './axis';
1
2
  export { AxisX } from './axisX';
2
3
  export { AxisY } from './axisY';
4
+ export { AxisRadar } from './axisRadar';
3
5
  export { LegendCategory } from './legendCategory';
4
6
  export { LegendContinuous } from './legendContinuous';
7
+ export { LegendContinuousBlock } from './legendContinuousBlock';
8
+ export { LegendContinuousBlockSize } from './legendContinuousBlockSize';
9
+ export { LegendContinuousSize } from './legendContinuousSize';
5
10
  export { TitleComponent } from './title';
6
11
  export { SliderX } from './sliderX';
7
12
  export { SliderY } from './sliderY';
@@ -12,6 +17,9 @@ export type { AxisXOptions } from './axisX';
12
17
  export type { AxisYOptions } from './axisY';
13
18
  export type { LegendCategoryOptions } from './legendCategory';
14
19
  export type { LegendContinuousOptions } from './legendContinuous';
20
+ export type { LegendContinuousBlockOptions } from './legendContinuousBlock';
21
+ export type { LegendContinuousBlockSizeOptions } from './legendContinuousBlockSize';
22
+ export type { LegendContinuousSizeOptions } from './legendContinuousSize';
15
23
  export type { TitleComponentOptions } from './title';
16
24
  export type { SliderXOptions } from './sliderX';
17
25
  export type { SliderYOptions } from './sliderY';