@antv/g2 5.0.0-beta.1 → 5.0.0-beta.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (1205) hide show
  1. package/dist/g2-lite.min.js +5 -2
  2. package/dist/g2.min.js +5 -2
  3. package/esm/animation/morphing.js +32 -10
  4. package/esm/animation/morphing.js.map +1 -1
  5. package/esm/animation/waveIn.js +1 -12
  6. package/esm/animation/waveIn.js.map +1 -1
  7. package/esm/api/chart.d.ts +16 -7
  8. package/esm/api/chart.js +66 -29
  9. package/esm/api/chart.js.map +1 -1
  10. package/esm/api/composition/base.d.ts +21 -0
  11. package/esm/api/composition/base.js +59 -0
  12. package/esm/api/composition/base.js.map +1 -0
  13. package/esm/api/composition/facetCircle.d.ts +2 -3
  14. package/esm/api/composition/facetCircle.js +2 -2
  15. package/esm/api/composition/facetCircle.js.map +1 -1
  16. package/esm/api/composition/facetRect.d.ts +2 -3
  17. package/esm/api/composition/facetRect.js +2 -2
  18. package/esm/api/composition/facetRect.js.map +1 -1
  19. package/esm/api/composition/geoPath.d.ts +5 -7
  20. package/esm/api/composition/geoPath.js +4 -5
  21. package/esm/api/composition/geoPath.js.map +1 -1
  22. package/esm/api/composition/geoView.d.ts +4 -6
  23. package/esm/api/composition/geoView.js +4 -5
  24. package/esm/api/composition/geoView.js.map +1 -1
  25. package/esm/api/composition/index.d.ts +2 -1
  26. package/esm/api/composition/index.js +2 -1
  27. package/esm/api/composition/index.js.map +1 -1
  28. package/esm/api/composition/repeatMatrix.d.ts +2 -3
  29. package/esm/api/composition/repeatMatrix.js +2 -2
  30. package/esm/api/composition/repeatMatrix.js.map +1 -1
  31. package/esm/api/composition/spaceFlex.d.ts +2 -3
  32. package/esm/api/composition/spaceFlex.js +2 -2
  33. package/esm/api/composition/spaceFlex.js.map +1 -1
  34. package/esm/api/composition/spaceLayer.d.ts +2 -3
  35. package/esm/api/composition/spaceLayer.js +2 -2
  36. package/esm/api/composition/spaceLayer.js.map +1 -1
  37. package/esm/api/composition/timingKeyframe.d.ts +2 -3
  38. package/esm/api/composition/timingKeyframe.js +2 -2
  39. package/esm/api/composition/timingKeyframe.js.map +1 -1
  40. package/esm/api/composition/view.d.ts +5 -5
  41. package/esm/api/composition/view.js +6 -6
  42. package/esm/api/composition/view.js.map +1 -1
  43. package/esm/api/mark/base.d.ts +22 -0
  44. package/esm/api/mark/base.js +54 -0
  45. package/esm/api/mark/base.js.map +1 -0
  46. package/esm/api/mark/mark.d.ts +29 -29
  47. package/esm/api/mark/mark.js +32 -29
  48. package/esm/api/mark/mark.js.map +1 -1
  49. package/esm/api/mark/types.d.ts +5 -2
  50. package/esm/api/node.d.ts +2 -1
  51. package/esm/api/node.js +8 -9
  52. package/esm/api/node.js.map +1 -1
  53. package/esm/api/props.js +3 -22
  54. package/esm/api/props.js.map +1 -1
  55. package/esm/component/axis.d.ts +5 -8
  56. package/esm/component/axis.js +182 -234
  57. package/esm/component/axis.js.map +1 -1
  58. package/esm/component/axisArc.d.ts +7 -0
  59. package/esm/component/axisArc.js +9 -0
  60. package/esm/component/axisArc.js.map +1 -0
  61. package/esm/component/axisRadar.d.ts +9 -0
  62. package/esm/component/axisRadar.js +45 -0
  63. package/esm/component/axisRadar.js.map +1 -0
  64. package/esm/component/axisX.d.ts +2 -1
  65. package/esm/component/axisX.js +5 -4
  66. package/esm/component/axisX.js.map +1 -1
  67. package/esm/component/axisY.d.ts +1 -1
  68. package/esm/component/axisY.js +4 -4
  69. package/esm/component/axisY.js.map +1 -1
  70. package/esm/component/index.d.ts +14 -0
  71. package/esm/component/index.js +9 -0
  72. package/esm/component/index.js.map +1 -1
  73. package/esm/component/legendCategory.d.ts +5 -4
  74. package/esm/component/legendCategory.js +87 -55
  75. package/esm/component/legendCategory.js.map +1 -1
  76. package/esm/component/legendContinuous.d.ts +4 -2
  77. package/esm/component/legendContinuous.js +87 -25
  78. package/esm/component/legendContinuous.js.map +1 -1
  79. package/esm/component/legendContinuousBlock.d.ts +4 -0
  80. package/esm/component/legendContinuousBlock.js +6 -0
  81. package/esm/component/legendContinuousBlock.js.map +1 -0
  82. package/esm/component/legendContinuousBlockSize.d.ts +4 -0
  83. package/esm/component/legendContinuousBlockSize.js +6 -0
  84. package/esm/component/legendContinuousBlockSize.js.map +1 -0
  85. package/esm/component/legendContinuousSize.d.ts +4 -0
  86. package/esm/component/legendContinuousSize.js +10 -0
  87. package/esm/component/legendContinuousSize.js.map +1 -0
  88. package/esm/component/scrollbar.d.ts +9 -0
  89. package/esm/component/scrollbar.js +36 -0
  90. package/esm/component/scrollbar.js.map +1 -0
  91. package/esm/component/scrollbarX.d.ts +7 -0
  92. package/esm/component/scrollbarX.js +9 -0
  93. package/esm/component/scrollbarX.js.map +1 -0
  94. package/esm/component/scrollbarY.d.ts +7 -0
  95. package/esm/component/scrollbarY.js +9 -0
  96. package/esm/component/scrollbarY.js.map +1 -0
  97. package/esm/component/slider.d.ts +9 -0
  98. package/esm/component/slider.js +47 -0
  99. package/esm/component/slider.js.map +1 -0
  100. package/esm/component/sliderX.d.ts +7 -0
  101. package/esm/component/sliderX.js +9 -0
  102. package/esm/component/sliderX.js.map +1 -0
  103. package/esm/component/sliderY.d.ts +7 -0
  104. package/esm/component/sliderY.js +9 -0
  105. package/esm/component/sliderY.js.map +1 -0
  106. package/esm/component/title.js +47 -23
  107. package/esm/component/title.js.map +1 -1
  108. package/esm/component/utils.d.ts +13 -0
  109. package/esm/component/utils.js +50 -0
  110. package/esm/component/utils.js.map +1 -1
  111. package/esm/composition/facetCircle.js +2 -2
  112. package/esm/composition/facetCircle.js.map +1 -1
  113. package/esm/composition/facetRect.js +6 -8
  114. package/esm/composition/facetRect.js.map +1 -1
  115. package/esm/composition/mark.js +5 -3
  116. package/esm/composition/mark.js.map +1 -1
  117. package/esm/composition/repeatMatrix.js +4 -4
  118. package/esm/composition/repeatMatrix.js.map +1 -1
  119. package/esm/composition/view.js +8 -4
  120. package/esm/composition/view.js.map +1 -1
  121. package/esm/coordinate/fisheye.js +1 -1
  122. package/esm/coordinate/fisheye.js.map +1 -1
  123. package/esm/coordinate/index.d.ts +5 -13
  124. package/esm/coordinate/index.js +4 -8
  125. package/esm/coordinate/index.js.map +1 -1
  126. package/esm/coordinate/polar.d.ts +6 -0
  127. package/esm/coordinate/polar.js +18 -6
  128. package/esm/coordinate/polar.js.map +1 -1
  129. package/esm/coordinate/radar.d.ts +7 -0
  130. package/esm/coordinate/radar.js +14 -0
  131. package/esm/coordinate/radar.js.map +1 -0
  132. package/esm/coordinate/radial.d.ts +6 -0
  133. package/esm/coordinate/radial.js +19 -6
  134. package/esm/coordinate/radial.js.map +1 -1
  135. package/esm/coordinate/theta.d.ts +7 -0
  136. package/esm/coordinate/theta.js +16 -4
  137. package/esm/coordinate/theta.js.map +1 -1
  138. package/esm/coordinate/transpose.js +1 -1
  139. package/esm/coordinate/transpose.js.map +1 -1
  140. package/esm/data/filter.d.ts +3 -3
  141. package/esm/data/filter.js.map +1 -1
  142. package/esm/data/fold.js +4 -10
  143. package/esm/data/fold.js.map +1 -1
  144. package/esm/data/index.d.ts +5 -3
  145. package/esm/data/index.js +2 -1
  146. package/esm/data/index.js.map +1 -1
  147. package/esm/data/pick.js +10 -2
  148. package/esm/data/pick.js.map +1 -1
  149. package/esm/data/slice.d.ts +8 -0
  150. package/esm/data/slice.js +10 -0
  151. package/esm/data/slice.js.map +1 -0
  152. package/esm/data/sort.d.ts +8 -0
  153. package/esm/data/sort.js +12 -0
  154. package/esm/data/sort.js.map +1 -0
  155. package/esm/geo/{d3-projection.d.ts → d3Projection.d.ts} +0 -0
  156. package/esm/geo/{d3-projection.js → d3Projection.js} +1 -1
  157. package/esm/geo/d3Projection.js.map +1 -0
  158. package/esm/geo/geoView.js +4 -4
  159. package/esm/geo/geoView.js.map +1 -1
  160. package/esm/interaction/action/service/legendItemSelection.js.map +1 -1
  161. package/esm/interaction/action/transformer/setItemState.js.map +1 -1
  162. package/esm/interaction/builtin/activeRegion.d.ts +0 -2
  163. package/esm/interaction/builtin/brush.d.ts +1 -1
  164. package/esm/interaction/builtin/brushHighlight.d.ts +1 -1
  165. package/esm/interaction/builtin/brushVisible.d.ts +1 -1
  166. package/esm/interaction/builtin/elementHighlight.d.ts +2 -0
  167. package/esm/interaction/builtin/elementHighlightByColor.d.ts +2 -0
  168. package/esm/interaction/builtin/elementHighlightByX.d.ts +2 -0
  169. package/esm/interaction/builtin/ellipsisText.d.ts +0 -3
  170. package/esm/interaction/builtin/fisheye.d.ts +6 -6
  171. package/esm/interaction/builtin/tooltip.d.ts +4 -8
  172. package/esm/interaction/index.d.ts +13 -0
  173. package/esm/interaction/index.js +12 -30
  174. package/esm/interaction/index.js.map +1 -1
  175. package/esm/interaction/native/brushAxisHighlight.d.ts +27 -0
  176. package/esm/interaction/native/brushAxisHighlight.js +167 -0
  177. package/esm/interaction/native/brushAxisHighlight.js.map +1 -0
  178. package/esm/interaction/native/brushFilter.d.ts +14 -0
  179. package/esm/interaction/native/brushFilter.js +122 -0
  180. package/esm/interaction/native/brushFilter.js.map +1 -0
  181. package/esm/interaction/native/brushHighlight.d.ts +41 -0
  182. package/esm/interaction/native/brushHighlight.js +349 -0
  183. package/esm/interaction/native/brushHighlight.js.map +1 -0
  184. package/esm/interaction/native/brushXFilter.d.ts +1 -0
  185. package/esm/interaction/native/brushXFilter.js +6 -0
  186. package/esm/interaction/native/brushXFilter.js.map +1 -0
  187. package/esm/interaction/native/brushXHighlight.d.ts +6 -0
  188. package/esm/interaction/native/brushXHighlight.js +9 -0
  189. package/esm/interaction/native/brushXHighlight.js.map +1 -0
  190. package/esm/interaction/native/brushYFilter.d.ts +1 -0
  191. package/esm/interaction/native/brushYFilter.js +6 -0
  192. package/esm/interaction/native/brushYFilter.js.map +1 -0
  193. package/esm/interaction/native/brushYHighlight.d.ts +6 -0
  194. package/esm/interaction/native/brushYHighlight.js +9 -0
  195. package/esm/interaction/native/brushYHighlight.js.map +1 -0
  196. package/esm/interaction/native/elementHighlight.d.ts +10 -2
  197. package/esm/interaction/native/elementHighlight.js +87 -24
  198. package/esm/interaction/native/elementHighlight.js.map +1 -1
  199. package/esm/interaction/native/elementHighlightByColor.d.ts +0 -3
  200. package/esm/interaction/native/elementHighlightByColor.js +3 -9
  201. package/esm/interaction/native/elementHighlightByColor.js.map +1 -1
  202. package/esm/interaction/native/elementHighlightByX.d.ts +1 -8
  203. package/esm/interaction/native/elementHighlightByX.js +4 -11
  204. package/esm/interaction/native/elementHighlightByX.js.map +1 -1
  205. package/esm/interaction/native/elementSelect.d.ts +7 -2
  206. package/esm/interaction/native/elementSelect.js +59 -27
  207. package/esm/interaction/native/elementSelect.js.map +1 -1
  208. package/esm/interaction/native/elementSelectByColor.js +3 -6
  209. package/esm/interaction/native/elementSelectByColor.js.map +1 -1
  210. package/esm/interaction/native/elementSelectByX.js +3 -6
  211. package/esm/interaction/native/elementSelectByX.js.map +1 -1
  212. package/esm/interaction/native/fisheye.js +6 -4
  213. package/esm/interaction/native/fisheye.js.map +1 -1
  214. package/esm/interaction/native/legendFilter.d.ts +14 -0
  215. package/esm/interaction/native/legendFilter.js +195 -0
  216. package/esm/interaction/native/legendFilter.js.map +1 -0
  217. package/esm/interaction/native/legendHighlight.d.ts +1 -0
  218. package/esm/interaction/native/legendHighlight.js +87 -0
  219. package/esm/interaction/native/legendHighlight.js.map +1 -0
  220. package/esm/interaction/native/poptip.d.ts +5 -0
  221. package/esm/interaction/native/poptip.js +91 -0
  222. package/esm/interaction/native/poptip.js.map +1 -0
  223. package/esm/interaction/native/sliderFilter.d.ts +5 -0
  224. package/esm/interaction/native/sliderFilter.js +87 -0
  225. package/esm/interaction/native/sliderFilter.js.map +1 -0
  226. package/esm/interaction/native/tooltip.d.ts +2 -2
  227. package/esm/interaction/native/tooltip.js +149 -47
  228. package/esm/interaction/native/tooltip.js.map +1 -1
  229. package/esm/interaction/native/utils.d.ts +24 -5
  230. package/esm/interaction/native/utils.js +248 -42
  231. package/esm/interaction/native/utils.js.map +1 -1
  232. package/esm/label-transform/contrastReverse.d.ts +9 -0
  233. package/esm/label-transform/contrastReverse.js +48 -0
  234. package/esm/label-transform/contrastReverse.js.map +1 -0
  235. package/esm/label-transform/index.d.ts +8 -8
  236. package/esm/label-transform/index.js +4 -4
  237. package/esm/label-transform/index.js.map +1 -1
  238. package/esm/label-transform/overflowHide.d.ts +7 -0
  239. package/esm/label-transform/overflowHide.js +18 -0
  240. package/esm/label-transform/overflowHide.js.map +1 -0
  241. package/esm/label-transform/overlapDodgeY.d.ts +7 -0
  242. package/esm/label-transform/{dodgeY.js → overlapDodgeY.js} +4 -4
  243. package/esm/label-transform/overlapDodgeY.js.map +1 -0
  244. package/esm/label-transform/overlapHide.d.ts +7 -0
  245. package/esm/label-transform/overlapHide.js +24 -0
  246. package/esm/label-transform/overlapHide.js.map +1 -0
  247. package/esm/mark/area.js +2 -2
  248. package/esm/mark/area.js.map +1 -1
  249. package/esm/mark/boxplot.js +5 -18
  250. package/esm/mark/boxplot.js.map +1 -1
  251. package/esm/mark/cell.js +1 -1
  252. package/esm/mark/line.js +1 -1
  253. package/esm/mark/line.js.map +1 -1
  254. package/esm/mark/pack.js +0 -1
  255. package/esm/mark/pack.js.map +1 -1
  256. package/esm/mark/treemap.js +0 -1
  257. package/esm/mark/treemap.js.map +1 -1
  258. package/esm/runtime/component.d.ts +4 -1
  259. package/esm/runtime/component.js +274 -106
  260. package/esm/runtime/component.js.map +1 -1
  261. package/esm/runtime/coordinate.d.ts +12 -0
  262. package/esm/runtime/coordinate.js +47 -16
  263. package/esm/runtime/coordinate.js.map +1 -1
  264. package/esm/runtime/layout.d.ts +1 -1
  265. package/esm/runtime/layout.js +145 -76
  266. package/esm/runtime/layout.js.map +1 -1
  267. package/esm/runtime/plot.d.ts +1 -1
  268. package/esm/runtime/plot.js +155 -69
  269. package/esm/runtime/plot.js.map +1 -1
  270. package/esm/runtime/render.d.ts +0 -1
  271. package/esm/runtime/render.js +22 -47
  272. package/esm/runtime/render.js.map +1 -1
  273. package/esm/runtime/scale.d.ts +3 -1
  274. package/esm/runtime/scale.js +59 -5
  275. package/esm/runtime/scale.js.map +1 -1
  276. package/esm/runtime/transform.js +17 -7
  277. package/esm/runtime/transform.js.map +1 -1
  278. package/esm/runtime/types/common.d.ts +38 -11
  279. package/esm/runtime/types/component.d.ts +13 -8
  280. package/esm/runtime/types/mark.d.ts +1 -1
  281. package/esm/runtime/types/options.d.ts +14 -12
  282. package/esm/runtime/types/scale.d.ts +18 -0
  283. package/esm/runtime/types/scale.js +19 -0
  284. package/esm/runtime/types/scale.js.map +1 -0
  285. package/esm/runtime/types/theme.d.ts +8 -5
  286. package/esm/shape/area/curve.js +17 -17
  287. package/esm/shape/area/curve.js.map +1 -1
  288. package/esm/shape/area/hv.d.ts +3 -0
  289. package/esm/shape/area/hv.js +9 -0
  290. package/esm/shape/area/hv.js.map +1 -0
  291. package/esm/shape/area/hvh.d.ts +3 -0
  292. package/esm/shape/area/{step.js → hvh.js} +3 -3
  293. package/esm/shape/area/hvh.js.map +1 -0
  294. package/esm/shape/area/vh.d.ts +3 -0
  295. package/esm/shape/area/vh.js +9 -0
  296. package/esm/shape/area/vh.js.map +1 -0
  297. package/esm/shape/box/box.js +1 -1
  298. package/esm/shape/box/box.js.map +1 -1
  299. package/esm/shape/connector/connector.js +3 -3
  300. package/esm/shape/connector/connector.js.map +1 -1
  301. package/esm/shape/image/image.js +2 -2
  302. package/esm/shape/image/image.js.map +1 -1
  303. package/esm/shape/index.d.ts +6 -2
  304. package/esm/shape/index.js +3 -1
  305. package/esm/shape/index.js.map +1 -1
  306. package/esm/shape/interval/color.d.ts +1 -0
  307. package/esm/shape/interval/color.js +67 -51
  308. package/esm/shape/interval/color.js.map +1 -1
  309. package/esm/shape/label/label.js +3 -3
  310. package/esm/shape/label/label.js.map +1 -1
  311. package/esm/shape/label/position/area.d.ts +13 -0
  312. package/esm/shape/label/position/area.js +28 -0
  313. package/esm/shape/label/position/area.js.map +1 -0
  314. package/esm/shape/label/position/bottom.d.ts +1 -0
  315. package/esm/shape/label/position/bottom.js +2 -0
  316. package/esm/shape/label/position/bottom.js.map +1 -0
  317. package/esm/shape/label/position/bottomLeft.d.ts +1 -0
  318. package/esm/shape/label/position/bottomLeft.js +2 -0
  319. package/esm/shape/label/position/bottomLeft.js.map +1 -0
  320. package/esm/shape/label/position/bottomRight.d.ts +1 -0
  321. package/esm/shape/label/position/bottomRight.js +2 -0
  322. package/esm/shape/label/position/bottomRight.js.map +1 -0
  323. package/esm/shape/label/position/default.d.ts +18 -0
  324. package/esm/shape/label/position/default.js +107 -0
  325. package/esm/shape/label/position/default.js.map +1 -0
  326. package/esm/shape/label/position/index.d.ts +13 -0
  327. package/esm/shape/label/position/index.js +14 -0
  328. package/esm/shape/label/position/index.js.map +1 -0
  329. package/esm/shape/label/position/inside.d.ts +1 -0
  330. package/esm/shape/label/position/inside.js +2 -0
  331. package/esm/shape/label/position/inside.js.map +1 -0
  332. package/esm/shape/label/position/left.d.ts +1 -0
  333. package/esm/shape/label/position/left.js +2 -0
  334. package/esm/shape/label/position/left.js.map +1 -0
  335. package/esm/shape/label/position/outside.d.ts +18 -0
  336. package/esm/shape/label/position/outside.js +67 -0
  337. package/esm/shape/label/position/outside.js.map +1 -0
  338. package/esm/shape/label/position/right.d.ts +1 -0
  339. package/esm/shape/label/position/right.js +2 -0
  340. package/esm/shape/label/position/right.js.map +1 -0
  341. package/esm/shape/label/position/spider.d.ts +7 -0
  342. package/esm/shape/label/position/spider.js +34 -0
  343. package/esm/shape/label/position/spider.js.map +1 -0
  344. package/esm/shape/label/position/surround.d.ts +7 -0
  345. package/esm/shape/label/position/surround.js +35 -0
  346. package/esm/shape/label/position/surround.js.map +1 -0
  347. package/esm/shape/label/position/top.d.ts +1 -0
  348. package/esm/shape/label/position/top.js +2 -0
  349. package/esm/shape/label/position/top.js.map +1 -0
  350. package/esm/shape/label/position/topLeft.d.ts +1 -0
  351. package/esm/shape/label/position/topLeft.js +2 -0
  352. package/esm/shape/label/position/topLeft.js.map +1 -0
  353. package/esm/shape/label/position/topRight.d.ts +1 -0
  354. package/esm/shape/label/position/topRight.js +2 -0
  355. package/esm/shape/label/position/topRight.js.map +1 -0
  356. package/esm/shape/line/curve.js +24 -13
  357. package/esm/shape/line/curve.js.map +1 -1
  358. package/esm/shape/line/line.js +6 -2
  359. package/esm/shape/line/line.js.map +1 -1
  360. package/esm/shape/line/smooth.js +6 -2
  361. package/esm/shape/line/smooth.js.map +1 -1
  362. package/esm/shape/lineXY/line.js +2 -2
  363. package/esm/shape/lineXY/line.js.map +1 -1
  364. package/esm/shape/link/arc.js +2 -2
  365. package/esm/shape/link/arc.js.map +1 -1
  366. package/esm/shape/link/link.js +2 -2
  367. package/esm/shape/link/link.js.map +1 -1
  368. package/esm/shape/link/smooth.js +2 -2
  369. package/esm/shape/link/smooth.js.map +1 -1
  370. package/esm/shape/link/vhv.js +2 -2
  371. package/esm/shape/link/vhv.js.map +1 -1
  372. package/esm/shape/point/color.js +1 -1
  373. package/esm/shape/point/color.js.map +1 -1
  374. package/esm/shape/polygon/polygon.js +3 -3
  375. package/esm/shape/polygon/polygon.js.map +1 -1
  376. package/esm/shape/polygon/ribbon.js +3 -3
  377. package/esm/shape/polygon/ribbon.js.map +1 -1
  378. package/esm/shape/text/advance.js +3 -3
  379. package/esm/shape/text/advance.js.map +1 -1
  380. package/esm/shape/text/badge.js +3 -3
  381. package/esm/shape/text/badge.js.map +1 -1
  382. package/esm/shape/text/text.js +1 -1
  383. package/esm/shape/text/text.js.map +1 -1
  384. package/esm/shape/utils.d.ts +5 -0
  385. package/esm/shape/utils.js +14 -2
  386. package/esm/shape/utils.js.map +1 -1
  387. package/esm/shape/vector/vector.js +3 -3
  388. package/esm/shape/vector/vector.js.map +1 -1
  389. package/esm/spec/composition.d.ts +9 -7
  390. package/esm/spec/coordinate.d.ts +17 -33
  391. package/esm/spec/data.d.ts +32 -10
  392. package/esm/spec/geometry.d.ts +24 -9
  393. package/esm/spec/interaction.d.ts +81 -27
  394. package/esm/spec/labelTransform.d.ts +24 -11
  395. package/esm/spec/theme.d.ts +5 -2
  396. package/esm/spec/transform.d.ts +27 -4
  397. package/esm/spec/utils.d.ts +7 -0
  398. package/esm/spec/utils.js +2 -0
  399. package/esm/spec/utils.js.map +1 -0
  400. package/esm/stdlib/index.js +11 -17
  401. package/esm/stdlib/index.js.map +1 -1
  402. package/esm/theme/academy.d.ts +3 -0
  403. package/esm/theme/academy.js +404 -0
  404. package/esm/theme/academy.js.map +1 -0
  405. package/esm/theme/dark.js +163 -100
  406. package/esm/theme/dark.js.map +1 -1
  407. package/esm/theme/index.d.ts +1 -0
  408. package/esm/theme/index.js +1 -0
  409. package/esm/theme/index.js.map +1 -1
  410. package/esm/theme/light.js +177 -101
  411. package/esm/theme/light.js.map +1 -1
  412. package/esm/transform/filter.d.ts +7 -0
  413. package/esm/transform/filter.js +42 -0
  414. package/esm/transform/filter.js.map +1 -0
  415. package/esm/transform/groupN.js +2 -0
  416. package/esm/transform/groupN.js.map +1 -1
  417. package/esm/transform/index.d.ts +10 -6
  418. package/esm/transform/index.js +5 -3
  419. package/esm/transform/index.js.map +1 -1
  420. package/esm/transform/maybeTooltip.js +3 -1
  421. package/esm/transform/maybeTooltip.js.map +1 -1
  422. package/esm/transform/sample.d.ts +8 -0
  423. package/esm/transform/sample.js +64 -0
  424. package/esm/transform/sample.js.map +1 -0
  425. package/esm/transform/{Select.d.ts → select.d.ts} +0 -0
  426. package/esm/transform/{Select.js → select.js} +2 -14
  427. package/esm/transform/select.js.map +1 -0
  428. package/esm/transform/{SelectX.d.ts → selectX.d.ts} +0 -0
  429. package/esm/transform/{SelectX.js → selectX.js} +3 -3
  430. package/esm/transform/selectX.js.map +1 -0
  431. package/esm/transform/{SelectY.d.ts → selectY.d.ts} +0 -0
  432. package/esm/transform/{SelectY.js → selectY.js} +3 -3
  433. package/esm/transform/selectY.js.map +1 -0
  434. package/esm/transform/sort.d.ts +1 -1
  435. package/esm/transform/sort.js +39 -21
  436. package/esm/transform/sort.js.map +1 -1
  437. package/esm/transform/utils/lttb.d.ts +5 -0
  438. package/esm/transform/utils/lttb.js +56 -0
  439. package/esm/transform/utils/lttb.js.map +1 -0
  440. package/esm/utils/angle.d.ts +2 -0
  441. package/esm/utils/angle.js +7 -0
  442. package/esm/utils/angle.js.map +1 -0
  443. package/esm/utils/array.d.ts +8 -0
  444. package/esm/utils/array.js +35 -0
  445. package/esm/utils/array.js.map +1 -1
  446. package/esm/utils/bounds.d.ts +26 -0
  447. package/esm/utils/bounds.js +41 -0
  448. package/esm/utils/bounds.js.map +1 -0
  449. package/esm/utils/color.d.ts +6 -0
  450. package/esm/utils/color.js +7 -0
  451. package/esm/utils/color.js.map +1 -0
  452. package/esm/utils/coordinate.d.ts +5 -0
  453. package/esm/utils/coordinate.js +31 -0
  454. package/esm/utils/coordinate.js.map +1 -1
  455. package/esm/utils/event.d.ts +0 -2
  456. package/esm/utils/event.js +0 -18
  457. package/esm/utils/event.js.map +1 -1
  458. package/esm/utils/helper.d.ts +2 -0
  459. package/esm/utils/helper.js +10 -2
  460. package/esm/utils/helper.js.map +1 -1
  461. package/esm/utils/scale.d.ts +3 -0
  462. package/esm/utils/scale.js +30 -0
  463. package/esm/utils/scale.js.map +1 -0
  464. package/esm/utils/selection.d.ts +1 -0
  465. package/esm/utils/selection.js +5 -2
  466. package/esm/utils/selection.js.map +1 -1
  467. package/esm/utils/size.js +1 -1
  468. package/esm/utils/size.js.map +1 -1
  469. package/esm/utils/vector.d.ts +1 -1
  470. package/esm/utils/vector.js +1 -1
  471. package/lib/animation/morphing.js +32 -10
  472. package/lib/animation/morphing.js.map +1 -1
  473. package/lib/animation/waveIn.js +1 -12
  474. package/lib/animation/waveIn.js.map +1 -1
  475. package/lib/api/chart.d.ts +16 -7
  476. package/lib/api/chart.js +67 -27
  477. package/lib/api/chart.js.map +1 -1
  478. package/lib/api/composition/base.d.ts +21 -0
  479. package/lib/api/composition/base.js +62 -0
  480. package/lib/api/composition/base.js.map +1 -0
  481. package/lib/api/composition/facetCircle.d.ts +2 -3
  482. package/lib/api/composition/facetCircle.js +2 -2
  483. package/lib/api/composition/facetCircle.js.map +1 -1
  484. package/lib/api/composition/facetRect.d.ts +2 -3
  485. package/lib/api/composition/facetRect.js +2 -2
  486. package/lib/api/composition/facetRect.js.map +1 -1
  487. package/lib/api/composition/geoPath.d.ts +5 -7
  488. package/lib/api/composition/geoPath.js +4 -5
  489. package/lib/api/composition/geoPath.js.map +1 -1
  490. package/lib/api/composition/geoView.d.ts +4 -6
  491. package/lib/api/composition/geoView.js +4 -5
  492. package/lib/api/composition/geoView.js.map +1 -1
  493. package/lib/api/composition/index.d.ts +2 -1
  494. package/lib/api/composition/index.js +3 -1
  495. package/lib/api/composition/index.js.map +1 -1
  496. package/lib/api/composition/repeatMatrix.d.ts +2 -3
  497. package/lib/api/composition/repeatMatrix.js +2 -2
  498. package/lib/api/composition/repeatMatrix.js.map +1 -1
  499. package/lib/api/composition/spaceFlex.d.ts +2 -3
  500. package/lib/api/composition/spaceFlex.js +2 -2
  501. package/lib/api/composition/spaceFlex.js.map +1 -1
  502. package/lib/api/composition/spaceLayer.d.ts +2 -3
  503. package/lib/api/composition/spaceLayer.js +2 -2
  504. package/lib/api/composition/spaceLayer.js.map +1 -1
  505. package/lib/api/composition/timingKeyframe.d.ts +2 -3
  506. package/lib/api/composition/timingKeyframe.js +2 -2
  507. package/lib/api/composition/timingKeyframe.js.map +1 -1
  508. package/lib/api/composition/view.d.ts +5 -5
  509. package/lib/api/composition/view.js +6 -6
  510. package/lib/api/composition/view.js.map +1 -1
  511. package/lib/api/mark/base.d.ts +22 -0
  512. package/lib/api/mark/base.js +58 -0
  513. package/lib/api/mark/base.js.map +1 -0
  514. package/lib/api/mark/mark.d.ts +29 -29
  515. package/lib/api/mark/mark.js +32 -29
  516. package/lib/api/mark/mark.js.map +1 -1
  517. package/lib/api/mark/types.d.ts +5 -2
  518. package/lib/api/node.d.ts +2 -1
  519. package/lib/api/node.js +8 -9
  520. package/lib/api/node.js.map +1 -1
  521. package/lib/api/props.js +3 -22
  522. package/lib/api/props.js.map +1 -1
  523. package/lib/component/axis.d.ts +5 -8
  524. package/lib/component/axis.js +181 -234
  525. package/lib/component/axis.js.map +1 -1
  526. package/lib/component/axisArc.d.ts +7 -0
  527. package/lib/component/axisArc.js +13 -0
  528. package/lib/component/axisArc.js.map +1 -0
  529. package/lib/component/axisRadar.d.ts +9 -0
  530. package/lib/component/axisRadar.js +49 -0
  531. package/lib/component/axisRadar.js.map +1 -0
  532. package/lib/component/axisX.d.ts +2 -1
  533. package/lib/component/axisX.js +6 -4
  534. package/lib/component/axisX.js.map +1 -1
  535. package/lib/component/axisY.d.ts +1 -1
  536. package/lib/component/axisY.js +3 -3
  537. package/lib/component/axisY.js.map +1 -1
  538. package/lib/component/index.d.ts +14 -0
  539. package/lib/component/index.js +20 -1
  540. package/lib/component/index.js.map +1 -1
  541. package/lib/component/legendCategory.d.ts +5 -4
  542. package/lib/component/legendCategory.js +87 -55
  543. package/lib/component/legendCategory.js.map +1 -1
  544. package/lib/component/legendContinuous.d.ts +4 -2
  545. package/lib/component/legendContinuous.js +87 -25
  546. package/lib/component/legendContinuous.js.map +1 -1
  547. package/lib/component/legendContinuousBlock.d.ts +4 -0
  548. package/lib/component/legendContinuousBlock.js +10 -0
  549. package/lib/component/legendContinuousBlock.js.map +1 -0
  550. package/lib/component/legendContinuousBlockSize.d.ts +4 -0
  551. package/lib/component/legendContinuousBlockSize.js +10 -0
  552. package/lib/component/legendContinuousBlockSize.js.map +1 -0
  553. package/lib/component/legendContinuousSize.d.ts +4 -0
  554. package/lib/component/legendContinuousSize.js +14 -0
  555. package/lib/component/legendContinuousSize.js.map +1 -0
  556. package/lib/component/scrollbar.d.ts +9 -0
  557. package/lib/component/scrollbar.js +40 -0
  558. package/lib/component/scrollbar.js.map +1 -0
  559. package/lib/component/scrollbarX.d.ts +7 -0
  560. package/lib/component/scrollbarX.js +13 -0
  561. package/lib/component/scrollbarX.js.map +1 -0
  562. package/lib/component/scrollbarY.d.ts +7 -0
  563. package/lib/component/scrollbarY.js +13 -0
  564. package/lib/component/scrollbarY.js.map +1 -0
  565. package/lib/component/slider.d.ts +9 -0
  566. package/lib/component/slider.js +51 -0
  567. package/lib/component/slider.js.map +1 -0
  568. package/lib/component/sliderX.d.ts +7 -0
  569. package/lib/component/sliderX.js +13 -0
  570. package/lib/component/sliderX.js.map +1 -0
  571. package/lib/component/sliderY.d.ts +7 -0
  572. package/lib/component/sliderY.js +13 -0
  573. package/lib/component/sliderY.js.map +1 -0
  574. package/lib/component/title.js +47 -23
  575. package/lib/component/title.js.map +1 -1
  576. package/lib/component/utils.d.ts +13 -0
  577. package/lib/component/utils.js +55 -1
  578. package/lib/component/utils.js.map +1 -1
  579. package/lib/composition/facetCircle.js +2 -2
  580. package/lib/composition/facetCircle.js.map +1 -1
  581. package/lib/composition/facetRect.js +6 -8
  582. package/lib/composition/facetRect.js.map +1 -1
  583. package/lib/composition/mark.js +5 -3
  584. package/lib/composition/mark.js.map +1 -1
  585. package/lib/composition/repeatMatrix.js +4 -4
  586. package/lib/composition/repeatMatrix.js.map +1 -1
  587. package/lib/composition/view.js +8 -4
  588. package/lib/composition/view.js.map +1 -1
  589. package/lib/coordinate/fisheye.js +1 -1
  590. package/lib/coordinate/fisheye.js.map +1 -1
  591. package/lib/coordinate/index.d.ts +5 -13
  592. package/lib/coordinate/index.js +6 -11
  593. package/lib/coordinate/index.js.map +1 -1
  594. package/lib/coordinate/polar.d.ts +6 -0
  595. package/lib/coordinate/polar.js +20 -7
  596. package/lib/coordinate/polar.js.map +1 -1
  597. package/lib/coordinate/radar.d.ts +7 -0
  598. package/lib/coordinate/radar.js +18 -0
  599. package/lib/coordinate/radar.js.map +1 -0
  600. package/lib/coordinate/radial.d.ts +6 -0
  601. package/lib/coordinate/radial.js +21 -7
  602. package/lib/coordinate/radial.js.map +1 -1
  603. package/lib/coordinate/theta.d.ts +7 -0
  604. package/lib/coordinate/theta.js +18 -5
  605. package/lib/coordinate/theta.js.map +1 -1
  606. package/lib/coordinate/transpose.js +1 -1
  607. package/lib/coordinate/transpose.js.map +1 -1
  608. package/lib/data/filter.d.ts +3 -3
  609. package/lib/data/filter.js.map +1 -1
  610. package/lib/data/fold.js +4 -10
  611. package/lib/data/fold.js.map +1 -1
  612. package/lib/data/index.d.ts +5 -3
  613. package/lib/data/index.js +5 -3
  614. package/lib/data/index.js.map +1 -1
  615. package/lib/data/pick.js +10 -2
  616. package/lib/data/pick.js.map +1 -1
  617. package/lib/data/slice.d.ts +8 -0
  618. package/lib/data/slice.js +14 -0
  619. package/lib/data/slice.js.map +1 -0
  620. package/lib/data/sort.d.ts +8 -0
  621. package/lib/data/sort.js +17 -0
  622. package/lib/data/sort.js.map +1 -0
  623. package/lib/geo/{d3-projection.d.ts → d3Projection.d.ts} +0 -0
  624. package/lib/geo/{d3-projection.js → d3Projection.js} +1 -1
  625. package/lib/geo/d3Projection.js.map +1 -0
  626. package/lib/geo/geoView.js +4 -4
  627. package/lib/geo/geoView.js.map +1 -1
  628. package/lib/interaction/action/service/legendItemSelection.js.map +1 -1
  629. package/lib/interaction/action/transformer/setItemState.js.map +1 -1
  630. package/lib/interaction/builtin/activeRegion.d.ts +0 -2
  631. package/lib/interaction/builtin/brush.d.ts +1 -1
  632. package/lib/interaction/builtin/brushHighlight.d.ts +1 -1
  633. package/lib/interaction/builtin/brushVisible.d.ts +1 -1
  634. package/lib/interaction/builtin/elementHighlight.d.ts +2 -0
  635. package/lib/interaction/builtin/elementHighlightByColor.d.ts +2 -0
  636. package/lib/interaction/builtin/elementHighlightByX.d.ts +2 -0
  637. package/lib/interaction/builtin/ellipsisText.d.ts +0 -3
  638. package/lib/interaction/builtin/fisheye.d.ts +6 -6
  639. package/lib/interaction/builtin/tooltip.d.ts +4 -8
  640. package/lib/interaction/index.d.ts +13 -0
  641. package/lib/interaction/index.js +25 -31
  642. package/lib/interaction/index.js.map +1 -1
  643. package/lib/interaction/native/brushAxisHighlight.d.ts +27 -0
  644. package/lib/interaction/native/brushAxisHighlight.js +172 -0
  645. package/lib/interaction/native/brushAxisHighlight.js.map +1 -0
  646. package/lib/interaction/native/brushFilter.d.ts +14 -0
  647. package/lib/interaction/native/brushFilter.js +127 -0
  648. package/lib/interaction/native/brushFilter.js.map +1 -0
  649. package/lib/interaction/native/brushHighlight.d.ts +41 -0
  650. package/lib/interaction/native/brushHighlight.js +355 -0
  651. package/lib/interaction/native/brushHighlight.js.map +1 -0
  652. package/lib/interaction/native/brushXFilter.d.ts +1 -0
  653. package/lib/interaction/native/brushXFilter.js +10 -0
  654. package/lib/interaction/native/brushXFilter.js.map +1 -0
  655. package/lib/interaction/native/brushXHighlight.d.ts +6 -0
  656. package/lib/interaction/native/brushXHighlight.js +14 -0
  657. package/lib/interaction/native/brushXHighlight.js.map +1 -0
  658. package/lib/interaction/native/brushYFilter.d.ts +1 -0
  659. package/lib/interaction/native/brushYFilter.js +10 -0
  660. package/lib/interaction/native/brushYFilter.js.map +1 -0
  661. package/lib/interaction/native/brushYHighlight.d.ts +6 -0
  662. package/lib/interaction/native/brushYHighlight.js +14 -0
  663. package/lib/interaction/native/brushYHighlight.js.map +1 -0
  664. package/lib/interaction/native/elementHighlight.d.ts +10 -2
  665. package/lib/interaction/native/elementHighlight.js +86 -23
  666. package/lib/interaction/native/elementHighlight.js.map +1 -1
  667. package/lib/interaction/native/elementHighlightByColor.d.ts +0 -3
  668. package/lib/interaction/native/elementHighlightByColor.js +1 -7
  669. package/lib/interaction/native/elementHighlightByColor.js.map +1 -1
  670. package/lib/interaction/native/elementHighlightByX.d.ts +1 -8
  671. package/lib/interaction/native/elementHighlightByX.js +2 -9
  672. package/lib/interaction/native/elementHighlightByX.js.map +1 -1
  673. package/lib/interaction/native/elementSelect.d.ts +7 -2
  674. package/lib/interaction/native/elementSelect.js +58 -26
  675. package/lib/interaction/native/elementSelect.js.map +1 -1
  676. package/lib/interaction/native/elementSelectByColor.js +1 -4
  677. package/lib/interaction/native/elementSelectByColor.js.map +1 -1
  678. package/lib/interaction/native/elementSelectByX.js +1 -4
  679. package/lib/interaction/native/elementSelectByX.js.map +1 -1
  680. package/lib/interaction/native/fisheye.js +6 -4
  681. package/lib/interaction/native/fisheye.js.map +1 -1
  682. package/lib/interaction/native/legendFilter.d.ts +14 -0
  683. package/lib/interaction/native/legendFilter.js +205 -0
  684. package/lib/interaction/native/legendFilter.js.map +1 -0
  685. package/lib/interaction/native/legendHighlight.d.ts +1 -0
  686. package/lib/interaction/native/legendHighlight.js +91 -0
  687. package/lib/interaction/native/legendHighlight.js.map +1 -0
  688. package/lib/interaction/native/poptip.d.ts +5 -0
  689. package/lib/interaction/native/poptip.js +95 -0
  690. package/lib/interaction/native/poptip.js.map +1 -0
  691. package/lib/interaction/native/sliderFilter.d.ts +5 -0
  692. package/lib/interaction/native/sliderFilter.js +91 -0
  693. package/lib/interaction/native/sliderFilter.js.map +1 -0
  694. package/lib/interaction/native/tooltip.d.ts +2 -2
  695. package/lib/interaction/native/tooltip.js +146 -44
  696. package/lib/interaction/native/tooltip.js.map +1 -1
  697. package/lib/interaction/native/utils.d.ts +24 -5
  698. package/lib/interaction/native/utils.js +258 -44
  699. package/lib/interaction/native/utils.js.map +1 -1
  700. package/lib/label-transform/contrastReverse.d.ts +9 -0
  701. package/lib/label-transform/contrastReverse.js +52 -0
  702. package/lib/label-transform/contrastReverse.js.map +1 -0
  703. package/lib/label-transform/index.d.ts +8 -8
  704. package/lib/label-transform/index.js +9 -9
  705. package/lib/label-transform/index.js.map +1 -1
  706. package/lib/label-transform/overflowHide.d.ts +7 -0
  707. package/lib/label-transform/overflowHide.js +22 -0
  708. package/lib/label-transform/overflowHide.js.map +1 -0
  709. package/lib/label-transform/overlapDodgeY.d.ts +7 -0
  710. package/lib/label-transform/{dodgeY.js → overlapDodgeY.js} +6 -6
  711. package/lib/label-transform/overlapDodgeY.js.map +1 -0
  712. package/lib/label-transform/overlapHide.d.ts +7 -0
  713. package/lib/label-transform/overlapHide.js +28 -0
  714. package/lib/label-transform/overlapHide.js.map +1 -0
  715. package/lib/mark/area.js +2 -2
  716. package/lib/mark/area.js.map +1 -1
  717. package/lib/mark/boxplot.js +5 -18
  718. package/lib/mark/boxplot.js.map +1 -1
  719. package/lib/mark/cell.js +1 -1
  720. package/lib/mark/line.js +1 -1
  721. package/lib/mark/line.js.map +1 -1
  722. package/lib/mark/pack.js +0 -1
  723. package/lib/mark/pack.js.map +1 -1
  724. package/lib/mark/treemap.js +0 -1
  725. package/lib/mark/treemap.js.map +1 -1
  726. package/lib/runtime/component.d.ts +4 -1
  727. package/lib/runtime/component.js +276 -108
  728. package/lib/runtime/component.js.map +1 -1
  729. package/lib/runtime/coordinate.d.ts +12 -0
  730. package/lib/runtime/coordinate.js +51 -17
  731. package/lib/runtime/coordinate.js.map +1 -1
  732. package/lib/runtime/layout.d.ts +1 -1
  733. package/lib/runtime/layout.js +146 -77
  734. package/lib/runtime/layout.js.map +1 -1
  735. package/lib/runtime/plot.d.ts +1 -1
  736. package/lib/runtime/plot.js +152 -66
  737. package/lib/runtime/plot.js.map +1 -1
  738. package/lib/runtime/render.d.ts +0 -1
  739. package/lib/runtime/render.js +24 -47
  740. package/lib/runtime/render.js.map +1 -1
  741. package/lib/runtime/scale.d.ts +3 -1
  742. package/lib/runtime/scale.js +61 -5
  743. package/lib/runtime/scale.js.map +1 -1
  744. package/lib/runtime/transform.js +17 -7
  745. package/lib/runtime/transform.js.map +1 -1
  746. package/lib/runtime/types/common.d.ts +38 -11
  747. package/lib/runtime/types/component.d.ts +13 -8
  748. package/lib/runtime/types/mark.d.ts +1 -1
  749. package/lib/runtime/types/options.d.ts +14 -12
  750. package/lib/runtime/types/scale.d.ts +18 -0
  751. package/lib/runtime/types/scale.js +22 -0
  752. package/lib/runtime/types/scale.js.map +1 -0
  753. package/lib/runtime/types/theme.d.ts +8 -5
  754. package/lib/shape/area/curve.js +16 -16
  755. package/lib/shape/area/curve.js.map +1 -1
  756. package/lib/shape/area/hv.d.ts +3 -0
  757. package/lib/shape/area/hv.js +13 -0
  758. package/lib/shape/area/hv.js.map +1 -0
  759. package/lib/shape/area/hvh.d.ts +3 -0
  760. package/lib/shape/area/{step.js → hvh.js} +5 -5
  761. package/lib/shape/area/hvh.js.map +1 -0
  762. package/lib/shape/area/vh.d.ts +3 -0
  763. package/lib/shape/area/vh.js +13 -0
  764. package/lib/shape/area/vh.js.map +1 -0
  765. package/lib/shape/box/box.js +1 -1
  766. package/lib/shape/box/box.js.map +1 -1
  767. package/lib/shape/connector/connector.js +3 -3
  768. package/lib/shape/connector/connector.js.map +1 -1
  769. package/lib/shape/image/image.js +2 -2
  770. package/lib/shape/image/image.js.map +1 -1
  771. package/lib/shape/index.d.ts +6 -2
  772. package/lib/shape/index.js +7 -3
  773. package/lib/shape/index.js.map +1 -1
  774. package/lib/shape/interval/color.d.ts +1 -0
  775. package/lib/shape/interval/color.js +69 -52
  776. package/lib/shape/interval/color.js.map +1 -1
  777. package/lib/shape/label/label.js +3 -3
  778. package/lib/shape/label/label.js.map +1 -1
  779. package/lib/shape/label/position/area.d.ts +13 -0
  780. package/lib/shape/label/position/area.js +32 -0
  781. package/lib/shape/label/position/area.js.map +1 -0
  782. package/lib/shape/label/position/bottom.d.ts +1 -0
  783. package/lib/shape/label/position/bottom.js +6 -0
  784. package/lib/shape/label/position/bottom.js.map +1 -0
  785. package/lib/shape/label/position/bottomLeft.d.ts +1 -0
  786. package/lib/shape/label/position/bottomLeft.js +6 -0
  787. package/lib/shape/label/position/bottomLeft.js.map +1 -0
  788. package/lib/shape/label/position/bottomRight.d.ts +1 -0
  789. package/lib/shape/label/position/bottomRight.js +6 -0
  790. package/lib/shape/label/position/bottomRight.js.map +1 -0
  791. package/lib/shape/label/position/default.d.ts +18 -0
  792. package/lib/shape/label/{position.js → position/default.js} +24 -81
  793. package/lib/shape/label/position/default.js.map +1 -0
  794. package/lib/shape/label/position/index.d.ts +13 -0
  795. package/lib/shape/label/position/index.js +30 -0
  796. package/lib/shape/label/position/index.js.map +1 -0
  797. package/lib/shape/label/position/inside.d.ts +1 -0
  798. package/lib/shape/label/position/inside.js +6 -0
  799. package/lib/shape/label/position/inside.js.map +1 -0
  800. package/lib/shape/label/position/left.d.ts +1 -0
  801. package/lib/shape/label/position/left.js +6 -0
  802. package/lib/shape/label/position/left.js.map +1 -0
  803. package/lib/shape/label/position/outside.d.ts +18 -0
  804. package/lib/shape/label/position/outside.js +75 -0
  805. package/lib/shape/label/position/outside.js.map +1 -0
  806. package/lib/shape/label/position/right.d.ts +1 -0
  807. package/lib/shape/label/position/right.js +6 -0
  808. package/lib/shape/label/position/right.js.map +1 -0
  809. package/lib/shape/label/position/spider.d.ts +7 -0
  810. package/lib/shape/label/position/spider.js +38 -0
  811. package/lib/shape/label/position/spider.js.map +1 -0
  812. package/lib/shape/label/position/surround.d.ts +7 -0
  813. package/lib/shape/label/position/surround.js +39 -0
  814. package/lib/shape/label/position/surround.js.map +1 -0
  815. package/lib/shape/label/position/top.d.ts +1 -0
  816. package/lib/shape/label/position/top.js +6 -0
  817. package/lib/shape/label/position/top.js.map +1 -0
  818. package/lib/shape/label/position/topLeft.d.ts +1 -0
  819. package/lib/shape/label/position/topLeft.js +6 -0
  820. package/lib/shape/label/position/topLeft.js.map +1 -0
  821. package/lib/shape/label/position/topRight.d.ts +1 -0
  822. package/lib/shape/label/position/topRight.js +6 -0
  823. package/lib/shape/label/position/topRight.js.map +1 -0
  824. package/lib/shape/line/curve.js +22 -11
  825. package/lib/shape/line/curve.js.map +1 -1
  826. package/lib/shape/line/line.js +5 -1
  827. package/lib/shape/line/line.js.map +1 -1
  828. package/lib/shape/line/smooth.js +5 -1
  829. package/lib/shape/line/smooth.js.map +1 -1
  830. package/lib/shape/lineXY/line.js +2 -2
  831. package/lib/shape/lineXY/line.js.map +1 -1
  832. package/lib/shape/link/arc.js +2 -2
  833. package/lib/shape/link/arc.js.map +1 -1
  834. package/lib/shape/link/link.js +2 -2
  835. package/lib/shape/link/link.js.map +1 -1
  836. package/lib/shape/link/smooth.js +2 -2
  837. package/lib/shape/link/smooth.js.map +1 -1
  838. package/lib/shape/link/vhv.js +2 -2
  839. package/lib/shape/link/vhv.js.map +1 -1
  840. package/lib/shape/point/color.js +1 -1
  841. package/lib/shape/point/color.js.map +1 -1
  842. package/lib/shape/polygon/polygon.js +3 -3
  843. package/lib/shape/polygon/polygon.js.map +1 -1
  844. package/lib/shape/polygon/ribbon.js +3 -3
  845. package/lib/shape/polygon/ribbon.js.map +1 -1
  846. package/lib/shape/text/advance.js +3 -3
  847. package/lib/shape/text/advance.js.map +1 -1
  848. package/lib/shape/text/badge.js +3 -3
  849. package/lib/shape/text/badge.js.map +1 -1
  850. package/lib/shape/text/text.js +1 -1
  851. package/lib/shape/text/text.js.map +1 -1
  852. package/lib/shape/utils.d.ts +5 -0
  853. package/lib/shape/utils.js +15 -2
  854. package/lib/shape/utils.js.map +1 -1
  855. package/lib/shape/vector/vector.js +3 -3
  856. package/lib/shape/vector/vector.js.map +1 -1
  857. package/lib/spec/composition.d.ts +9 -7
  858. package/lib/spec/coordinate.d.ts +17 -33
  859. package/lib/spec/data.d.ts +32 -10
  860. package/lib/spec/geometry.d.ts +24 -9
  861. package/lib/spec/interaction.d.ts +81 -27
  862. package/lib/spec/labelTransform.d.ts +24 -11
  863. package/lib/spec/theme.d.ts +5 -2
  864. package/lib/spec/transform.d.ts +27 -4
  865. package/lib/spec/utils.d.ts +7 -0
  866. package/lib/spec/utils.js +3 -0
  867. package/lib/spec/utils.js.map +1 -0
  868. package/lib/stdlib/index.js +3 -4
  869. package/lib/stdlib/index.js.map +1 -1
  870. package/lib/theme/academy.d.ts +3 -0
  871. package/lib/theme/academy.js +408 -0
  872. package/lib/theme/academy.js.map +1 -0
  873. package/lib/theme/dark.js +163 -100
  874. package/lib/theme/dark.js.map +1 -1
  875. package/lib/theme/index.d.ts +1 -0
  876. package/lib/theme/index.js +3 -1
  877. package/lib/theme/index.js.map +1 -1
  878. package/lib/theme/light.js +177 -101
  879. package/lib/theme/light.js.map +1 -1
  880. package/lib/transform/filter.d.ts +7 -0
  881. package/lib/transform/filter.js +46 -0
  882. package/lib/transform/filter.js.map +1 -0
  883. package/lib/transform/groupN.js +2 -0
  884. package/lib/transform/groupN.js.map +1 -1
  885. package/lib/transform/index.d.ts +10 -6
  886. package/lib/transform/index.js +11 -7
  887. package/lib/transform/index.js.map +1 -1
  888. package/lib/transform/maybeTooltip.js +3 -1
  889. package/lib/transform/maybeTooltip.js.map +1 -1
  890. package/lib/transform/sample.d.ts +8 -0
  891. package/lib/transform/sample.js +68 -0
  892. package/lib/transform/sample.js.map +1 -0
  893. package/lib/transform/{Select.d.ts → select.d.ts} +0 -0
  894. package/lib/transform/{Select.js → select.js} +2 -14
  895. package/lib/transform/select.js.map +1 -0
  896. package/lib/transform/{SelectX.d.ts → selectX.d.ts} +0 -0
  897. package/lib/transform/{SelectX.js → selectX.js} +3 -3
  898. package/lib/transform/selectX.js.map +1 -0
  899. package/lib/transform/{SelectY.d.ts → selectY.d.ts} +0 -0
  900. package/lib/transform/{SelectY.js → selectY.js} +3 -3
  901. package/lib/transform/selectY.js.map +1 -0
  902. package/lib/transform/sort.d.ts +1 -1
  903. package/lib/transform/sort.js +38 -20
  904. package/lib/transform/sort.js.map +1 -1
  905. package/lib/transform/utils/lttb.d.ts +5 -0
  906. package/lib/transform/utils/lttb.js +60 -0
  907. package/lib/transform/utils/lttb.js.map +1 -0
  908. package/lib/utils/angle.d.ts +2 -0
  909. package/lib/utils/angle.js +12 -0
  910. package/lib/utils/angle.js.map +1 -0
  911. package/lib/utils/array.d.ts +8 -0
  912. package/lib/utils/array.js +38 -1
  913. package/lib/utils/array.js.map +1 -1
  914. package/lib/utils/bounds.d.ts +26 -0
  915. package/lib/utils/bounds.js +48 -0
  916. package/lib/utils/bounds.js.map +1 -0
  917. package/lib/utils/color.d.ts +6 -0
  918. package/lib/utils/color.js +11 -0
  919. package/lib/utils/color.js.map +1 -0
  920. package/lib/utils/coordinate.d.ts +5 -0
  921. package/lib/utils/coordinate.js +37 -1
  922. package/lib/utils/coordinate.js.map +1 -1
  923. package/lib/utils/event.d.ts +0 -2
  924. package/lib/utils/event.js +1 -21
  925. package/lib/utils/event.js.map +1 -1
  926. package/lib/utils/helper.d.ts +2 -0
  927. package/lib/utils/helper.js +12 -2
  928. package/lib/utils/helper.js.map +1 -1
  929. package/lib/utils/scale.d.ts +3 -0
  930. package/lib/utils/scale.js +36 -0
  931. package/lib/utils/scale.js.map +1 -0
  932. package/lib/utils/selection.d.ts +1 -0
  933. package/lib/utils/selection.js +5 -2
  934. package/lib/utils/selection.js.map +1 -1
  935. package/lib/utils/size.js +1 -1
  936. package/lib/utils/size.js.map +1 -1
  937. package/lib/utils/vector.d.ts +1 -1
  938. package/lib/utils/vector.js +1 -1
  939. package/package.json +9 -8
  940. package/src/animation/morphing.ts +35 -10
  941. package/src/animation/waveIn.ts +0 -1
  942. package/src/api/chart.ts +78 -37
  943. package/src/api/composition/base.ts +56 -0
  944. package/src/api/composition/facetCircle.ts +2 -3
  945. package/src/api/composition/facetRect.ts +2 -3
  946. package/src/api/composition/geoPath.ts +6 -9
  947. package/src/api/composition/geoView.ts +6 -9
  948. package/src/api/composition/index.ts +2 -0
  949. package/src/api/composition/repeatMatrix.ts +2 -3
  950. package/src/api/composition/spaceFlex.ts +2 -3
  951. package/src/api/composition/spaceLayer.ts +2 -3
  952. package/src/api/composition/timingKeyframe.ts +2 -3
  953. package/src/api/composition/view.ts +10 -8
  954. package/src/api/mark/base.ts +58 -0
  955. package/src/api/mark/mark.ts +34 -30
  956. package/src/api/mark/types.ts +5 -2
  957. package/src/api/node.ts +9 -11
  958. package/src/api/props.ts +4 -25
  959. package/src/component/axis.ts +341 -366
  960. package/src/component/axisArc.ts +16 -0
  961. package/src/component/axisRadar.ts +72 -0
  962. package/src/component/axisX.ts +7 -4
  963. package/src/component/axisY.ts +4 -4
  964. package/src/component/index.ts +14 -0
  965. package/src/component/legendCategory.ts +182 -76
  966. package/src/component/legendContinuous.ts +133 -33
  967. package/src/component/legendContinuousBlock.ts +17 -0
  968. package/src/component/legendContinuousBlockSize.ts +22 -0
  969. package/src/component/legendContinuousSize.ts +27 -0
  970. package/src/component/scrollbar.ts +41 -0
  971. package/src/component/scrollbarX.ts +16 -0
  972. package/src/component/scrollbarY.ts +16 -0
  973. package/src/component/slider.ts +52 -0
  974. package/src/component/sliderX.ts +16 -0
  975. package/src/component/sliderY.ts +16 -0
  976. package/src/component/title.ts +70 -31
  977. package/src/component/utils.ts +51 -0
  978. package/src/composition/facetCircle.ts +2 -2
  979. package/src/composition/facetRect.ts +6 -6
  980. package/src/composition/mark.ts +8 -4
  981. package/src/composition/repeatMatrix.ts +10 -3
  982. package/src/composition/view.ts +22 -2
  983. package/src/coordinate/fisheye.ts +1 -1
  984. package/src/coordinate/index.ts +5 -13
  985. package/src/coordinate/polar.ts +19 -11
  986. package/src/coordinate/radar.ts +24 -0
  987. package/src/coordinate/radial.ts +21 -11
  988. package/src/coordinate/theta.ts +18 -9
  989. package/src/coordinate/transpose.ts +1 -1
  990. package/src/data/filter.ts +3 -3
  991. package/src/data/fold.ts +6 -10
  992. package/src/data/index.ts +5 -3
  993. package/src/data/pick.ts +11 -2
  994. package/src/data/slice.ts +15 -0
  995. package/src/data/sort.ts +18 -0
  996. package/src/geo/{d3-projection.ts → d3Projection.ts} +0 -0
  997. package/src/geo/geoView.ts +4 -4
  998. package/src/interaction/action/service/legendItemSelection.ts +1 -2
  999. package/src/interaction/action/transformer/setItemState.ts +2 -3
  1000. package/src/interaction/index.ts +29 -16
  1001. package/src/interaction/native/brushAxisHighlight.ts +207 -0
  1002. package/src/interaction/native/brushFilter.ts +143 -0
  1003. package/src/interaction/native/brushHighlight.ts +447 -0
  1004. package/src/interaction/native/brushXFilter.ts +10 -0
  1005. package/src/interaction/native/brushXHighlight.ts +13 -0
  1006. package/src/interaction/native/brushYFilter.ts +10 -0
  1007. package/src/interaction/native/brushYHighlight.ts +13 -0
  1008. package/src/interaction/native/elementHighlight.ts +99 -15
  1009. package/src/interaction/native/elementHighlightByColor.ts +3 -20
  1010. package/src/interaction/native/elementHighlightByX.ts +4 -23
  1011. package/src/interaction/native/elementSelect.ts +79 -20
  1012. package/src/interaction/native/elementSelectByColor.ts +3 -16
  1013. package/src/interaction/native/elementSelectByX.ts +3 -16
  1014. package/src/interaction/native/fisheye.ts +6 -4
  1015. package/src/interaction/native/legendFilter.ts +214 -0
  1016. package/src/interaction/native/legendHighlight.ts +100 -0
  1017. package/src/interaction/native/poptip.ts +87 -0
  1018. package/src/interaction/native/sliderFilter.ts +112 -0
  1019. package/src/interaction/native/tooltip.ts +191 -49
  1020. package/src/interaction/native/utils.ts +298 -44
  1021. package/src/label-transform/contrastReverse.ts +56 -0
  1022. package/src/label-transform/index.ts +8 -8
  1023. package/src/label-transform/overflowHide.ts +23 -0
  1024. package/src/label-transform/{dodgeY.ts → overlapDodgeY.ts} +7 -7
  1025. package/src/label-transform/overlapHide.ts +32 -0
  1026. package/src/mark/area.ts +2 -2
  1027. package/src/mark/boxplot.ts +3 -1
  1028. package/src/mark/cell.ts +1 -1
  1029. package/src/mark/line.ts +1 -1
  1030. package/src/mark/pack.ts +0 -1
  1031. package/src/mark/treemap.ts +0 -1
  1032. package/src/runtime/component.ts +393 -143
  1033. package/src/runtime/coordinate.ts +46 -16
  1034. package/src/runtime/layout.ts +206 -97
  1035. package/src/runtime/plot.ts +253 -118
  1036. package/src/runtime/render.ts +33 -72
  1037. package/src/runtime/scale.ts +70 -7
  1038. package/src/runtime/transform.ts +22 -6
  1039. package/src/runtime/types/common.ts +50 -20
  1040. package/src/runtime/types/component.ts +18 -11
  1041. package/src/runtime/types/mark.ts +1 -1
  1042. package/src/runtime/types/options.ts +30 -22
  1043. package/src/runtime/types/scale.ts +20 -0
  1044. package/src/runtime/types/theme.ts +8 -5
  1045. package/src/shape/area/curve.ts +22 -17
  1046. package/src/shape/area/hv.ts +20 -0
  1047. package/src/shape/area/{step.ts → hvh.ts} +3 -3
  1048. package/src/shape/area/vh.ts +20 -0
  1049. package/src/shape/box/box.ts +6 -6
  1050. package/src/shape/connector/connector.ts +3 -4
  1051. package/src/shape/image/image.ts +2 -2
  1052. package/src/shape/index.ts +7 -2
  1053. package/src/shape/interval/color.ts +95 -60
  1054. package/src/shape/label/label.ts +4 -3
  1055. package/src/shape/label/position/area.ts +39 -0
  1056. package/src/shape/label/position/bottom.ts +1 -0
  1057. package/src/shape/label/position/bottomLeft.ts +1 -0
  1058. package/src/shape/label/position/bottomRight.ts +1 -0
  1059. package/src/shape/label/{position.ts → position/default.ts} +26 -110
  1060. package/src/shape/label/position/index.ts +13 -0
  1061. package/src/shape/label/position/inside.ts +1 -0
  1062. package/src/shape/label/position/left.ts +1 -0
  1063. package/src/shape/label/position/outside.ts +121 -0
  1064. package/src/shape/label/position/right.ts +1 -0
  1065. package/src/shape/label/position/spider.ts +39 -0
  1066. package/src/shape/label/position/surround.ts +40 -0
  1067. package/src/shape/label/position/top.ts +1 -0
  1068. package/src/shape/label/position/topLeft.ts +1 -0
  1069. package/src/shape/label/position/topRight.ts +1 -0
  1070. package/src/shape/line/curve.ts +28 -13
  1071. package/src/shape/line/line.ts +6 -2
  1072. package/src/shape/line/smooth.ts +11 -2
  1073. package/src/shape/lineXY/line.ts +2 -2
  1074. package/src/shape/link/arc.ts +2 -2
  1075. package/src/shape/link/link.ts +2 -2
  1076. package/src/shape/link/smooth.ts +2 -2
  1077. package/src/shape/link/vhv.ts +2 -2
  1078. package/src/shape/point/color.ts +6 -5
  1079. package/src/shape/polygon/polygon.ts +3 -3
  1080. package/src/shape/polygon/ribbon.ts +3 -3
  1081. package/src/shape/text/advance.ts +6 -3
  1082. package/src/shape/text/badge.ts +8 -3
  1083. package/src/shape/text/text.ts +1 -1
  1084. package/src/shape/utils.ts +16 -6
  1085. package/src/shape/vector/vector.ts +3 -3
  1086. package/src/spec/action.ts +0 -1
  1087. package/src/spec/composition.ts +8 -8
  1088. package/src/spec/coordinate.ts +25 -51
  1089. package/src/spec/data.ts +36 -11
  1090. package/src/spec/geometry.ts +29 -14
  1091. package/src/spec/interaction.ts +120 -50
  1092. package/src/spec/labelTransform.ts +29 -11
  1093. package/src/spec/theme.ts +6 -2
  1094. package/src/spec/transform.ts +47 -3
  1095. package/src/spec/utils.ts +7 -0
  1096. package/src/stdlib/index.ts +73 -27
  1097. package/src/theme/academy.ts +410 -0
  1098. package/src/theme/dark.ts +164 -101
  1099. package/src/theme/index.ts +1 -0
  1100. package/src/theme/light.ts +177 -102
  1101. package/src/transform/filter.ts +48 -0
  1102. package/src/transform/groupN.ts +2 -0
  1103. package/src/transform/index.ts +10 -6
  1104. package/src/transform/maybeTooltip.ts +3 -1
  1105. package/src/transform/sample.ts +80 -0
  1106. package/src/transform/select.ts +1 -2
  1107. package/src/transform/selectX.ts +2 -2
  1108. package/src/transform/selectY.ts +2 -2
  1109. package/src/transform/sort.ts +53 -21
  1110. package/src/transform/utils/lttb.ts +73 -0
  1111. package/src/utils/angle.ts +7 -0
  1112. package/src/utils/array.ts +39 -0
  1113. package/src/utils/bounds.ts +52 -0
  1114. package/src/utils/color.ts +12 -0
  1115. package/src/utils/coordinate.ts +41 -0
  1116. package/src/utils/event.ts +0 -26
  1117. package/src/utils/helper.ts +17 -2
  1118. package/src/utils/scale.ts +31 -0
  1119. package/src/utils/selection.ts +7 -2
  1120. package/src/utils/size.ts +1 -1
  1121. package/src/utils/vector.ts +1 -1
  1122. package/esm/coordinate/fisheyeX.d.ts +0 -7
  1123. package/esm/coordinate/fisheyeX.js +0 -6
  1124. package/esm/coordinate/fisheyeX.js.map +0 -1
  1125. package/esm/coordinate/fisheyeY.d.ts +0 -7
  1126. package/esm/coordinate/fisheyeY.js +0 -6
  1127. package/esm/coordinate/fisheyeY.js.map +0 -1
  1128. package/esm/coordinate/reflect.d.ts +0 -7
  1129. package/esm/coordinate/reflect.js +0 -10
  1130. package/esm/coordinate/reflect.js.map +0 -1
  1131. package/esm/coordinate/reflectX.d.ts +0 -7
  1132. package/esm/coordinate/reflectX.js +0 -10
  1133. package/esm/coordinate/reflectX.js.map +0 -1
  1134. package/esm/coordinate/reflectY.d.ts +0 -7
  1135. package/esm/coordinate/reflectY.js +0 -10
  1136. package/esm/coordinate/reflectY.js.map +0 -1
  1137. package/esm/data/subset.d.ts +0 -7
  1138. package/esm/data/subset.js +0 -26
  1139. package/esm/data/subset.js.map +0 -1
  1140. package/esm/geo/d3-projection.js.map +0 -1
  1141. package/esm/label-transform/dodgeY.d.ts +0 -7
  1142. package/esm/label-transform/dodgeY.js.map +0 -1
  1143. package/esm/label-transform/hideOverlap.d.ts +0 -4
  1144. package/esm/label-transform/hideOverlap.js +0 -48
  1145. package/esm/label-transform/hideOverlap.js.map +0 -1
  1146. package/esm/label-transform/spider.d.ts +0 -7
  1147. package/esm/label-transform/spider.js +0 -30
  1148. package/esm/label-transform/spider.js.map +0 -1
  1149. package/esm/label-transform/surround.d.ts +0 -7
  1150. package/esm/label-transform/surround.js +0 -30
  1151. package/esm/label-transform/surround.js.map +0 -1
  1152. package/esm/shape/area/step.d.ts +0 -3
  1153. package/esm/shape/area/step.js.map +0 -1
  1154. package/esm/shape/label/position.d.ts +0 -25
  1155. package/esm/shape/label/position.js +0 -169
  1156. package/esm/shape/label/position.js.map +0 -1
  1157. package/esm/transform/Select.js.map +0 -1
  1158. package/esm/transform/SelectX.js.map +0 -1
  1159. package/esm/transform/SelectY.js.map +0 -1
  1160. package/lib/coordinate/fisheyeX.d.ts +0 -7
  1161. package/lib/coordinate/fisheyeX.js +0 -10
  1162. package/lib/coordinate/fisheyeX.js.map +0 -1
  1163. package/lib/coordinate/fisheyeY.d.ts +0 -7
  1164. package/lib/coordinate/fisheyeY.js +0 -10
  1165. package/lib/coordinate/fisheyeY.js.map +0 -1
  1166. package/lib/coordinate/reflect.d.ts +0 -7
  1167. package/lib/coordinate/reflect.js +0 -14
  1168. package/lib/coordinate/reflect.js.map +0 -1
  1169. package/lib/coordinate/reflectX.d.ts +0 -7
  1170. package/lib/coordinate/reflectX.js +0 -14
  1171. package/lib/coordinate/reflectX.js.map +0 -1
  1172. package/lib/coordinate/reflectY.d.ts +0 -7
  1173. package/lib/coordinate/reflectY.js +0 -14
  1174. package/lib/coordinate/reflectY.js.map +0 -1
  1175. package/lib/data/subset.d.ts +0 -7
  1176. package/lib/data/subset.js +0 -30
  1177. package/lib/data/subset.js.map +0 -1
  1178. package/lib/geo/d3-projection.js.map +0 -1
  1179. package/lib/label-transform/dodgeY.d.ts +0 -7
  1180. package/lib/label-transform/dodgeY.js.map +0 -1
  1181. package/lib/label-transform/hideOverlap.d.ts +0 -4
  1182. package/lib/label-transform/hideOverlap.js +0 -52
  1183. package/lib/label-transform/hideOverlap.js.map +0 -1
  1184. package/lib/label-transform/spider.d.ts +0 -7
  1185. package/lib/label-transform/spider.js +0 -34
  1186. package/lib/label-transform/spider.js.map +0 -1
  1187. package/lib/label-transform/surround.d.ts +0 -7
  1188. package/lib/label-transform/surround.js +0 -34
  1189. package/lib/label-transform/surround.js.map +0 -1
  1190. package/lib/shape/area/step.d.ts +0 -3
  1191. package/lib/shape/area/step.js.map +0 -1
  1192. package/lib/shape/label/position.d.ts +0 -25
  1193. package/lib/shape/label/position.js.map +0 -1
  1194. package/lib/transform/Select.js.map +0 -1
  1195. package/lib/transform/SelectX.js.map +0 -1
  1196. package/lib/transform/SelectY.js.map +0 -1
  1197. package/src/coordinate/fisheyeX.ts +0 -15
  1198. package/src/coordinate/fisheyeY.ts +0 -15
  1199. package/src/coordinate/reflect.ts +0 -15
  1200. package/src/coordinate/reflectX.ts +0 -15
  1201. package/src/coordinate/reflectY.ts +0 -15
  1202. package/src/data/subset.ts +0 -35
  1203. package/src/label-transform/hideOverlap.ts +0 -62
  1204. package/src/label-transform/spider.ts +0 -37
  1205. package/src/label-transform/surround.ts +0 -37
@@ -1,27 +1,32 @@
1
- import { Coordinate, Vector2 } from '@antv/coord';
2
- import { Arc, Linear } from '@antv/gui';
1
+ import { Coordinate } from '@antv/coord';
2
+ import { Axis as AxisComponent } from '@antv/gui';
3
3
  import { Linear as LinearScale } from '@antv/scale';
4
- import { deepMix, size } from '@antv/util';
5
- import { format } from 'd3-format';
4
+ import { deepMix } from '@antv/util';
6
5
  import { extent } from 'd3-array';
7
- import {
8
- isParallel,
9
- isPolar,
10
- isTranspose,
11
- isTheta,
12
- isRadial,
13
- isFisheye,
14
- } from '../utils/coordinate';
6
+ import { format } from 'd3-format';
15
7
  import {
16
8
  BBox,
9
+ G2Theme,
17
10
  GuideComponentComponent as GCC,
18
- GuideComponentPosition,
11
+ GuideComponentOrientation as GCO,
12
+ GuideComponentPosition as GCP,
19
13
  Scale,
20
14
  } from '../runtime';
21
- import { subObject } from '../utils/helper';
15
+ import {
16
+ angleOf,
17
+ isFisheye,
18
+ isParallel,
19
+ isPolar,
20
+ isRadial,
21
+ isTheta,
22
+ isTranspose,
23
+ radiusOf,
24
+ } from '../utils/coordinate';
25
+ import { capitalizeFirst } from '../utils/helper';
26
+ import { titleContent } from './utils';
22
27
 
23
28
  export type AxisOptions = {
24
- position?: GuideComponentPosition;
29
+ position?: GCP;
25
30
  zIndex?: number;
26
31
  title?: string | string[];
27
32
  direction?: 'left' | 'center' | 'right';
@@ -34,108 +39,11 @@ export type AxisOptions = {
34
39
  ) => number[];
35
40
  tickCount?: number;
36
41
  grid: any;
42
+ // options won't be overridden
43
+ important: Record<string, any>;
37
44
  [key: string]: any;
38
45
  };
39
46
 
40
- function inferPosition(
41
- position: GuideComponentPosition,
42
- direction: string,
43
- bbox: BBox,
44
- coordinate: Coordinate,
45
- ): {
46
- startPos: [number, number];
47
- endPos: [number, number];
48
- labelOffset: number;
49
- titlePosition: 'start' | 'end' | 'center';
50
- titlePadding: number;
51
- titleRotate: number;
52
- verticalFactor: 1 | -1;
53
- titleOffsetY?: number;
54
- labelAlign?: 'start' | 'end' | 'center' | 'left' | 'right';
55
- label?: boolean;
56
- axisLine?: boolean;
57
- tickLine?: boolean;
58
- } {
59
- const { x, y, width, height } = bbox;
60
- if (position === 'bottom') {
61
- return {
62
- startPos: [x, y],
63
- endPos: [x + width, y],
64
- labelOffset: 8,
65
- titlePosition: 'end',
66
- titlePadding: 2,
67
- titleRotate: 0,
68
- verticalFactor: 1,
69
- };
70
- } else if (position === 'left' || position === 'centerHorizontal') {
71
- return {
72
- startPos: [x + width, y],
73
- endPos: [x + width, y + height],
74
- titlePosition: 'center',
75
- titlePadding: 6,
76
- titleRotate: -90,
77
- labelAlign: 'end',
78
- labelOffset: 4,
79
- verticalFactor: -1,
80
- };
81
- } else if (position === 'right') {
82
- return {
83
- startPos: [x, y],
84
- endPos: [x, y + height],
85
- titlePosition: 'center',
86
- titlePadding: 16,
87
- titleRotate: -90,
88
- labelAlign: 'start',
89
- labelOffset: 4,
90
- verticalFactor: 1,
91
- };
92
- } else if (position === 'arcY') {
93
- return {
94
- startPos: [x, y],
95
- endPos: [x + width, y + height],
96
- titlePosition: 'start',
97
- titlePadding: 4,
98
- titleOffsetY: -5,
99
- titleRotate: 0,
100
- labelOffset: direction === 'left' ? 4 : direction === 'right' ? -4 : 0,
101
- verticalFactor: -1,
102
- labelAlign:
103
- direction === 'center'
104
- ? 'center'
105
- : direction === 'right'
106
- ? 'start'
107
- : undefined,
108
- axisLine: false,
109
- };
110
- }
111
- // position === 'centerVertical'
112
- return {
113
- startPos: [x, y + height],
114
- endPos: [x + width, y + height],
115
- titlePosition: 'end',
116
- titlePadding: 2,
117
- titleRotate: 0,
118
- labelOffset: 4,
119
- verticalFactor: -1,
120
- };
121
- }
122
-
123
- function angleOf(coordinate: Coordinate): [number, number] {
124
- const { transformations } = coordinate.getOptions();
125
- const [, startAngle, endAngle] = transformations.find(
126
- (d) => d[0] === 'polar',
127
- );
128
- return [(+startAngle * 180) / Math.PI, (+endAngle * 180) / Math.PI];
129
- }
130
-
131
- function radiusOf(coordinate: Coordinate): [number, number] {
132
- const { transformations } = coordinate.getOptions();
133
- const [, , , innerRadius, outerRadius] = transformations.find(
134
- (d) => d[0] === 'polar',
135
- );
136
- return [+innerRadius, +outerRadius];
137
- }
138
-
139
47
  function sizeOf(coordinate: Coordinate): [number, number] {
140
48
  // @ts-ignore
141
49
  const { innerWidth, innerHeight } = coordinate.getOptions();
@@ -143,12 +51,9 @@ function sizeOf(coordinate: Coordinate): [number, number] {
143
51
  }
144
52
 
145
53
  function reverseTicks(ticks) {
146
- return ticks.map(({ value, text }) => ({ value: 1 - value, text }));
54
+ return ticks.map(({ value, ...rest }) => ({ value: 1 - value, ...rest }));
147
55
  }
148
56
 
149
- /**
150
- * @todo More position besides bottom and left.
151
- */
152
57
  function createFisheye(position, coordinate) {
153
58
  const { width, height } = coordinate.getOptions();
154
59
  return (tick) => {
@@ -186,6 +91,14 @@ function ticksOf(
186
91
  return tickMethod(min, max, tickCount);
187
92
  }
188
93
 
94
+ function isHorizontal(orientation: GCO) {
95
+ return orientation === 'horizontal' || orientation === 0;
96
+ }
97
+
98
+ function isVertical(orientation: GCO) {
99
+ return orientation === 'vertical' || orientation === -Math.PI / 2;
100
+ }
101
+
189
102
  function prettyNumber(n: number) {
190
103
  if (typeof n !== 'number') return n;
191
104
  return Math.abs(n) < 1e-15 ? n : parseFloat(n.toFixed(15));
@@ -215,8 +128,6 @@ function createInset(position, coordinate) {
215
128
 
216
129
  /**
217
130
  * Calc ticks based on scale and coordinate.
218
- * @todo Parallel coordinate.
219
- * @todo More position besides bottom and left.
220
131
  */
221
132
  function getTicks(
222
133
  scale: Scale,
@@ -225,7 +136,7 @@ function getTicks(
225
136
  defaultTickFormatter: AxisOptions['labelFormatter'],
226
137
  tickFilter: AxisOptions['tickFilter'],
227
138
  tickMethod: AxisOptions['tickMethod'],
228
- position: GuideComponentPosition,
139
+ position: GCP,
229
140
  coordinate: Coordinate,
230
141
  ) {
231
142
  if (tickCount !== undefined || tickMethod !== undefined) {
@@ -247,12 +158,13 @@ function getTicks(
247
158
  const tick = applyInset(scale.map(d) + offset);
248
159
  return {
249
160
  value: isTranspose(coordinate) && scale.getTicks?.() ? 1 - tick : tick,
250
- text: labelFormatter(d, i, array),
161
+ label: labelFormatter(d, i, array),
162
+ id: String(i),
251
163
  };
252
164
  });
253
165
  // @todo GUI should consider the overlap problem for the first
254
166
  // and label of arc axis.
255
- return isRadial(coordinate) && position === 'arcY'
167
+ return isRadial(coordinate) && position === 'center'
256
168
  ? reverseTicks(axisTicks)
257
169
  : axisTicks;
258
170
  }
@@ -262,105 +174,182 @@ function getTicks(
262
174
  const tick = applyFisheye(applyInset(scale.map(d) + offset));
263
175
  return {
264
176
  value: tick,
265
- text: `${labelFormatter(prettyNumber(d), i, array)}`,
177
+ label: `${labelFormatter(prettyNumber(d), i, array)}`,
178
+ id: String(i),
266
179
  };
267
180
  });
268
181
  }
269
182
 
270
- function getTickGridItem(
271
- tick: number,
272
- position: GuideComponentPosition,
273
- coordinate: Coordinate,
274
- startPos: Vector2,
275
- endPos: Vector2,
276
- ) {
277
- const [sx, sy] = startPos;
278
- const [ex, ey] = endPos;
183
+ function inferGridLength(position: GCP, coordinate: Coordinate) {
279
184
  const [width, height] = sizeOf(coordinate);
280
- let x1, x2, y1, y2;
281
- if (position === 'bottom' || position === 'top') {
282
- x1 = x2 = sx + (ex - sx) * tick;
283
- y1 = sy;
284
- y2 = position === 'bottom' ? sy - height : sy + height;
285
- } else {
286
- y1 = y2 = sy + (ey - sy) * tick;
287
- x1 = sx;
288
- x2 = position === 'left' ? sx + width : sx - width;
289
- }
290
- return [
291
- [x1, y1],
292
- [x2, y2],
293
- ];
185
+ if (position.includes('bottom') || position.includes('top')) return height;
186
+ return width;
294
187
  }
295
188
 
296
- function getArcGridItems(
297
- ticks: any[],
298
- center: [number, number],
299
- startAngle: number,
300
- endAngle: number,
189
+ function labelTransforms(autoHide?: boolean, autoRotate?: boolean) {
190
+ const transforms = [];
191
+ if (autoHide) transforms.push({ type: 'hide' });
192
+ if (autoRotate)
193
+ transforms.push({ type: 'rotate', optionalAngles: [0, 30, 45, 60, 90] });
194
+ return transforms;
195
+ }
196
+
197
+ function inferArcStyle(
198
+ position: GCP,
199
+ bbox: BBox,
301
200
  innerRadius: number,
302
201
  outerRadius: number,
303
202
  coordinate: Coordinate,
304
203
  ) {
305
- const [cx, cy] = center;
204
+ const { x, y, width, height } = bbox;
205
+ const center: [number, number] = [x + width / 2, y + height / 2];
206
+ const radius = Math.min(width, height) / 2;
207
+ const [startAngle, endAngle] = angleOf(coordinate);
208
+
306
209
  const [w, h] = sizeOf(coordinate);
307
210
  const r = Math.min(w, h) / 2;
308
- const ir = innerRadius * r;
309
- const or = outerRadius * r;
310
- return ticks.map(({ value }) => {
311
- const angle = (endAngle - startAngle) * value + startAngle;
312
- const dx = Math.cos((angle * Math.PI) / 180);
313
- const dy = Math.sin((angle * Math.PI) / 180);
211
+
212
+ const common = {
213
+ center,
214
+ radius,
215
+ angleRange: [startAngle, endAngle],
216
+ titleFillOpacity: 0,
217
+ titlePosition: 'inner',
218
+ showLine: false,
219
+ showTick: true,
220
+ gridLength: (outerRadius - innerRadius) * r,
221
+ };
222
+
223
+ if (position === 'inner') {
224
+ const [w, h] = sizeOf(coordinate);
225
+ const r = Math.min(w, h) / 2;
314
226
  return {
315
- points: [
316
- [cx + ir * dx, cy + ir * dy],
317
- [cx + or * dx, cy + or * dy],
318
- ],
227
+ ...common,
228
+ labelAlign: 'perpendicular',
229
+ labelDirection: 'positive',
230
+ labelSpacing: 4,
231
+ tickDirection: 'positive',
232
+ gridDirection: 'negative',
319
233
  };
320
- });
234
+ }
235
+
236
+ // arc outer
237
+ return {
238
+ ...common,
239
+ labelAlign: 'parallel',
240
+ labelDirection: 'negative',
241
+ labelSpacing: 8,
242
+ tickDirection: 'negative',
243
+ gridDirection: 'positive',
244
+ };
321
245
  }
322
246
 
323
- /**
324
- * @todo render grid in arcY positioned axis.
325
- */
326
- function getGridItems(
327
- ticks: any[],
328
- position: GuideComponentPosition,
329
- coordinate: any,
330
- startPos: Vector2,
331
- endPos: Vector2,
332
- ) {
333
- if (isTheta(coordinate) || isParallel(coordinate)) return [];
334
- return ticks.map((tick) => {
335
- const points = getTickGridItem(
336
- tick.value,
337
- position,
338
- coordinate,
339
- startPos,
340
- endPos,
341
- );
342
- const finalPoints = isPolar(coordinate) ? [points[0]] : points;
343
- return { points: finalPoints };
344
- });
247
+ function inferGrid(value: boolean, coordinate: Coordinate, scale: Scale) {
248
+ if (isTheta(coordinate) || isParallel(coordinate)) return false;
249
+ // Display axis grid for non-discrete values.
250
+ return value === undefined ? !!scale.getTicks : value;
345
251
  }
346
252
 
347
- function titleContent(field: string | string[]): string {
348
- return Array.isArray(field) ? field.join(', ') : `${field}`;
253
+ function inferAxisLinearOverrideStyle(
254
+ position: GCP,
255
+ orientation: GCO,
256
+ bbox: BBox,
257
+ coordinate: Coordinate,
258
+ ): {
259
+ startPos?: [number, number];
260
+ endPos?: [number, number];
261
+ showLine?: boolean;
262
+ [k: string]: any;
263
+ } {
264
+ const { x, y, width, height } = bbox;
265
+
266
+ if (position === 'bottom') {
267
+ return { startPos: [x, y], endPos: [x + width, y] };
268
+ }
269
+ if (position === 'left') {
270
+ return { startPos: [x + width, y], endPos: [x + width, y + height] };
271
+ }
272
+ if (position === 'right') {
273
+ return { endPos: [x, y + height], startPos: [x, y] };
274
+ }
275
+ if (position === 'top') {
276
+ return { startPos: [x, y + height], endPos: [x + width, y + height] };
277
+ }
278
+ // linear axis, maybe in parallel, polar, radial or radar systems.
279
+ if (position === 'center') {
280
+ // axisY
281
+ if (orientation === 'vertical') {
282
+ return {
283
+ startPos: [x + width, y],
284
+ endPos: [x + width, y + height],
285
+ showLine: true,
286
+ };
287
+ }
288
+ // axisX
289
+ else if (orientation === 'horizontal') {
290
+ return {
291
+ startPos: [x, y + height],
292
+ endPos: [x + width, y + height],
293
+ showLine: true,
294
+ };
295
+ }
296
+ // axis with rotate
297
+ else if (typeof orientation === 'number') {
298
+ const [cx, cy] = coordinate.getCenter();
299
+ const [innerRadius, outerRadius] = radiusOf(coordinate);
300
+ const [startAngle, endAngle] = angleOf(coordinate);
301
+ const r = height / 2;
302
+
303
+ const innerR = innerRadius * r;
304
+ const outerR = outerRadius * r;
305
+
306
+ const [actualCx, actualCy] = [cx + x, cy + y];
307
+ const [cos, sin] = [Math.cos(orientation), Math.sin(orientation)];
308
+
309
+ const startPos: [number, number] = [
310
+ actualCx + outerR * cos,
311
+ actualCy + outerR * sin,
312
+ ];
313
+ const endPos: [number, number] = [
314
+ actualCx + innerR * cos,
315
+ actualCy + innerR * sin,
316
+ ];
317
+
318
+ return {
319
+ startPos,
320
+ endPos,
321
+ gridClosed: endAngle - startAngle === 360,
322
+ gridCenter: [cx + x, y + cy],
323
+ gridControlAngles: new Array(3)
324
+ .fill(0)
325
+ .map((d, i, arr) => ((endAngle - startAngle) / (arr.length - 1)) * i),
326
+ };
327
+ }
328
+ }
329
+
330
+ // position is inner or outer for arc axis won't be here
331
+
332
+ return {};
349
333
  }
350
334
 
351
- const ArcAxis = (options) => {
335
+ const ArcAxisComponent: GCC<AxisOptions> = (options) => {
352
336
  const {
337
+ order,
338
+ size,
353
339
  position,
340
+ orientation,
354
341
  labelFormatter = (d) => `${d}`,
355
342
  tickFilter,
356
343
  tickCount,
357
344
  tickMethod,
345
+ title,
346
+ grid: showGrid = false,
347
+ important = {},
358
348
  ...rest
359
349
  } = options;
360
- return (scale, value, coordinate, theme) => {
361
- const { domain, bbox } = value;
362
- const { x, y, width, height } = bbox;
363
- const center: [number, number] = [x + width / 2, y + height / 2];
350
+ return ([scale], value, coordinate, theme) => {
351
+ const { bbox } = value;
352
+ const { domain } = scale.getOptions();
364
353
  const ticks = getTicks(
365
354
  scale,
366
355
  domain,
@@ -372,103 +361,107 @@ const ArcAxis = (options) => {
372
361
  coordinate,
373
362
  );
374
363
 
375
- const radius = Math.min(width, height) / 2;
376
- const [startAngle, endAngle] = angleOf(coordinate);
377
364
  const [innerRadius, outerRadius] = radiusOf(coordinate);
378
- const { grid: showGrid = false } = rest;
379
- const gridItems = showGrid
380
- ? getArcGridItems(
381
- ticks,
382
- center,
383
- startAngle,
384
- endAngle,
385
- innerRadius,
386
- outerRadius,
387
- coordinate,
388
- )
389
- : [];
390
- return new Arc({
391
- style: deepMix(
392
- {},
393
- {
394
- center,
395
- radius,
396
- startAngle,
397
- endAngle,
398
- ticks,
399
- verticalFactor: position === 'arc' ? 1 : -1,
400
- axisLine: {
401
- style: {
402
- lineWidth: 0,
403
- strokeOpacity: 0,
404
- ...subObject(rest, 'line'),
405
- },
406
- },
407
- grid: {
408
- items: gridItems,
409
- lineStyle: {
410
- stroke: '#1b1e23',
411
- strokeOpacity: 0.1,
412
- lineDash: [0, 0],
413
- ...subObject(rest, 'grid'),
414
- },
415
- },
416
- tickLine: {
417
- len: 4,
418
- style: {
419
- lineWidth: 1,
420
- stroke: '#BFBFBF',
421
- ...subObject(rest, 'tick'),
422
- },
423
- },
424
- label: {
425
- // @todo fix bug in @antv/gui related to tangential.
426
- align: position === 'arcInner' ? 'radial' : 'tangential',
427
- tickPadding: 2,
428
- style: subObject(rest, 'label'),
429
- },
430
- },
431
- ),
365
+
366
+ const defaultStyle = inferArcStyle(
367
+ position,
368
+ bbox,
369
+ innerRadius,
370
+ outerRadius,
371
+ coordinate,
372
+ );
373
+
374
+ const { axis: axisTheme } = theme;
375
+ return new AxisComponent({
376
+ style: deepMix({}, axisTheme, defaultStyle, {
377
+ type: 'arc',
378
+ data: ticks,
379
+ title: titleContent(title),
380
+ showGrid,
381
+ ...rest,
382
+ ...important,
383
+ }),
432
384
  });
433
385
  };
434
386
  };
435
387
 
436
- /***
437
- * Four parts:
438
- * - line
439
- * - tick
440
- * - label
441
- * - grid
442
- * - title
443
- */
444
- const LinearAxis: GCC<AxisOptions> = (options) => {
445
- const {
388
+ function inferThemeStyle(
389
+ scale: Scale,
390
+ coordinate: Coordinate,
391
+ theme: G2Theme,
392
+ direction,
393
+ position: GCP,
394
+ orientation: GCO,
395
+ ) {
396
+ const baseStyle = theme.axis;
397
+ let furtherStyle = theme.axisLinear;
398
+
399
+ if (['top', 'right', 'bottom', 'left'].includes(position)) {
400
+ furtherStyle = theme[`axis${capitalizeFirst(position)}`];
401
+ }
402
+ return Object.assign({}, baseStyle, furtherStyle);
403
+ }
404
+
405
+ function inferDefaultStyle(
406
+ scale: Scale,
407
+ coordinate: Coordinate,
408
+ theme: G2Theme,
409
+ direction,
410
+ position: GCP,
411
+ orientation: GCO,
412
+ ) {
413
+ const themeStyle = inferThemeStyle(
414
+ scale,
415
+ coordinate,
416
+ theme,
417
+ direction,
446
418
  position,
447
- title,
448
- labelFormatter = (d) => `${d}`,
419
+ orientation,
420
+ );
421
+
422
+ if (position === 'bottom') {
423
+ return {
424
+ ...themeStyle,
425
+ titlePosition: scale.getTicks ? 'right-bottom' : 'bottom',
426
+ titleTransformOrigin: 'center',
427
+ titleTransform: scale.getTicks ? 'translate(-100%, 0)' : undefined,
428
+ };
429
+ }
430
+ if (position === 'center') {
431
+ return {
432
+ ...themeStyle,
433
+ labelDirection: direction === 'right' ? 'negative' : 'positive',
434
+ labelTransform: direction === 'center' ? 'translate(50%, 0)' : '',
435
+ tickDirection: direction === 'right' ? 'negative' : 'positive',
436
+ labelSpacing: direction === 'center' ? 0 : 4,
437
+ titleSpacing: isVertical(orientation) ? 10 : 0,
438
+ tick: direction === 'center' ? false : undefined,
439
+ };
440
+ }
441
+ return themeStyle;
442
+ }
443
+
444
+ const LinearAxisComponent: GCC<AxisOptions> = (options) => {
445
+ const {
449
446
  direction = 'left',
447
+ important = {},
448
+ labelFormatter = (d) => `${d}`,
449
+ order,
450
+ orientation,
451
+ position,
452
+ size,
450
453
  tickCount,
451
454
  tickFilter,
452
455
  tickMethod,
453
- titleAnchor,
454
- ...rest
456
+ title,
457
+ transform,
458
+ ...userDefinitions
455
459
  } = options;
456
- return (scale, value, coordinate, theme) => {
457
- const { domain, bbox } = value;
458
- const {
459
- startPos,
460
- endPos,
461
- labelOffset,
462
- titlePosition,
463
- titlePadding,
464
- titleRotate,
465
- verticalFactor,
466
- titleOffsetY,
467
- labelAlign,
468
- axisLine,
469
- label = options.label === undefined ? true : options.label,
470
- tickLine = options.tickLine === undefined ? true : options.tickLine,
471
- } = inferPosition(position, direction, bbox, coordinate);
460
+
461
+ return ([scale], value, coordinate, theme) => {
462
+ const { bbox } = value;
463
+ const { domain } = scale.getOptions();
464
+
472
465
  const ticks = getTicks(
473
466
  scale,
474
467
  domain,
@@ -479,100 +472,82 @@ const LinearAxis: GCC<AxisOptions> = (options) => {
479
472
  position,
480
473
  coordinate,
481
474
  );
482
- const anchor =
483
- position === 'arcY' || scale.getTicks ? titlePosition : 'center';
484
- const [, cy] = coordinate.getCenter();
485
- // Display axis grid for non-discrete values.
486
- const { grid: showGrid = !!scale.getTicks } = rest;
487
- const gridItems = showGrid
488
- ? getGridItems(ticks, position, coordinate, startPos, endPos)
489
- : [];
490
- const axisLineStyle = subObject(rest, 'line');
491
- return new Linear({
492
- style: deepMix({
493
- startPos,
494
- endPos,
495
- verticalFactor,
496
- ticks,
497
- label: label
498
- ? {
499
- tickPadding: labelOffset,
500
- autoHide: false,
501
- autoRotate: true,
502
- ...subObject(rest, 'label'),
503
- style: {
504
- ...(labelAlign && { textAlign: labelAlign }),
505
- ...subObject(rest, 'label'),
506
- },
507
- }
508
- : null,
509
- axisLine:
510
- axisLine || Object.keys(axisLineStyle).length
511
- ? { stroke: '#BFBFBF', style: axisLineStyle }
512
- : null,
513
- grid: {
514
- items: gridItems,
515
- lineStyle: {
516
- stroke: '#1b1e23',
517
- strokeOpacity: 0.05,
518
- lineDash: [0, 0],
519
- ...subObject(rest, 'grid'),
520
- },
521
- ...(position === 'arcY' && {
522
- type: 'circle',
523
- center: [bbox.x, cy + bbox.y],
524
- closed: true,
525
- }),
526
- },
527
- tickLine: tickLine
528
- ? {
529
- len: 4,
530
- style: {
531
- lineWidth: 1,
532
- stroke: '#BFBFBF',
533
- ...subObject(rest, 'tick'),
534
- },
535
- }
536
- : null,
537
- ...(title && {
538
- title: {
539
- content: titleContent(title),
540
- // content: 'a',
541
- titleAnchor: titleAnchor || anchor,
542
- style: {
543
- fontWeight: 'bold',
544
- fillOpacity: 1,
545
- dy: titleOffsetY,
546
- textAnchor: anchor,
547
- ...subObject(rest, 'title'),
548
- },
549
- titlePadding,
550
- rotate: titleRotate,
551
- },
552
- }),
553
- }),
475
+
476
+ const defaultStyle = inferDefaultStyle(
477
+ scale,
478
+ coordinate,
479
+ theme,
480
+ direction,
481
+ position,
482
+ orientation,
483
+ );
484
+ const {
485
+ labelAutoRotate = true,
486
+ labelAutoHide = false,
487
+ label: showLabel = true,
488
+ tick: showTick = true,
489
+ line = false,
490
+ grid,
491
+ } = Object.assign({}, defaultStyle, userDefinitions);
492
+
493
+ const showGrid = inferGrid(grid, coordinate, scale);
494
+ const gridLength = inferGridLength(position, coordinate);
495
+
496
+ const { showLine = line, ...overrideStyle } = inferAxisLinearOverrideStyle(
497
+ position,
498
+ orientation,
499
+ bbox,
500
+ coordinate,
501
+ );
502
+ const axisStyle = {
503
+ ...defaultStyle,
504
+ type: 'linear' as const,
505
+ data: ticks,
506
+ title: titleContent(title),
507
+ showLabel,
508
+ labelTransforms: labelTransforms(labelAutoHide, labelAutoRotate),
509
+ showGrid,
510
+ showTick,
511
+ gridLength,
512
+ ...userDefinitions,
513
+ // Always showLine, make title could align the end of axis.
514
+ showLine: true,
515
+ ...(!showLine ? { lineOpacity: 0 } : null),
516
+ ...overrideStyle,
517
+ ...important,
518
+ };
519
+
520
+ return new AxisComponent({
521
+ className: 'axis',
522
+ style: axisStyle,
554
523
  });
555
524
  };
556
525
  };
557
526
 
558
- /**
559
- * Guide Component for position channel(e.g. x, y).
560
- * @todo Render Circular in polar coordinate.
561
- * @todo Custom style.
562
- */
563
- export const Axis: GCC<AxisOptions> = (options) => {
564
- const { position, labelFormatter: f = (d) => `${d}` } = options;
565
- const labelFormatter = typeof f === 'string' ? format(f) : f;
566
- const normalizedOptions = { ...options, labelFormatter };
567
- return (scale, value, coordinate, theme) => {
568
- return position === 'arc' || position === 'arcInner'
569
- ? ArcAxis(normalizedOptions)(scale, value, coordinate, theme)
570
- : LinearAxis(normalizedOptions)(scale, value, coordinate, theme);
527
+ const axisFactor: (
528
+ axis: typeof ArcAxisComponent | typeof LinearAxisComponent,
529
+ ) => GCC<AxisOptions> = (axis) => {
530
+ return (options) => {
531
+ const { labelFormatter: f = (d) => `${d}` } = options;
532
+ const labelFormatter = typeof f === 'string' ? format(f) : f;
533
+ const normalizedOptions = { ...options, labelFormatter };
534
+ return (...args) => axis(normalizedOptions)(...args);
571
535
  };
572
536
  };
573
537
 
574
- Axis.props = {
575
- defaultPosition: 'left',
538
+ export const LinearAxis = axisFactor(LinearAxisComponent);
539
+
540
+ export const ArcAxis = axisFactor(ArcAxisComponent);
541
+
542
+ LinearAxis.props = {
543
+ defaultPosition: 'center',
544
+ defaultSize: 45,
545
+ defaultOrder: 0,
546
+ };
547
+
548
+ ArcAxis.props = {
549
+ defaultPosition: 'outer',
550
+ defaultOrientation: 'vertical',
576
551
  defaultSize: 45,
577
552
  defaultOrder: 0,
578
553
  };