@antv/g2 5.0.0-rc.1 → 5.0.0

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 (648) hide show
  1. package/README.en-US.md +8 -5
  2. package/README.md +5 -6
  3. package/dist/g2-lite.min.js +4 -4
  4. package/dist/g2.min.js +4 -4
  5. package/esm/animation/fadeIn.js +1 -1
  6. package/esm/animation/fadeIn.js.map +1 -1
  7. package/esm/animation/fadeOut.js +1 -1
  8. package/esm/animation/fadeOut.js.map +1 -1
  9. package/esm/animation/morphing.js +1 -1
  10. package/esm/animation/morphing.js.map +1 -1
  11. package/esm/animation/scaleInX.js +1 -1
  12. package/esm/animation/scaleInX.js.map +1 -1
  13. package/esm/animation/scaleInY.js +1 -1
  14. package/esm/animation/scaleInY.js.map +1 -1
  15. package/esm/animation/scaleOutX.js +1 -1
  16. package/esm/animation/scaleOutX.js.map +1 -1
  17. package/esm/animation/scaleOutY.js +1 -1
  18. package/esm/animation/scaleOutY.js.map +1 -1
  19. package/esm/animation/waveIn.js +2 -2
  20. package/esm/animation/waveIn.js.map +1 -1
  21. package/esm/animation/zoomIn.js +1 -1
  22. package/esm/animation/zoomIn.js.map +1 -1
  23. package/esm/animation/zoomOut.js +1 -1
  24. package/esm/animation/zoomOut.js.map +1 -1
  25. package/esm/api/chart.d.ts +5 -2
  26. package/esm/api/chart.js +28 -20
  27. package/esm/api/chart.js.map +1 -1
  28. package/esm/api/composition/base.d.ts +8 -2
  29. package/esm/api/composition/base.js +29 -2
  30. package/esm/api/composition/base.js.map +1 -1
  31. package/esm/component/axis.js +46 -30
  32. package/esm/component/axis.js.map +1 -1
  33. package/esm/component/axisRadar.js +4 -3
  34. package/esm/component/axisRadar.js.map +1 -1
  35. package/esm/component/axisX.js.map +1 -1
  36. package/esm/component/legendCategory.js +63 -23
  37. package/esm/component/legendCategory.js.map +1 -1
  38. package/esm/component/legendContinuous.js +10 -8
  39. package/esm/component/legendContinuous.js.map +1 -1
  40. package/esm/component/legendContinuousBlockSize.js +1 -1
  41. package/esm/component/legendContinuousBlockSize.js.map +1 -1
  42. package/esm/component/legendContinuousSize.js +1 -1
  43. package/esm/component/legendContinuousSize.js.map +1 -1
  44. package/esm/component/scrollbar.d.ts +1 -1
  45. package/esm/component/scrollbar.js +4 -4
  46. package/esm/component/scrollbar.js.map +1 -1
  47. package/esm/component/scrollbarX.js +1 -1
  48. package/esm/component/scrollbarX.js.map +1 -1
  49. package/esm/component/scrollbarY.js +1 -1
  50. package/esm/component/scrollbarY.js.map +1 -1
  51. package/esm/component/slider.d.ts +1 -1
  52. package/esm/component/slider.js +4 -4
  53. package/esm/component/slider.js.map +1 -1
  54. package/esm/component/sliderX.js +1 -1
  55. package/esm/component/sliderX.js.map +1 -1
  56. package/esm/component/sliderY.js +1 -1
  57. package/esm/component/sliderY.js.map +1 -1
  58. package/esm/component/title.js +13 -2
  59. package/esm/component/title.js.map +1 -1
  60. package/esm/component/utils.d.ts +2 -1
  61. package/esm/component/utils.js +27 -3
  62. package/esm/component/utils.js.map +1 -1
  63. package/esm/coordinate/fisheye.js +1 -1
  64. package/esm/coordinate/fisheye.js.map +1 -1
  65. package/esm/geo/geoView.js +1 -1
  66. package/esm/geo/geoView.js.map +1 -1
  67. package/esm/index.d.ts +1 -0
  68. package/esm/index.js +1 -0
  69. package/esm/index.js.map +1 -1
  70. package/esm/interaction/brushFilter.js +1 -1
  71. package/esm/interaction/brushFilter.js.map +1 -1
  72. package/esm/interaction/brushHighlight.js +6 -3
  73. package/esm/interaction/brushHighlight.js.map +1 -1
  74. package/esm/interaction/elementHighlight.js +1 -1
  75. package/esm/interaction/elementHighlight.js.map +1 -1
  76. package/esm/interaction/event.js +20 -20
  77. package/esm/interaction/event.js.map +1 -1
  78. package/esm/interaction/fisheye.js +1 -1
  79. package/esm/interaction/fisheye.js.map +1 -1
  80. package/esm/interaction/legendFilter.d.ts +1 -4
  81. package/esm/interaction/legendFilter.js +52 -74
  82. package/esm/interaction/legendFilter.js.map +1 -1
  83. package/esm/interaction/sliderFilter.js +6 -6
  84. package/esm/interaction/sliderFilter.js.map +1 -1
  85. package/esm/interaction/tooltip.d.ts +2 -2
  86. package/esm/interaction/tooltip.js +40 -18
  87. package/esm/interaction/tooltip.js.map +1 -1
  88. package/esm/interaction/utils.js +7 -5
  89. package/esm/interaction/utils.js.map +1 -1
  90. package/esm/label-transform/overflowHide.js +3 -2
  91. package/esm/label-transform/overflowHide.js.map +1 -1
  92. package/esm/label-transform/overlapHide.js +3 -2
  93. package/esm/label-transform/overlapHide.js.map +1 -1
  94. package/esm/mark/boxplot.js +2 -2
  95. package/esm/mark/boxplot.js.map +1 -1
  96. package/esm/mark/gauge.js +2 -2
  97. package/esm/mark/gauge.js.map +1 -1
  98. package/esm/mark/sankey.js +2 -2
  99. package/esm/mark/sankey.js.map +1 -1
  100. package/esm/mark/utils.d.ts +2 -2
  101. package/esm/mark/utils.js +2 -2
  102. package/esm/mark/utils.js.map +1 -1
  103. package/esm/runtime/component.d.ts +3 -3
  104. package/esm/runtime/component.js +22 -7
  105. package/esm/runtime/component.js.map +1 -1
  106. package/esm/runtime/plot.js +58 -24
  107. package/esm/runtime/plot.js.map +1 -1
  108. package/esm/runtime/render.d.ts +2 -2
  109. package/esm/runtime/render.js +33 -10
  110. package/esm/runtime/render.js.map +1 -1
  111. package/esm/runtime/types/common.d.ts +12 -9
  112. package/esm/runtime/types/component.d.ts +13 -4
  113. package/esm/shape/area/area.js +1 -1
  114. package/esm/shape/area/area.js.map +1 -1
  115. package/esm/shape/area/curve.js +2 -1
  116. package/esm/shape/area/curve.js.map +1 -1
  117. package/esm/shape/area/hv.js +1 -1
  118. package/esm/shape/area/hv.js.map +1 -1
  119. package/esm/shape/area/hvh.js +1 -1
  120. package/esm/shape/area/hvh.js.map +1 -1
  121. package/esm/shape/area/smooth.js +1 -1
  122. package/esm/shape/area/smooth.js.map +1 -1
  123. package/esm/shape/area/vh.js +1 -1
  124. package/esm/shape/area/vh.js.map +1 -1
  125. package/esm/shape/box/box.js +1 -0
  126. package/esm/shape/box/box.js.map +1 -1
  127. package/esm/shape/connector/connector.d.ts +2 -2
  128. package/esm/shape/connector/connector.js +3 -2
  129. package/esm/shape/connector/connector.js.map +1 -1
  130. package/esm/shape/interval/color.js +18 -9
  131. package/esm/shape/interval/color.js.map +1 -1
  132. package/esm/shape/interval/funnel.js +1 -1
  133. package/esm/shape/interval/funnel.js.map +1 -1
  134. package/esm/shape/interval/hollow.js +1 -1
  135. package/esm/shape/interval/hollow.js.map +1 -1
  136. package/esm/shape/interval/pyramid.js +1 -1
  137. package/esm/shape/interval/pyramid.js.map +1 -1
  138. package/esm/shape/interval/rect.js +1 -1
  139. package/esm/shape/interval/rect.js.map +1 -1
  140. package/esm/shape/label/label.js +4 -2
  141. package/esm/shape/label/label.js.map +1 -1
  142. package/esm/shape/label/position/area.js +1 -1
  143. package/esm/shape/label/position/area.js.map +1 -1
  144. package/esm/shape/line/curve.js +3 -2
  145. package/esm/shape/line/curve.js.map +1 -1
  146. package/esm/shape/line/hv.js +1 -1
  147. package/esm/shape/line/hv.js.map +1 -1
  148. package/esm/shape/line/hvh.js +1 -1
  149. package/esm/shape/line/hvh.js.map +1 -1
  150. package/esm/shape/line/line.js +1 -1
  151. package/esm/shape/line/line.js.map +1 -1
  152. package/esm/shape/line/smooth.js +1 -1
  153. package/esm/shape/line/smooth.js.map +1 -1
  154. package/esm/shape/line/vh.js +1 -1
  155. package/esm/shape/line/vh.js.map +1 -1
  156. package/esm/shape/lineXY/line.js +1 -0
  157. package/esm/shape/lineXY/line.js.map +1 -1
  158. package/esm/shape/link/arc.js +1 -0
  159. package/esm/shape/link/arc.js.map +1 -1
  160. package/esm/shape/link/link.js +1 -0
  161. package/esm/shape/link/link.js.map +1 -1
  162. package/esm/shape/link/smooth.js +1 -0
  163. package/esm/shape/link/smooth.js.map +1 -1
  164. package/esm/shape/link/vhv.js +1 -0
  165. package/esm/shape/link/vhv.js.map +1 -1
  166. package/esm/shape/path/hollow.js +1 -0
  167. package/esm/shape/path/hollow.js.map +1 -1
  168. package/esm/shape/path/path.js +1 -0
  169. package/esm/shape/path/path.js.map +1 -1
  170. package/esm/shape/point/bowtie.js +1 -1
  171. package/esm/shape/point/bowtie.js.map +1 -1
  172. package/esm/shape/point/color.js +2 -2
  173. package/esm/shape/point/color.js.map +1 -1
  174. package/esm/shape/point/cross.js +1 -1
  175. package/esm/shape/point/cross.js.map +1 -1
  176. package/esm/shape/point/diamond.js +1 -1
  177. package/esm/shape/point/diamond.js.map +1 -1
  178. package/esm/shape/point/hexagon.js +1 -1
  179. package/esm/shape/point/hexagon.js.map +1 -1
  180. package/esm/shape/point/hollow.js +1 -1
  181. package/esm/shape/point/hollow.js.map +1 -1
  182. package/esm/shape/point/hollowBowtie.js +1 -1
  183. package/esm/shape/point/hollowBowtie.js.map +1 -1
  184. package/esm/shape/point/hollowDiamond.js +1 -1
  185. package/esm/shape/point/hollowDiamond.js.map +1 -1
  186. package/esm/shape/point/hollowHexagon.js +1 -1
  187. package/esm/shape/point/hollowHexagon.js.map +1 -1
  188. package/esm/shape/point/hollowSquare.js +1 -1
  189. package/esm/shape/point/hollowSquare.js.map +1 -1
  190. package/esm/shape/point/hollowTriangle.js +1 -1
  191. package/esm/shape/point/hollowTriangle.js.map +1 -1
  192. package/esm/shape/point/hollowTriangleDown.js +1 -1
  193. package/esm/shape/point/hollowTriangleDown.js.map +1 -1
  194. package/esm/shape/point/hyphen.js +1 -1
  195. package/esm/shape/point/hyphen.js.map +1 -1
  196. package/esm/shape/point/line.js +1 -1
  197. package/esm/shape/point/line.js.map +1 -1
  198. package/esm/shape/point/plus.js +1 -1
  199. package/esm/shape/point/plus.js.map +1 -1
  200. package/esm/shape/point/point.js +1 -1
  201. package/esm/shape/point/point.js.map +1 -1
  202. package/esm/shape/point/square.js +1 -1
  203. package/esm/shape/point/square.js.map +1 -1
  204. package/esm/shape/point/tick.js +1 -1
  205. package/esm/shape/point/tick.js.map +1 -1
  206. package/esm/shape/point/triangle.js +1 -1
  207. package/esm/shape/point/triangle.js.map +1 -1
  208. package/esm/shape/point/triangleDown.js +1 -1
  209. package/esm/shape/point/triangleDown.js.map +1 -1
  210. package/esm/shape/polygon/polygon.js +1 -0
  211. package/esm/shape/polygon/polygon.js.map +1 -1
  212. package/esm/shape/polygon/ribbon.js +1 -0
  213. package/esm/shape/polygon/ribbon.js.map +1 -1
  214. package/esm/shape/shape/shape.js +1 -0
  215. package/esm/shape/shape/shape.js.map +1 -1
  216. package/esm/shape/text/advance.js +3 -1
  217. package/esm/shape/text/advance.js.map +1 -1
  218. package/esm/shape/text/badge.js +1 -0
  219. package/esm/shape/text/badge.js.map +1 -1
  220. package/esm/shape/text/text.js +2 -1
  221. package/esm/shape/text/text.js.map +1 -1
  222. package/esm/shape/utils.d.ts +1 -16
  223. package/esm/shape/utils.js +2 -2
  224. package/esm/shape/utils.js.map +1 -1
  225. package/esm/shape/vector/vector.js +1 -0
  226. package/esm/shape/vector/vector.js.map +1 -1
  227. package/esm/spec/component.d.ts +10 -9
  228. package/esm/spec/coordinateTransform.d.ts +1 -1
  229. package/esm/spec/interaction.d.ts +2 -0
  230. package/esm/spec/scale.d.ts +3 -2
  231. package/esm/spec/theme.d.ts +8 -2
  232. package/esm/stdlib/index.js +2 -2
  233. package/esm/stdlib/index.js.map +1 -1
  234. package/esm/theme/academy.js +77 -78
  235. package/esm/theme/academy.js.map +1 -1
  236. package/esm/theme/classic.d.ts +6 -0
  237. package/esm/theme/{light.js → classic.js} +80 -90
  238. package/esm/theme/classic.js.map +1 -0
  239. package/esm/theme/classicDark.d.ts +6 -0
  240. package/esm/theme/{dark.js → classicDark.js} +78 -87
  241. package/esm/theme/classicDark.js.map +1 -0
  242. package/esm/theme/index.d.ts +2 -2
  243. package/esm/theme/index.js +2 -2
  244. package/esm/theme/index.js.map +1 -1
  245. package/esm/transform/filter.js +4 -1
  246. package/esm/transform/filter.js.map +1 -1
  247. package/esm/utils/event.d.ts +33 -14
  248. package/esm/utils/event.js +43 -16
  249. package/esm/utils/event.js.map +1 -1
  250. package/esm/utils/helper.js +2 -1
  251. package/esm/utils/helper.js.map +1 -1
  252. package/esm/utils/marker.d.ts +10 -0
  253. package/esm/utils/marker.js +250 -0
  254. package/esm/utils/marker.js.map +1 -0
  255. package/esm/utils/style.d.ts +5 -0
  256. package/esm/utils/style.js +23 -0
  257. package/esm/utils/style.js.map +1 -0
  258. package/lib/animation/fadeIn.js +1 -1
  259. package/lib/animation/fadeIn.js.map +1 -1
  260. package/lib/animation/fadeOut.js +1 -1
  261. package/lib/animation/fadeOut.js.map +1 -1
  262. package/lib/animation/morphing.js +1 -1
  263. package/lib/animation/morphing.js.map +1 -1
  264. package/lib/animation/scaleInX.js +1 -1
  265. package/lib/animation/scaleInX.js.map +1 -1
  266. package/lib/animation/scaleInY.js +1 -1
  267. package/lib/animation/scaleInY.js.map +1 -1
  268. package/lib/animation/scaleOutX.js +1 -1
  269. package/lib/animation/scaleOutX.js.map +1 -1
  270. package/lib/animation/scaleOutY.js +1 -1
  271. package/lib/animation/scaleOutY.js.map +1 -1
  272. package/lib/animation/waveIn.js +2 -2
  273. package/lib/animation/waveIn.js.map +1 -1
  274. package/lib/animation/zoomIn.js +1 -1
  275. package/lib/animation/zoomIn.js.map +1 -1
  276. package/lib/animation/zoomOut.js +1 -1
  277. package/lib/animation/zoomOut.js.map +1 -1
  278. package/lib/api/chart.d.ts +5 -2
  279. package/lib/api/chart.js +28 -20
  280. package/lib/api/chart.js.map +1 -1
  281. package/lib/api/composition/base.d.ts +8 -2
  282. package/lib/api/composition/base.js +29 -2
  283. package/lib/api/composition/base.js.map +1 -1
  284. package/lib/component/axis.js +45 -29
  285. package/lib/component/axis.js.map +1 -1
  286. package/lib/component/axisRadar.js +4 -3
  287. package/lib/component/axisRadar.js.map +1 -1
  288. package/lib/component/axisX.js.map +1 -1
  289. package/lib/component/legendCategory.js +62 -22
  290. package/lib/component/legendCategory.js.map +1 -1
  291. package/lib/component/legendContinuous.js +9 -7
  292. package/lib/component/legendContinuous.js.map +1 -1
  293. package/lib/component/legendContinuousBlockSize.js +1 -1
  294. package/lib/component/legendContinuousBlockSize.js.map +1 -1
  295. package/lib/component/legendContinuousSize.js +1 -1
  296. package/lib/component/legendContinuousSize.js.map +1 -1
  297. package/lib/component/scrollbar.d.ts +1 -1
  298. package/lib/component/scrollbar.js +4 -4
  299. package/lib/component/scrollbar.js.map +1 -1
  300. package/lib/component/scrollbarX.js +1 -1
  301. package/lib/component/scrollbarX.js.map +1 -1
  302. package/lib/component/scrollbarY.js +1 -1
  303. package/lib/component/scrollbarY.js.map +1 -1
  304. package/lib/component/slider.d.ts +1 -1
  305. package/lib/component/slider.js +4 -4
  306. package/lib/component/slider.js.map +1 -1
  307. package/lib/component/sliderX.js +1 -1
  308. package/lib/component/sliderX.js.map +1 -1
  309. package/lib/component/sliderY.js +1 -1
  310. package/lib/component/sliderY.js.map +1 -1
  311. package/lib/component/title.js +13 -2
  312. package/lib/component/title.js.map +1 -1
  313. package/lib/component/utils.d.ts +2 -1
  314. package/lib/component/utils.js +28 -3
  315. package/lib/component/utils.js.map +1 -1
  316. package/lib/coordinate/fisheye.js +1 -1
  317. package/lib/coordinate/fisheye.js.map +1 -1
  318. package/lib/geo/geoView.js +1 -1
  319. package/lib/geo/geoView.js.map +1 -1
  320. package/lib/index.d.ts +1 -0
  321. package/lib/index.js +3 -1
  322. package/lib/index.js.map +1 -1
  323. package/lib/interaction/brushFilter.js +1 -1
  324. package/lib/interaction/brushFilter.js.map +1 -1
  325. package/lib/interaction/brushHighlight.js +6 -3
  326. package/lib/interaction/brushHighlight.js.map +1 -1
  327. package/lib/interaction/event.js +20 -20
  328. package/lib/interaction/event.js.map +1 -1
  329. package/lib/interaction/fisheye.js +1 -1
  330. package/lib/interaction/fisheye.js.map +1 -1
  331. package/lib/interaction/legendFilter.d.ts +1 -4
  332. package/lib/interaction/legendFilter.js +52 -74
  333. package/lib/interaction/legendFilter.js.map +1 -1
  334. package/lib/interaction/sliderFilter.js +6 -6
  335. package/lib/interaction/sliderFilter.js.map +1 -1
  336. package/lib/interaction/tooltip.d.ts +2 -2
  337. package/lib/interaction/tooltip.js +40 -18
  338. package/lib/interaction/tooltip.js.map +1 -1
  339. package/lib/interaction/utils.js +7 -5
  340. package/lib/interaction/utils.js.map +1 -1
  341. package/lib/label-transform/overflowHide.js +3 -2
  342. package/lib/label-transform/overflowHide.js.map +1 -1
  343. package/lib/label-transform/overlapHide.js +3 -2
  344. package/lib/label-transform/overlapHide.js.map +1 -1
  345. package/lib/mark/boxplot.js +2 -2
  346. package/lib/mark/boxplot.js.map +1 -1
  347. package/lib/mark/gauge.js +2 -2
  348. package/lib/mark/gauge.js.map +1 -1
  349. package/lib/mark/sankey.js +2 -2
  350. package/lib/mark/sankey.js.map +1 -1
  351. package/lib/mark/utils.d.ts +2 -2
  352. package/lib/mark/utils.js +2 -2
  353. package/lib/mark/utils.js.map +1 -1
  354. package/lib/runtime/component.d.ts +3 -3
  355. package/lib/runtime/component.js +22 -7
  356. package/lib/runtime/component.js.map +1 -1
  357. package/lib/runtime/plot.js +57 -23
  358. package/lib/runtime/plot.js.map +1 -1
  359. package/lib/runtime/render.d.ts +2 -2
  360. package/lib/runtime/render.js +32 -9
  361. package/lib/runtime/render.js.map +1 -1
  362. package/lib/runtime/types/common.d.ts +12 -9
  363. package/lib/runtime/types/component.d.ts +13 -4
  364. package/lib/shape/area/area.js +1 -1
  365. package/lib/shape/area/area.js.map +1 -1
  366. package/lib/shape/area/curve.js +2 -1
  367. package/lib/shape/area/curve.js.map +1 -1
  368. package/lib/shape/area/hv.js +1 -1
  369. package/lib/shape/area/hv.js.map +1 -1
  370. package/lib/shape/area/hvh.js +1 -1
  371. package/lib/shape/area/hvh.js.map +1 -1
  372. package/lib/shape/area/smooth.js +1 -1
  373. package/lib/shape/area/smooth.js.map +1 -1
  374. package/lib/shape/area/vh.js +1 -1
  375. package/lib/shape/area/vh.js.map +1 -1
  376. package/lib/shape/box/box.js +1 -0
  377. package/lib/shape/box/box.js.map +1 -1
  378. package/lib/shape/connector/connector.d.ts +2 -2
  379. package/lib/shape/connector/connector.js +3 -2
  380. package/lib/shape/connector/connector.js.map +1 -1
  381. package/lib/shape/interval/color.js +18 -9
  382. package/lib/shape/interval/color.js.map +1 -1
  383. package/lib/shape/interval/funnel.js +1 -1
  384. package/lib/shape/interval/funnel.js.map +1 -1
  385. package/lib/shape/interval/hollow.js +1 -1
  386. package/lib/shape/interval/hollow.js.map +1 -1
  387. package/lib/shape/interval/pyramid.js +1 -1
  388. package/lib/shape/interval/pyramid.js.map +1 -1
  389. package/lib/shape/interval/rect.js +1 -1
  390. package/lib/shape/interval/rect.js.map +1 -1
  391. package/lib/shape/label/label.js +4 -2
  392. package/lib/shape/label/label.js.map +1 -1
  393. package/lib/shape/label/position/area.js +1 -1
  394. package/lib/shape/label/position/area.js.map +1 -1
  395. package/lib/shape/line/curve.js +3 -2
  396. package/lib/shape/line/curve.js.map +1 -1
  397. package/lib/shape/line/hv.js +1 -1
  398. package/lib/shape/line/hv.js.map +1 -1
  399. package/lib/shape/line/hvh.js +1 -1
  400. package/lib/shape/line/hvh.js.map +1 -1
  401. package/lib/shape/line/line.js +1 -1
  402. package/lib/shape/line/line.js.map +1 -1
  403. package/lib/shape/line/smooth.js +1 -1
  404. package/lib/shape/line/smooth.js.map +1 -1
  405. package/lib/shape/line/vh.js +1 -1
  406. package/lib/shape/line/vh.js.map +1 -1
  407. package/lib/shape/lineXY/line.js +1 -0
  408. package/lib/shape/lineXY/line.js.map +1 -1
  409. package/lib/shape/link/arc.js +1 -0
  410. package/lib/shape/link/arc.js.map +1 -1
  411. package/lib/shape/link/link.js +1 -0
  412. package/lib/shape/link/link.js.map +1 -1
  413. package/lib/shape/link/smooth.js +1 -0
  414. package/lib/shape/link/smooth.js.map +1 -1
  415. package/lib/shape/link/vhv.js +1 -0
  416. package/lib/shape/link/vhv.js.map +1 -1
  417. package/lib/shape/path/hollow.js +1 -0
  418. package/lib/shape/path/hollow.js.map +1 -1
  419. package/lib/shape/path/path.js +1 -0
  420. package/lib/shape/path/path.js.map +1 -1
  421. package/lib/shape/point/bowtie.js +1 -1
  422. package/lib/shape/point/bowtie.js.map +1 -1
  423. package/lib/shape/point/color.js +2 -25
  424. package/lib/shape/point/color.js.map +1 -1
  425. package/lib/shape/point/cross.js +1 -1
  426. package/lib/shape/point/cross.js.map +1 -1
  427. package/lib/shape/point/diamond.js +1 -1
  428. package/lib/shape/point/diamond.js.map +1 -1
  429. package/lib/shape/point/hexagon.js +1 -1
  430. package/lib/shape/point/hexagon.js.map +1 -1
  431. package/lib/shape/point/hollow.js +1 -1
  432. package/lib/shape/point/hollow.js.map +1 -1
  433. package/lib/shape/point/hollowBowtie.js +1 -1
  434. package/lib/shape/point/hollowBowtie.js.map +1 -1
  435. package/lib/shape/point/hollowDiamond.js +1 -1
  436. package/lib/shape/point/hollowDiamond.js.map +1 -1
  437. package/lib/shape/point/hollowHexagon.js +1 -1
  438. package/lib/shape/point/hollowHexagon.js.map +1 -1
  439. package/lib/shape/point/hollowSquare.js +1 -1
  440. package/lib/shape/point/hollowSquare.js.map +1 -1
  441. package/lib/shape/point/hollowTriangle.js +1 -1
  442. package/lib/shape/point/hollowTriangle.js.map +1 -1
  443. package/lib/shape/point/hollowTriangleDown.js +1 -1
  444. package/lib/shape/point/hollowTriangleDown.js.map +1 -1
  445. package/lib/shape/point/hyphen.js +1 -1
  446. package/lib/shape/point/hyphen.js.map +1 -1
  447. package/lib/shape/point/line.js +1 -1
  448. package/lib/shape/point/line.js.map +1 -1
  449. package/lib/shape/point/plus.js +1 -1
  450. package/lib/shape/point/plus.js.map +1 -1
  451. package/lib/shape/point/point.js +1 -1
  452. package/lib/shape/point/point.js.map +1 -1
  453. package/lib/shape/point/square.js +1 -1
  454. package/lib/shape/point/square.js.map +1 -1
  455. package/lib/shape/point/tick.js +1 -1
  456. package/lib/shape/point/tick.js.map +1 -1
  457. package/lib/shape/point/triangle.js +1 -1
  458. package/lib/shape/point/triangle.js.map +1 -1
  459. package/lib/shape/point/triangleDown.js +1 -1
  460. package/lib/shape/point/triangleDown.js.map +1 -1
  461. package/lib/shape/polygon/polygon.js +1 -0
  462. package/lib/shape/polygon/polygon.js.map +1 -1
  463. package/lib/shape/polygon/ribbon.js +1 -0
  464. package/lib/shape/polygon/ribbon.js.map +1 -1
  465. package/lib/shape/shape/shape.js +1 -0
  466. package/lib/shape/shape/shape.js.map +1 -1
  467. package/lib/shape/text/advance.js +3 -1
  468. package/lib/shape/text/advance.js.map +1 -1
  469. package/lib/shape/text/badge.js +1 -0
  470. package/lib/shape/text/badge.js.map +1 -1
  471. package/lib/shape/text/text.js +2 -1
  472. package/lib/shape/text/text.js.map +1 -1
  473. package/lib/shape/utils.d.ts +1 -16
  474. package/lib/shape/utils.js +2 -2
  475. package/lib/shape/utils.js.map +1 -1
  476. package/lib/shape/vector/vector.js +1 -0
  477. package/lib/shape/vector/vector.js.map +1 -1
  478. package/lib/spec/component.d.ts +10 -9
  479. package/lib/spec/coordinateTransform.d.ts +1 -1
  480. package/lib/spec/interaction.d.ts +2 -0
  481. package/lib/spec/scale.d.ts +3 -2
  482. package/lib/spec/theme.d.ts +8 -2
  483. package/lib/stdlib/index.js +1 -1
  484. package/lib/stdlib/index.js.map +1 -1
  485. package/lib/theme/academy.js +77 -78
  486. package/lib/theme/academy.js.map +1 -1
  487. package/lib/theme/classic.d.ts +6 -0
  488. package/lib/theme/{light.js → classic.js} +82 -92
  489. package/lib/theme/classic.js.map +1 -0
  490. package/lib/theme/classicDark.d.ts +6 -0
  491. package/lib/theme/{dark.js → classicDark.js} +80 -89
  492. package/lib/theme/classicDark.js.map +1 -0
  493. package/lib/theme/index.d.ts +2 -2
  494. package/lib/theme/index.js +5 -5
  495. package/lib/theme/index.js.map +1 -1
  496. package/lib/transform/filter.js +4 -1
  497. package/lib/transform/filter.js.map +1 -1
  498. package/lib/utils/event.d.ts +33 -14
  499. package/lib/utils/event.js +44 -17
  500. package/lib/utils/event.js.map +1 -1
  501. package/lib/utils/helper.js +2 -1
  502. package/lib/utils/helper.js.map +1 -1
  503. package/lib/utils/marker.d.ts +10 -0
  504. package/lib/utils/marker.js +256 -0
  505. package/lib/utils/marker.js.map +1 -0
  506. package/lib/utils/style.d.ts +5 -0
  507. package/lib/utils/style.js +30 -0
  508. package/lib/utils/style.js.map +1 -0
  509. package/package.json +3 -3
  510. package/src/.DS_Store +0 -0
  511. package/src/animation/fadeIn.ts +1 -1
  512. package/src/animation/fadeOut.ts +1 -1
  513. package/src/animation/morphing.ts +1 -1
  514. package/src/animation/scaleInX.ts +4 -4
  515. package/src/animation/scaleInY.ts +4 -4
  516. package/src/animation/scaleOutX.ts +4 -4
  517. package/src/animation/scaleOutY.ts +4 -4
  518. package/src/animation/waveIn.ts +4 -4
  519. package/src/animation/zoomIn.ts +4 -4
  520. package/src/animation/zoomOut.ts +4 -4
  521. package/src/api/chart.ts +30 -23
  522. package/src/api/composition/base.ts +30 -4
  523. package/src/component/axis.ts +83 -66
  524. package/src/component/axisRadar.ts +4 -3
  525. package/src/component/axisX.ts +0 -1
  526. package/src/component/legendCategory.ts +69 -56
  527. package/src/component/legendContinuous.ts +31 -23
  528. package/src/component/legendContinuousBlockSize.ts +1 -5
  529. package/src/component/legendContinuousSize.ts +1 -1
  530. package/src/component/scrollbar.ts +6 -6
  531. package/src/component/scrollbarX.ts +1 -1
  532. package/src/component/scrollbarY.ts +1 -1
  533. package/src/component/slider.ts +7 -8
  534. package/src/component/sliderX.ts +1 -1
  535. package/src/component/sliderY.ts +1 -1
  536. package/src/component/title.ts +3 -5
  537. package/src/component/utils.ts +27 -3
  538. package/src/coordinate/fisheye.ts +2 -2
  539. package/src/data/.DS_Store +0 -0
  540. package/src/geo/geoView.ts +1 -1
  541. package/src/index.ts +1 -0
  542. package/src/interaction/brushFilter.ts +2 -2
  543. package/src/interaction/brushHighlight.ts +8 -3
  544. package/src/interaction/elementHighlight.ts +6 -6
  545. package/src/interaction/event.ts +30 -20
  546. package/src/interaction/fisheye.ts +1 -1
  547. package/src/interaction/legendFilter.ts +54 -70
  548. package/src/interaction/sliderFilter.ts +6 -6
  549. package/src/interaction/tooltip.ts +51 -21
  550. package/src/interaction/utils.ts +6 -3
  551. package/src/label-transform/overflowHide.ts +3 -3
  552. package/src/label-transform/overlapHide.ts +3 -2
  553. package/src/mark/boxplot.ts +2 -2
  554. package/src/mark/gauge.ts +2 -1
  555. package/src/mark/sankey.ts +2 -1
  556. package/src/mark/utils.ts +2 -4
  557. package/src/runtime/component.ts +34 -14
  558. package/src/runtime/plot.ts +72 -20
  559. package/src/runtime/render.ts +37 -9
  560. package/src/runtime/types/common.ts +13 -10
  561. package/src/runtime/types/component.ts +16 -8
  562. package/src/shape/.DS_Store +0 -0
  563. package/src/shape/area/area.ts +1 -0
  564. package/src/shape/area/curve.ts +2 -1
  565. package/src/shape/area/hv.ts +1 -0
  566. package/src/shape/area/hvh.ts +1 -0
  567. package/src/shape/area/smooth.ts +1 -0
  568. package/src/shape/area/vh.ts +1 -0
  569. package/src/shape/box/box.ts +1 -0
  570. package/src/shape/connector/connector.ts +6 -4
  571. package/src/shape/interval/color.ts +19 -4
  572. package/src/shape/interval/funnel.ts +1 -0
  573. package/src/shape/interval/hollow.ts +1 -0
  574. package/src/shape/interval/pyramid.ts +1 -0
  575. package/src/shape/interval/rect.ts +1 -0
  576. package/src/shape/label/label.ts +4 -2
  577. package/src/shape/label/position/area.ts +1 -1
  578. package/src/shape/line/curve.ts +3 -2
  579. package/src/shape/line/hv.ts +1 -0
  580. package/src/shape/line/hvh.ts +1 -0
  581. package/src/shape/line/line.ts +1 -0
  582. package/src/shape/line/smooth.ts +1 -0
  583. package/src/shape/line/vh.ts +1 -0
  584. package/src/shape/lineXY/line.ts +1 -0
  585. package/src/shape/link/arc.ts +1 -0
  586. package/src/shape/link/link.ts +1 -0
  587. package/src/shape/link/smooth.ts +1 -0
  588. package/src/shape/link/vhv.ts +1 -0
  589. package/src/shape/path/hollow.ts +1 -0
  590. package/src/shape/path/path.ts +1 -0
  591. package/src/shape/point/bowtie.ts +1 -0
  592. package/src/shape/point/color.ts +4 -4
  593. package/src/shape/point/cross.ts +1 -0
  594. package/src/shape/point/diamond.ts +1 -0
  595. package/src/shape/point/hexagon.ts +1 -0
  596. package/src/shape/point/hollow.ts +1 -0
  597. package/src/shape/point/hollowBowtie.ts +1 -0
  598. package/src/shape/point/hollowDiamond.ts +1 -0
  599. package/src/shape/point/hollowHexagon.ts +1 -0
  600. package/src/shape/point/hollowSquare.ts +1 -0
  601. package/src/shape/point/hollowTriangle.ts +1 -0
  602. package/src/shape/point/hollowTriangleDown.ts +1 -0
  603. package/src/shape/point/hyphen.ts +1 -0
  604. package/src/shape/point/line.ts +1 -0
  605. package/src/shape/point/plus.ts +1 -0
  606. package/src/shape/point/point.ts +1 -0
  607. package/src/shape/point/square.ts +1 -0
  608. package/src/shape/point/tick.ts +1 -0
  609. package/src/shape/point/triangle.ts +1 -0
  610. package/src/shape/point/triangleDown.ts +1 -0
  611. package/src/shape/polygon/polygon.ts +1 -0
  612. package/src/shape/polygon/ribbon.ts +1 -0
  613. package/src/shape/shape/shape.ts +1 -0
  614. package/src/shape/text/advance.ts +3 -2
  615. package/src/shape/text/badge.ts +1 -0
  616. package/src/shape/text/text.ts +2 -1
  617. package/src/shape/utils.ts +4 -22
  618. package/src/shape/vector/vector.ts +1 -0
  619. package/src/spec/component.ts +10 -9
  620. package/src/spec/coordinateTransform.ts +1 -1
  621. package/src/spec/interaction.ts +3 -0
  622. package/src/spec/scale.ts +3 -2
  623. package/src/spec/theme.ts +22 -2
  624. package/src/stdlib/index.ts +3 -3
  625. package/src/theme/academy.ts +77 -78
  626. package/src/theme/{light.ts → classic.ts} +80 -90
  627. package/src/theme/{dark.ts → classicDark.ts} +78 -88
  628. package/src/theme/index.ts +2 -2
  629. package/src/transform/filter.ts +4 -1
  630. package/src/utils/event.ts +47 -15
  631. package/src/utils/helper.ts +2 -1
  632. package/src/utils/marker.ts +293 -0
  633. package/src/utils/style.ts +34 -0
  634. package/esm/shape/point/symbol.d.ts +0 -49
  635. package/esm/shape/point/symbol.js +0 -143
  636. package/esm/shape/point/symbol.js.map +0 -1
  637. package/esm/theme/dark.d.ts +0 -6
  638. package/esm/theme/dark.js.map +0 -1
  639. package/esm/theme/light.d.ts +0 -6
  640. package/esm/theme/light.js.map +0 -1
  641. package/lib/shape/point/symbol.d.ts +0 -49
  642. package/lib/shape/point/symbol.js +0 -158
  643. package/lib/shape/point/symbol.js.map +0 -1
  644. package/lib/theme/dark.d.ts +0 -6
  645. package/lib/theme/dark.js.map +0 -1
  646. package/lib/theme/light.d.ts +0 -6
  647. package/lib/theme/light.js.map +0 -1
  648. package/src/shape/point/symbol.ts +0 -154
@@ -1,6 +1,6 @@
1
1
  import { ThemeComponent as TC, Theme } from '../runtime';
2
2
 
3
- export type DarkOptions = Theme;
3
+ export type ClassicDarkOptions = Theme;
4
4
 
5
5
  const COLORS = {
6
6
  BLACK: '#fff',
@@ -13,7 +13,7 @@ const BACKGROUND_COLOR = '#141414';
13
13
  /**
14
14
  * Dark theme.
15
15
  */
16
- export const Dark: TC<DarkOptions> = (options) => {
16
+ export const ClassicDark: TC<ClassicDarkOptions> = (options) => {
17
17
  const DEFAULT_COLOR = '#5B8FF9';
18
18
  const defaultOptions: Theme = {
19
19
  defaultColor: DEFAULT_COLOR,
@@ -220,139 +220,131 @@ export const Dark: TC<DarkOptions> = (options) => {
220
220
  disabled: {},
221
221
  },
222
222
  axis: {
223
- // axis title
224
- titleFill: COLORS.BLACK,
225
- titleFillOpacity: 0.65,
226
- titleFontSize: 12,
227
- titleFontWeight: 'normal',
228
- titleSpacing: 12,
229
- // axis line
230
- lineStroke: COLORS.BLACK,
231
- lineStrokeOpacity: 0.45,
232
- lineLineWidth: 0.5,
233
- lineArrow: null,
234
- // axis tick line
235
- tickStroke: COLORS.BLACK,
236
- tickStrokeOpacity: 0.25,
237
- tickLineWidth: 1,
238
- tickLength: 4,
239
- // axis label
223
+ arrow: false,
224
+ gridLineDash: [0, 0],
225
+ gridLineWidth: 0.5,
226
+ gridStroke: COLORS.BLACK,
227
+ gridStrokeOpacity: 0.05,
228
+ labelAlign: 'horizontal',
240
229
  labelFill: COLORS.BLACK,
241
230
  labelFillOpacity: 0.65,
242
231
  labelFontSize: 12,
243
232
  labelFontWeight: 'lighter',
244
233
  labelSpacing: 8, // spacing between label and it's tick
245
- labelAlign: 'horizontal',
246
- // axis grid
247
- gridStroke: COLORS.BLACK,
248
- gridStrokeOpacity: 0.05,
249
- gridLineWidth: 0.5,
250
- gridLineDash: [0, 0],
234
+ lineLineWidth: 0.5,
235
+ lineStroke: COLORS.BLACK,
236
+ lineStrokeOpacity: 0.45,
237
+ tickLength: 4,
238
+ tickLineWidth: 1,
239
+ tickStroke: COLORS.BLACK,
240
+ tickStrokeOpacity: 0.25,
241
+ titleFill: COLORS.BLACK,
242
+ titleFillOpacity: 0.65,
243
+ titleFontSize: 12,
244
+ titleFontWeight: 'normal',
245
+ titleSpacing: 12,
251
246
  titleTransformOrigin: 'center',
252
247
  },
253
248
  axisTop: {
249
+ gridDirection: 'positive',
250
+ labelDirection: 'negative',
251
+ labelSpacing: 8,
252
+ tickDirection: 'negative',
254
253
  titlePosition: 'top',
255
254
  titleSpacing: 0,
256
255
  titleTextBaseline: 'middle',
257
- labelSpacing: 8,
258
- labelDirection: 'negative',
259
- tickDirection: 'negative',
260
- gridDirection: 'positive',
261
256
  },
262
257
  axisBottom: {
258
+ gridDirection: 'negative',
259
+ labelDirection: 'positive',
260
+ labelSpacing: 12,
261
+ tickDirection: 'positive',
263
262
  titlePosition: 'bottom',
264
263
  titleSpacing: 10,
265
264
  titleTextBaseline: 'bottom',
266
- labelSpacing: 12,
267
- labelDirection: 'positive',
268
- tickDirection: 'positive',
269
- gridDirection: 'negative',
270
265
  },
271
266
  axisLeft: {
272
- titleTextBaseline: 'middle',
273
- titleSpacing: 10,
274
- titlePosition: 'left',
275
- titleTransformOrigin: 'center',
276
- titleTransform: `translate(50%, 0) rotate(-90)`,
277
- labelSpacing: 4,
278
- labelDirection: 'positive',
267
+ gridDirection: 'negative',
279
268
  labelAutoRotate: false,
269
+ labelDirection: 'positive',
270
+ labelSpacing: 4,
280
271
  tickDirection: 'positive',
281
- gridDirection: 'negative',
272
+ titlePosition: 'left',
273
+ titleSpacing: 10,
274
+ titleTextBaseline: 'middle',
275
+ titleTransform: `translate(50%, 0) rotate(-90)`,
276
+ titleTransformOrigin: 'center',
282
277
  },
283
278
  axisRight: {
284
- titleTextBaseline: 'top',
285
- titleSpacing: 0,
286
- titlePosition: 'right',
287
- titleTransformOrigin: 'center',
288
- titleTransform: `translate(-50%, 0) rotate(-90)`,
289
- labelSpacing: 4,
279
+ gridDirection: 'positive',
290
280
  labelDirection: 'negative',
281
+ labelSpacing: 4,
291
282
  tickDirection: 'negative',
292
- gridDirection: 'positive',
283
+ titlePosition: 'right',
284
+ titleSpacing: 0,
285
+ titleTextBaseline: 'top',
286
+ titleTransform: `translate(-50%, 0) rotate(-90)`,
287
+ titleTransformOrigin: 'center',
293
288
  },
294
289
  axisLinear: {
295
- titlePosition: 'top',
296
- titleTextBaseline: 'bottom',
297
- gridDirection: 'negative',
290
+ girdClosed: true,
298
291
  gridConnect: 'arc',
292
+ gridDirection: 'negative',
299
293
  gridType: 'surround',
300
- girdClosed: true,
294
+ titlePosition: 'top',
295
+ titleTextBaseline: 'bottom',
301
296
  },
302
297
  axisRadar: {
303
- titlePosition: 'start',
304
- showTick: false,
305
- showLabel: false,
306
- gridType: 'surround',
307
298
  girdClosed: true,
308
299
  gridStrokeOpacity: 0.3,
300
+ gridType: 'surround',
301
+ label: false,
302
+ tick: false,
303
+ titlePosition: 'start',
309
304
  },
310
305
  legend: {
311
- padding: 8,
312
- showTitle: false,
313
- titleFill: COLORS.BLACK,
314
- titleFillOpacity: 0.45,
315
- titleFontSize: 12,
316
- titleFontWeight: 'normal',
317
- titleSpacing: 4,
318
- // legend marker
319
- // itemMarkerFill: DEFAULT_COLOR,
320
- itemMarkerFillOpacity: 1,
321
- itemMarkerSize: 8,
322
- itemSpacing: [5, 8],
306
+ backgroundFill: 'transparent',
307
+ itemBackgroundFill: 'transparent',
323
308
  itemLabelFill: COLORS.BLACK,
324
309
  itemLabelFillOpacity: 0.65,
325
310
  itemLabelFontSize: 12,
326
311
  itemLabelFontWeight: 'normal',
312
+ itemMarkerFillOpacity: 1,
313
+ itemMarkerSize: 8,
314
+ itemSpacing: [5, 8],
327
315
  itemValueFill: COLORS.BLACK,
328
316
  itemValueFillOpacity: 0.65,
329
317
  itemValueFontSize: 12,
330
318
  itemValueFontWeight: 'normal',
331
- itemBackgroundFill: 'transparent',
332
319
  navButtonFill: COLORS.BLACK,
333
320
  navButtonFillOpacity: 0.45,
334
321
  navPageNumFill: COLORS.BLACK,
335
322
  navPageNumFillOpacity: 0.45,
336
323
  navPageNumFontSize: 12,
337
- // others
338
- backgroundFill: 'transparent',
324
+ padding: 8,
325
+ title: false,
326
+ titleFill: COLORS.BLACK,
327
+ titleFillOpacity: 0.45,
328
+ titleFontSize: 12,
329
+ titleFontWeight: 'normal',
330
+ titleSpacing: 4,
339
331
  },
340
332
  continuousLegend: {
341
- labelFill: COLORS.BLACK,
342
- labelFillOpacity: 0.45,
343
- labelFontSize: 12,
344
- labelFontWeight: 'normal',
345
- handleWidth: 10,
346
333
  handleHeight: 12,
347
- handleMarkerFill: COLORS.BLACK,
348
- handleMarkerFillOpacity: 0.6,
349
- handleMarkerStroke: COLORS.BLACK,
350
- handleMarkerStrokeOpacity: 0.25,
351
- handleMarkerLineWidth: 1,
352
334
  handleLabelFill: COLORS.BLACK,
353
335
  handleLabelFillOpacity: 0.45,
354
336
  handleLabelFontSize: 12,
355
337
  handleLabelFontWeight: 'normal',
338
+ handleMarkerFill: COLORS.BLACK,
339
+ handleMarkerFillOpacity: 0.6,
340
+ handleMarkerLineWidth: 1,
341
+ handleMarkerStroke: COLORS.BLACK,
342
+ handleMarkerStrokeOpacity: 0.25,
343
+ handleWidth: 10,
344
+ labelFill: COLORS.BLACK,
345
+ labelFillOpacity: 0.45,
346
+ labelFontSize: 12,
347
+ labelFontWeight: 'normal',
356
348
  // [todo] legend rail
357
349
  },
358
350
  label: {
@@ -360,7 +352,7 @@ export const Dark: TC<DarkOptions> = (options) => {
360
352
  fillOpacity: 0.65,
361
353
  fontSize: 12,
362
354
  fontWeight: 'normal',
363
- stroke: null,
355
+ stroke: undefined,
364
356
  offset: 12,
365
357
  connectorStroke: COLORS.BLACK,
366
358
  connectorStrokeOpacity: 0.45,
@@ -374,13 +366,13 @@ export const Dark: TC<DarkOptions> = (options) => {
374
366
  fontSize: 12,
375
367
  fillOpacity: 0.85,
376
368
  fontWeight: 'normal',
377
- stroke: null,
369
+ stroke: undefined,
378
370
  offset: 0,
379
371
  },
380
372
  slider: {
381
373
  trackSize: 16,
382
- backgroundFill: COLORS.STROKE,
383
- backgroundFillOpacity: 1,
374
+ trackFill: COLORS.STROKE,
375
+ trackFillOpacity: 1,
384
376
  selectionFill: DEFAULT_COLOR,
385
377
  selectionFillOpacity: 0.15,
386
378
  handleIconSize: 10,
@@ -412,6 +404,4 @@ export const Dark: TC<DarkOptions> = (options) => {
412
404
  return Object.assign({}, defaultOptions, options);
413
405
  };
414
406
 
415
- Dark.props = {};
416
-
417
- Dark.props = {};
407
+ ClassicDark.props = {};
@@ -1,3 +1,3 @@
1
- export { Light } from './light';
2
- export { Dark } from './dark';
1
+ export { Classic } from './classic';
2
+ export { ClassicDark } from './classicDark';
3
3
  export { Academy } from './academy';
@@ -41,7 +41,10 @@ export const Filter: TC<FilterOptions> = (options = {}) => {
41
41
  },
42
42
  ];
43
43
  });
44
- return [I, deepMix({}, mark, { encode: Object.fromEntries(newEncodes) })];
44
+ return [
45
+ newIndex,
46
+ deepMix({}, mark, { encode: Object.fromEntries(newEncodes) }),
47
+ ];
45
48
  };
46
49
  };
47
50
 
@@ -1,20 +1,52 @@
1
- // Life cycle stage.
2
- export enum CHART_LIFE_CIRCLE {
3
- BEFORE_RENDER = 'beforerender',
4
- AFTER_RENDER = 'afterrender',
1
+ // to prevent users from tampering with internal values.
2
+ const ChartEvent = new Proxy(
3
+ {
4
+ BEFORE_RENDER: 'beforerender',
5
+ AFTER_RENDER: 'afterrender',
5
6
 
6
- BEFORE_PAINT = 'beforepaint',
7
- AFTER_PAINT = 'afterpaint',
7
+ BEFORE_PAINT: 'beforepaint',
8
+ AFTER_PAINT: 'afterpaint',
8
9
 
9
- BEFORE_CHANGE_DATA = 'beforechangedata',
10
- AFTER_CHANGE_DATA = 'afterchangedata',
10
+ BEFORE_CHANGE_DATA: 'beforechangedata',
11
+ AFTER_CHANGE_DATA: 'afterchangedata',
11
12
 
12
- BEFORE_CLEAR = 'beforeclear',
13
- AFTER_CLEAR = 'afterclear',
13
+ BEFORE_CLEAR: 'beforeclear',
14
+ AFTER_CLEAR: 'afterclear',
14
15
 
15
- BEFORE_DESTROY = 'beforedestroy',
16
- AFTER_DESTROY = 'afterdestroy',
16
+ BEFORE_DESTROY: 'beforedestroy',
17
+ AFTER_DESTROY: 'afterdestroy',
17
18
 
18
- BEFORE_CHANGE_SIZE = 'beforechangesize',
19
- AFTER_CHANGE_SIZE = 'afterchangesize',
20
- }
19
+ BEFORE_CHANGE_SIZE: 'beforechangesize',
20
+ AFTER_CHANGE_SIZE: 'afterchangesize',
21
+
22
+ POINTER_TAP: 'pointertap',
23
+ POINTER_DOWN: 'pointerdown',
24
+ POINTER_UP: 'pointerup',
25
+ POINTER_OVER: 'pointerover',
26
+ POINTER_OUT: 'pointerout',
27
+ POINTER_MOVE: 'pointermove',
28
+ POINTER_ENTER: 'pointerenter',
29
+ POINTER_LEAVE: 'pointerleave',
30
+ POINTER_UPOUTSIDE: 'pointerupoutside',
31
+ DRAG_START: 'dragstart',
32
+ DRAG: 'drag',
33
+ DRAG_END: 'dragend',
34
+ DRAG_ENTER: 'dragenter',
35
+ DRAG_LEAVE: 'dragleave',
36
+ DRAG_OVER: 'dragover',
37
+ DROP: 'DROP',
38
+ CLICK: 'click',
39
+ DBLCLICK: 'dblclick',
40
+ } as const,
41
+ {
42
+ get(target, prop) {
43
+ if (prop in target) return target[prop];
44
+ return undefined;
45
+ },
46
+ set() {
47
+ return true;
48
+ },
49
+ },
50
+ );
51
+
52
+ export { ChartEvent };
@@ -71,7 +71,8 @@ export function useMemo<T = unknown, U = unknown>(
71
71
 
72
72
  export function appendTransform(node: DisplayObject, transform: any) {
73
73
  const { transform: preTransform } = node.style;
74
- const prefix = preTransform === 'none' ? '' : preTransform;
74
+ const unset = (d) => d === 'none' || d === undefined;
75
+ const prefix = unset(preTransform) ? '' : preTransform;
75
76
  node.style.transform = `${prefix} ${transform}`.trimStart();
76
77
  }
77
78
 
@@ -0,0 +1,293 @@
1
+ import { Path } from '@antv/g';
2
+ import type { PathArray } from '@antv/util';
3
+
4
+ export interface SymbolFactor {
5
+ (x: number, y: number, r: number): PathArray;
6
+ style?: string[];
7
+ }
8
+
9
+ const point: SymbolFactor = (x, y, r) => {
10
+ return [
11
+ ['M', x - r, y],
12
+ ['A', r, r, 0, 1, 0, x + r, y],
13
+ ['A', r, r, 0, 1, 0, x - r, y],
14
+ ['Z'],
15
+ ];
16
+ };
17
+ point.style = ['fill'];
18
+
19
+ const hollowPoint = point.bind(undefined);
20
+ hollowPoint.style = ['stroke', 'lineWidth'];
21
+
22
+ const square: SymbolFactor = (x, y, r) => {
23
+ return [
24
+ ['M', x - r, y - r],
25
+ ['L', x + r, y - r],
26
+ ['L', x + r, y + r],
27
+ ['L', x - r, y + r],
28
+ ['Z'],
29
+ ];
30
+ };
31
+ square.style = ['fill'];
32
+
33
+ const rect = square.bind(undefined);
34
+ rect.style = ['fill'];
35
+
36
+ const hollowSquare = square.bind(undefined);
37
+ hollowSquare.style = ['stroke', 'lineWidth'];
38
+
39
+ const diamond: SymbolFactor = (x, y, r) => {
40
+ const hr = r * 0.618;
41
+ return [
42
+ ['M', x - hr, y],
43
+ ['L', x, y - r],
44
+ ['L', x + hr, y],
45
+ ['L', x, y + r],
46
+ ['Z'],
47
+ ];
48
+ };
49
+ diamond.style = ['fill'];
50
+
51
+ const hollowDiamond = diamond.bind(undefined);
52
+ hollowDiamond.style = ['stroke', 'lineWidth'];
53
+
54
+ const triangle: SymbolFactor = (x, y, r) => {
55
+ const diffY = r * Math.sin((1 / 3) * Math.PI);
56
+ return [
57
+ ['M', x - r, y + diffY],
58
+ ['L', x, y - diffY],
59
+ ['L', x + r, y + diffY],
60
+ ['Z'],
61
+ ];
62
+ };
63
+ triangle.style = ['fill'];
64
+
65
+ const hollowTriangle = triangle.bind(undefined);
66
+ hollowTriangle.style = ['stroke', 'lineWidth'];
67
+
68
+ const triangleDown: SymbolFactor = (x, y, r) => {
69
+ const diffY = r * Math.sin((1 / 3) * Math.PI);
70
+ return [
71
+ ['M', x - r, y - diffY],
72
+ ['L', x + r, y - diffY],
73
+ ['L', x, y + diffY],
74
+ ['Z'],
75
+ ];
76
+ };
77
+ triangleDown.style = ['fill'];
78
+
79
+ const hollowTriangleDown = triangleDown.bind(undefined);
80
+ hollowTriangleDown.style = ['stroke', 'lineWidth'];
81
+
82
+ const hexagon: SymbolFactor = (x, y, r) => {
83
+ const diffX = (r / 2) * Math.sqrt(3);
84
+ return [
85
+ ['M', x, y - r],
86
+ ['L', x + diffX, y - r / 2],
87
+ ['L', x + diffX, y + r / 2],
88
+ ['L', x, y + r],
89
+ ['L', x - diffX, y + r / 2],
90
+ ['L', x - diffX, y - r / 2],
91
+ ['Z'],
92
+ ];
93
+ };
94
+ hexagon.style = ['fill'];
95
+
96
+ const hollowHexagon = hexagon.bind(undefined);
97
+ hollowHexagon.style = ['stroke', 'lineWidth'];
98
+
99
+ const bowtie: SymbolFactor = (x, y, r) => {
100
+ const diffY = r - 1.5;
101
+ return [
102
+ ['M', x - r, y - diffY],
103
+ ['L', x + r, y + diffY],
104
+ ['L', x + r, y - diffY],
105
+ ['L', x - r, y + diffY],
106
+ ['Z'],
107
+ ];
108
+ };
109
+ bowtie.style = ['fill'];
110
+
111
+ const hollowBowtie = bowtie.bind(undefined);
112
+ hollowBowtie.style = ['stroke', 'lineWidth'];
113
+
114
+ const line: SymbolFactor = (x, y, r) => {
115
+ return [
116
+ ['M', x, y + r],
117
+ ['L', x, y - r],
118
+ ];
119
+ };
120
+ line.style = ['stroke', 'lineWidth'];
121
+
122
+ const cross: SymbolFactor = (x, y, r) => {
123
+ return [
124
+ ['M', x - r, y - r],
125
+ ['L', x + r, y + r],
126
+ ['M', x + r, y - r],
127
+ ['L', x - r, y + r],
128
+ ];
129
+ };
130
+ cross.style = ['stroke', 'lineWidth'];
131
+
132
+ const tick: SymbolFactor = (x, y, r) => {
133
+ return [
134
+ ['M', x - r / 2, y - r],
135
+ ['L', x + r / 2, y - r],
136
+ ['M', x, y - r],
137
+ ['L', x, y + r],
138
+ ['M', x - r / 2, y + r],
139
+ ['L', x + r / 2, y + r],
140
+ ];
141
+ };
142
+ tick.style = ['stroke', 'lineWidth'];
143
+
144
+ const plus: SymbolFactor = (x, y, r) => {
145
+ return [
146
+ ['M', x - r, y],
147
+ ['L', x + r, y],
148
+ ['M', x, y - r],
149
+ ['L', x, y + r],
150
+ ];
151
+ };
152
+ plus.style = ['stroke', 'lineWidth'];
153
+
154
+ const hyphen: SymbolFactor = (x, y, r) => {
155
+ return [
156
+ ['M', x - r, y],
157
+ ['L', x + r, y],
158
+ ];
159
+ };
160
+ hyphen.style = ['stroke', 'lineWidth'];
161
+
162
+ const dot: SymbolFactor = (x, y, r) => {
163
+ return [
164
+ ['M', x - r, y],
165
+ ['L', x + r, y],
166
+ ];
167
+ };
168
+ dot.style = ['stroke', 'lineWidth'];
169
+
170
+ const dash = dot.bind(undefined);
171
+ dash.style = ['stroke', 'lineWidth'];
172
+
173
+ const smooth: SymbolFactor = (x, y, r) => {
174
+ return [
175
+ ['M', x - r, y],
176
+ ['A', r / 2, r / 2, 0, 1, 1, x, y],
177
+ ['A', r / 2, r / 2, 0, 1, 0, x + r, y],
178
+ ];
179
+ };
180
+ smooth.style = ['stroke', 'lineWidth'];
181
+
182
+ const hv: SymbolFactor = (x, y, r) => {
183
+ return [
184
+ ['M', x - r - 1, y - 2.5],
185
+ ['L', x, y - 2.5],
186
+ ['L', x, y + 2.5],
187
+ ['L', x + r + 1, y + 2.5],
188
+ ];
189
+ };
190
+ hv.style = ['stroke', 'lineWidth'];
191
+
192
+ const vh: SymbolFactor = (x, y, r) => {
193
+ return [
194
+ ['M', x - r - 1, y + 2.5],
195
+ ['L', x, y + 2.5],
196
+ ['L', x, y - 2.5],
197
+ ['L', x + r + 1, y - 2.5],
198
+ ];
199
+ };
200
+ vh.style = ['stroke', 'lineWidth'];
201
+
202
+ const hvh: SymbolFactor = (x, y, r) => {
203
+ return [
204
+ ['M', x - (r + 1), y + 2.5],
205
+ ['L', x - r / 2, y + 2.5],
206
+ ['L', x - r / 2, y - 2.5],
207
+ ['L', x + r / 2, y - 2.5],
208
+ ['L', x + r / 2, y + 2.5],
209
+ ['L', x + r + 1, y + 2.5],
210
+ ];
211
+ };
212
+ hvh.style = ['stroke', 'lineWidth'];
213
+
214
+ const vhv: SymbolFactor = (x: number, y: number, r: number) => {
215
+ return [
216
+ ['M', x - 5, y + 2.5],
217
+ ['L', x - 5, y],
218
+ ['L', x, y],
219
+ ['L', x, y - 3],
220
+ ['L', x, y + 3],
221
+ ['L', x + 6.5, y + 3],
222
+ ];
223
+ };
224
+ vhv.style = ['stroke', 'lineWidth'];
225
+
226
+ export const Symbols = new Map<string, SymbolFactor>([
227
+ ['bowtie', bowtie],
228
+ ['cross', cross],
229
+ ['dash', dash],
230
+ ['diamond', diamond],
231
+ ['dot', dot],
232
+ ['hexagon', hexagon],
233
+ ['hollowBowtie', hollowBowtie],
234
+ ['hollowDiamond', hollowDiamond],
235
+ ['hollowHexagon', hollowHexagon],
236
+ ['hollowPoint', hollowPoint],
237
+ ['hollowSquare', hollowSquare],
238
+ ['hollowTriangle', hollowTriangle],
239
+ ['hollowTriangleDown', hollowTriangleDown],
240
+ ['hv', hv],
241
+ ['hvh', hvh],
242
+ ['hyphen', hyphen],
243
+ ['line', line],
244
+ ['plus', plus],
245
+ ['point', point],
246
+ ['rect', rect],
247
+ ['smooth', smooth],
248
+ ['square', square],
249
+ ['tick', tick],
250
+ ['triangleDown', triangleDown],
251
+ ['triangle', triangle],
252
+ ['vh', vh],
253
+ ['vhv', vhv],
254
+ ]);
255
+
256
+ export function useMarker(
257
+ type: string,
258
+ {
259
+ d,
260
+ fill,
261
+ strokeWidth,
262
+ path,
263
+ stroke,
264
+ lineWidth,
265
+ color,
266
+ ...style
267
+ }: Record<string, any>,
268
+ ) {
269
+ const symbol = Symbols.get(type) || Symbols.get('point');
270
+ return (...args: Parameters<SymbolFactor>) => {
271
+ const path = new Path({
272
+ style: {
273
+ ...style,
274
+ path: symbol(...args),
275
+ stroke: symbol.style.includes('stroke') ? color || stroke : '',
276
+ fill: symbol.style.includes('fill') ? color || fill : '',
277
+ lineWidth: symbol.style.includes('lineWidth')
278
+ ? lineWidth || lineWidth || 2
279
+ : 0,
280
+ },
281
+ });
282
+
283
+ return path;
284
+ };
285
+ }
286
+
287
+ export function registerSymbol(type: string, marker: SymbolFactor) {
288
+ Symbols.set(type, marker);
289
+ }
290
+
291
+ export function unregisterSymbol(type: string) {
292
+ Symbols.delete(type);
293
+ }
@@ -0,0 +1,34 @@
1
+ import type { DisplayObject, BaseStyleProps } from '@antv/g';
2
+
3
+ const defaultStyle: BaseStyleProps = {
4
+ visibility: 'visible',
5
+ opacity: 1,
6
+ fillOpacity: 1,
7
+ strokeOpacity: 1,
8
+ };
9
+
10
+ export function getStyle(element: DisplayObject, key: string) {
11
+ return element.style[key] ?? defaultStyle[key];
12
+ }
13
+
14
+ export function setStyle(
15
+ element: DisplayObject,
16
+ key: string,
17
+ value: any,
18
+ recursive: boolean,
19
+ ) {
20
+ element.style[key] = value;
21
+ if (recursive) {
22
+ element.children.forEach((child: DisplayObject) =>
23
+ setStyle(child, key, value, recursive),
24
+ );
25
+ }
26
+ }
27
+
28
+ export function hide(element: DisplayObject) {
29
+ setStyle(element, 'visibility', 'hidden', true);
30
+ }
31
+
32
+ export function show(element: DisplayObject) {
33
+ setStyle(element, 'visibility', 'visible', true);
34
+ }