@antv/g2 5.4.2 → 5.4.4

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 (560) hide show
  1. package/dist/g2.lite.min.js +10 -10
  2. package/dist/g2.min.js +10 -10
  3. package/esm/animation/morphing.js.map +1 -1
  4. package/esm/animation/scaleInY.js.map +1 -1
  5. package/esm/animation/utils.js.map +1 -1
  6. package/esm/animation/waveIn.js.map +1 -1
  7. package/esm/api/composition.js.map +1 -1
  8. package/esm/api/define.js.map +1 -1
  9. package/esm/api/mark.js.map +1 -1
  10. package/esm/api/node.js.map +1 -1
  11. package/esm/api/runtime.js +2 -2
  12. package/esm/api/runtime.js.map +1 -1
  13. package/esm/api/utils.js.map +1 -1
  14. package/esm/component/axis.js +3 -2
  15. package/esm/component/axis.js.map +1 -1
  16. package/esm/component/axisRadar.js.map +1 -1
  17. package/esm/component/constant.d.ts +8 -0
  18. package/esm/component/constant.js +10 -0
  19. package/esm/component/constant.js.map +1 -1
  20. package/esm/component/legendCategory.js +11 -2
  21. package/esm/component/legendCategory.js.map +1 -1
  22. package/esm/component/legendContinuous.js +8 -3
  23. package/esm/component/legendContinuous.js.map +1 -1
  24. package/esm/component/scrollbar.js +2 -1
  25. package/esm/component/scrollbar.js.map +1 -1
  26. package/esm/component/slider.js.map +1 -1
  27. package/esm/component/title.js.map +1 -1
  28. package/esm/component/utils.d.ts +1 -1
  29. package/esm/component/utils.js.map +1 -1
  30. package/esm/composition/facetRect.js.map +1 -1
  31. package/esm/composition/geoView.js.map +1 -1
  32. package/esm/composition/repeatMatrix.js.map +1 -1
  33. package/esm/composition/spaceFlex.js.map +1 -1
  34. package/esm/composition/timingKeyframe.js.map +1 -1
  35. package/esm/composition/utils.js.map +1 -1
  36. package/esm/data/cluster.d.ts +1 -1
  37. package/esm/data/ema.js.map +1 -1
  38. package/esm/data/fetch.js.map +1 -1
  39. package/esm/data/pick.js.map +1 -1
  40. package/esm/data/sankey.js.map +1 -1
  41. package/esm/data/sortBy.js.map +1 -1
  42. package/esm/data/utils/arc/arc.d.ts +6 -6
  43. package/esm/data/utils/arc/arc.js.map +1 -1
  44. package/esm/data/utils/d3-cloud/index.js.map +1 -1
  45. package/esm/data/utils/d3-sankey/sankey.d.ts +5 -5
  46. package/esm/data/utils/d3-sankey/sankey.js.map +1 -1
  47. package/esm/data/utils/fields.js.map +1 -1
  48. package/esm/data/utils/memo.js +1 -1
  49. package/esm/data/utils/memo.js.map +1 -1
  50. package/esm/data/utils/venn/circleintersection.js.map +1 -1
  51. package/esm/data/utils/venn/diagram.js.map +1 -1
  52. package/esm/data/utils/venn/fmin/bisect.js.map +1 -1
  53. package/esm/data/utils/venn/fmin/blas1.js.map +1 -1
  54. package/esm/data/utils/venn/fmin/conjugateGradient.js.map +1 -1
  55. package/esm/data/utils/venn/fmin/gradientDescent.js.map +1 -1
  56. package/esm/data/utils/venn/fmin/linesearch.js.map +1 -1
  57. package/esm/data/utils/venn/fmin/nelderMead.js.map +1 -1
  58. package/esm/data/utils/venn/layout.js.map +1 -1
  59. package/esm/data/wordCloud.js.map +1 -1
  60. package/esm/index.d.ts +2 -0
  61. package/esm/interaction/adaptiveFilter.js.map +1 -1
  62. package/esm/interaction/brushAxisHighlight.js +1 -1
  63. package/esm/interaction/brushAxisHighlight.js.map +1 -1
  64. package/esm/interaction/brushFilter.js.map +1 -1
  65. package/esm/interaction/brushHighlight.js.map +1 -1
  66. package/esm/interaction/chartIndex.js.map +1 -1
  67. package/esm/interaction/elementHighlight.js.map +1 -1
  68. package/esm/interaction/elementHoverScale.d.ts +23 -0
  69. package/esm/interaction/elementHoverScale.js +222 -0
  70. package/esm/interaction/elementHoverScale.js.map +1 -0
  71. package/esm/interaction/elementPointMove.js.map +1 -1
  72. package/esm/interaction/elementSelect.js.map +1 -1
  73. package/esm/interaction/event.js +10 -2
  74. package/esm/interaction/event.js.map +1 -1
  75. package/esm/interaction/fisheye.js.map +1 -1
  76. package/esm/interaction/index.d.ts +1 -0
  77. package/esm/interaction/index.js +1 -0
  78. package/esm/interaction/index.js.map +1 -1
  79. package/esm/interaction/legendFilter.d.ts +2 -0
  80. package/esm/interaction/legendFilter.js +237 -22
  81. package/esm/interaction/legendFilter.js.map +1 -1
  82. package/esm/interaction/legendHighlight.js.map +1 -1
  83. package/esm/interaction/poptip.js.map +1 -1
  84. package/esm/interaction/scrollbarFilter.js +2 -1
  85. package/esm/interaction/scrollbarFilter.js.map +1 -1
  86. package/esm/interaction/sliderFilter.js.map +1 -1
  87. package/esm/interaction/sliderWheel.js.map +1 -1
  88. package/esm/interaction/tooltip.d.ts +2 -2
  89. package/esm/interaction/tooltip.js +16 -9
  90. package/esm/interaction/tooltip.js.map +1 -1
  91. package/esm/interaction/treemapDrillDown.js.map +1 -1
  92. package/esm/interaction/utils.d.ts +2 -2
  93. package/esm/interaction/utils.js.map +1 -1
  94. package/esm/label-transform/exceedAdjust.js.map +1 -1
  95. package/esm/label-transform/overflowStroke.js.map +1 -1
  96. package/esm/label-transform/overlapDodgeY.js.map +1 -1
  97. package/esm/lib/core.d.ts +2 -1
  98. package/esm/lib/core.js +2 -1
  99. package/esm/lib/core.js.map +1 -1
  100. package/esm/lib/std.d.ts +1 -0
  101. package/esm/mark/area.js.map +1 -1
  102. package/esm/mark/box.js +3 -3
  103. package/esm/mark/box.js.map +1 -1
  104. package/esm/mark/boxplot.js.map +1 -1
  105. package/esm/mark/chord.js +2 -2
  106. package/esm/mark/chord.js.map +1 -1
  107. package/esm/mark/density.js +1 -1
  108. package/esm/mark/density.js.map +1 -1
  109. package/esm/mark/gauge.js.map +1 -1
  110. package/esm/mark/line.js.map +1 -1
  111. package/esm/mark/polygon.js.map +1 -1
  112. package/esm/mark/sankey.js.map +1 -1
  113. package/esm/mark/utils.js.map +1 -1
  114. package/esm/runtime/component.js.map +1 -1
  115. package/esm/runtime/coordinate.js.map +1 -1
  116. package/esm/runtime/layout.js.map +1 -1
  117. package/esm/runtime/mark.js +2 -2
  118. package/esm/runtime/mark.js.map +1 -1
  119. package/esm/runtime/option-preprocess/axis-breaks.js.map +1 -1
  120. package/esm/runtime/option-preprocess/index.js.map +1 -1
  121. package/esm/runtime/option-preprocess/style.js.map +1 -1
  122. package/esm/runtime/plot.js +2 -1
  123. package/esm/runtime/plot.js.map +1 -1
  124. package/esm/runtime/render.js.map +1 -1
  125. package/esm/runtime/scale.js.map +1 -1
  126. package/esm/runtime/transform.js.map +1 -1
  127. package/esm/shape/area/curve.js.map +1 -1
  128. package/esm/shape/axis-breaks/axis-breaks.js.map +1 -1
  129. package/esm/shape/box/box.js.map +1 -1
  130. package/esm/shape/box/violin.js.map +1 -1
  131. package/esm/shape/connector/connector.js.map +1 -1
  132. package/esm/shape/heatmap/renderer/gradient.js.map +1 -1
  133. package/esm/shape/heatmap/renderer/index.js.map +1 -1
  134. package/esm/shape/interval/color.js.map +1 -1
  135. package/esm/shape/interval/funnel.js.map +1 -1
  136. package/esm/shape/interval/pyramid.js.map +1 -1
  137. package/esm/shape/label/label.js.map +1 -1
  138. package/esm/shape/label/position/default.js.map +1 -1
  139. package/esm/shape/label/position/outside.js.map +1 -1
  140. package/esm/shape/label/position/utils.js.map +1 -1
  141. package/esm/shape/line/curve.js.map +1 -1
  142. package/esm/shape/line/trail.js.map +1 -1
  143. package/esm/shape/link/arc.js.map +1 -1
  144. package/esm/shape/link/vhv.js.map +1 -1
  145. package/esm/shape/liquid/liquid.js.map +1 -1
  146. package/esm/shape/liquid/wave.js.map +1 -1
  147. package/esm/shape/point/color.js.map +1 -1
  148. package/esm/shape/polygon/polygon.js.map +1 -1
  149. package/esm/shape/polygon/ribbon.js.map +1 -1
  150. package/esm/shape/text/advance.d.ts +1 -1
  151. package/esm/shape/text/advance.js.map +1 -1
  152. package/esm/shape/utils.js.map +1 -1
  153. package/esm/shape/vector/vector.js.map +1 -1
  154. package/esm/spec/interaction.d.ts +15 -2
  155. package/esm/theme/create.d.ts +1 -1
  156. package/esm/theme/create.js +3 -2
  157. package/esm/theme/create.js.map +1 -1
  158. package/esm/theme/dark.js +5 -4
  159. package/esm/theme/dark.js.map +1 -1
  160. package/esm/transform/diffY.js.map +1 -1
  161. package/esm/transform/dodgeX.js.map +1 -1
  162. package/esm/transform/filter.js.map +1 -1
  163. package/esm/transform/maybeDefaultX.js.map +1 -1
  164. package/esm/transform/maybeDefaultY.js.map +1 -1
  165. package/esm/transform/maybeTitle.js.map +1 -1
  166. package/esm/transform/maybeVisualPosition.js +1 -1
  167. package/esm/transform/maybeVisualPosition.js.map +1 -1
  168. package/esm/transform/normalizeY.js.map +1 -1
  169. package/esm/transform/pack.js.map +1 -1
  170. package/esm/transform/sample.js.map +1 -1
  171. package/esm/transform/sort.js.map +1 -1
  172. package/esm/transform/stackEnter.js.map +1 -1
  173. package/esm/transform/stackY.js +2 -2
  174. package/esm/transform/stackY.js.map +1 -1
  175. package/esm/transform/symmetryY.js.map +1 -1
  176. package/esm/transform/utils/helper.js.map +1 -1
  177. package/esm/transform/utils/lttb.js.map +1 -1
  178. package/esm/transform/utils/order.js.map +1 -1
  179. package/esm/utils/angle.js.map +1 -1
  180. package/esm/utils/array.js.map +1 -1
  181. package/esm/utils/coordinate.d.ts +0 -1
  182. package/esm/utils/coordinate.js.map +1 -1
  183. package/esm/utils/expr.js.map +1 -1
  184. package/esm/utils/helper.js +6 -6
  185. package/esm/utils/helper.js.map +1 -1
  186. package/esm/utils/marker.d.ts +1 -1
  187. package/esm/utils/scale.js.map +1 -1
  188. package/esm/utils/selection.js.map +1 -1
  189. package/esm/utils/style.js.map +1 -1
  190. package/esm/utils/traverse-elements.js.map +1 -1
  191. package/esm/utils/treeDataTransform.js.map +1 -1
  192. package/esm/utils/vector.js.map +1 -1
  193. package/lib/animation/morphing.js.map +1 -1
  194. package/lib/animation/scaleInY.js.map +1 -1
  195. package/lib/animation/utils.js +2 -2
  196. package/lib/animation/utils.js.map +1 -1
  197. package/lib/animation/waveIn.js.map +1 -1
  198. package/lib/api/composition.js +2 -2
  199. package/lib/api/composition.js.map +1 -1
  200. package/lib/api/define.js +2 -3
  201. package/lib/api/define.js.map +1 -1
  202. package/lib/api/extend.js +1 -2
  203. package/lib/api/extend.js.map +1 -1
  204. package/lib/api/library.js +2 -2
  205. package/lib/api/library.js.map +1 -1
  206. package/lib/api/mark.js +2 -2
  207. package/lib/api/mark.js.map +1 -1
  208. package/lib/api/node.js.map +1 -1
  209. package/lib/api/runtime.js +2 -2
  210. package/lib/api/runtime.js.map +1 -1
  211. package/lib/api/utils.js +9 -9
  212. package/lib/api/utils.js.map +1 -1
  213. package/lib/component/axis.js +5 -4
  214. package/lib/component/axis.js.map +1 -1
  215. package/lib/component/axisRadar.js.map +1 -1
  216. package/lib/component/axisX.js +2 -2
  217. package/lib/component/axisX.js.map +1 -1
  218. package/lib/component/constant.d.ts +8 -0
  219. package/lib/component/constant.js +12 -1
  220. package/lib/component/constant.js.map +1 -1
  221. package/lib/component/legendCategory.js +11 -2
  222. package/lib/component/legendCategory.js.map +1 -1
  223. package/lib/component/legendContinuous.js +8 -3
  224. package/lib/component/legendContinuous.js.map +1 -1
  225. package/lib/component/scrollbar.js +2 -1
  226. package/lib/component/scrollbar.js.map +1 -1
  227. package/lib/component/slider.js.map +1 -1
  228. package/lib/component/title.js.map +1 -1
  229. package/lib/component/utils.d.ts +1 -1
  230. package/lib/component/utils.js +11 -11
  231. package/lib/component/utils.js.map +1 -1
  232. package/lib/composition/facetRect.js +2 -2
  233. package/lib/composition/facetRect.js.map +1 -1
  234. package/lib/composition/geoView.js +17 -7
  235. package/lib/composition/geoView.js.map +1 -1
  236. package/lib/composition/repeatMatrix.js.map +1 -1
  237. package/lib/composition/spaceFlex.js.map +1 -1
  238. package/lib/composition/timingKeyframe.js.map +1 -1
  239. package/lib/composition/utils.js +4 -5
  240. package/lib/composition/utils.js.map +1 -1
  241. package/lib/data/cluster.d.ts +1 -1
  242. package/lib/data/ema.js +2 -2
  243. package/lib/data/ema.js.map +1 -1
  244. package/lib/data/fetch.js.map +1 -1
  245. package/lib/data/filter.js +2 -2
  246. package/lib/data/filter.js.map +1 -1
  247. package/lib/data/fold.js +2 -2
  248. package/lib/data/fold.js.map +1 -1
  249. package/lib/data/kde.js +2 -2
  250. package/lib/data/kde.js.map +1 -1
  251. package/lib/data/pick.js.map +1 -1
  252. package/lib/data/rename.js +2 -2
  253. package/lib/data/rename.js.map +1 -1
  254. package/lib/data/sankey.js.map +1 -1
  255. package/lib/data/sort.js +2 -2
  256. package/lib/data/sort.js.map +1 -1
  257. package/lib/data/sortBy.js.map +1 -1
  258. package/lib/data/utils/arc/arc.d.ts +6 -6
  259. package/lib/data/utils/arc/arc.js +18 -9
  260. package/lib/data/utils/arc/arc.js.map +1 -1
  261. package/lib/data/utils/arc/sort.js +4 -5
  262. package/lib/data/utils/arc/sort.js.map +1 -1
  263. package/lib/data/utils/d3-cloud/index.js +1 -2
  264. package/lib/data/utils/d3-cloud/index.js.map +1 -1
  265. package/lib/data/utils/d3-sankey/align.js +4 -5
  266. package/lib/data/utils/d3-sankey/align.js.map +1 -1
  267. package/lib/data/utils/d3-sankey/constant.js +1 -2
  268. package/lib/data/utils/d3-sankey/constant.js.map +1 -1
  269. package/lib/data/utils/d3-sankey/sankey.d.ts +5 -5
  270. package/lib/data/utils/d3-sankey/sankey.js +1 -2
  271. package/lib/data/utils/d3-sankey/sankey.js.map +1 -1
  272. package/lib/data/utils/fields.js +1 -2
  273. package/lib/data/utils/fields.js.map +1 -1
  274. package/lib/data/utils/flow.js +1 -2
  275. package/lib/data/utils/flow.js.map +1 -1
  276. package/lib/data/utils/memo.js +4 -5
  277. package/lib/data/utils/memo.js.map +1 -1
  278. package/lib/data/utils/venn/circleintersection.js +7 -8
  279. package/lib/data/utils/venn/circleintersection.js.map +1 -1
  280. package/lib/data/utils/venn/diagram.js +1 -2
  281. package/lib/data/utils/venn/diagram.js.map +1 -1
  282. package/lib/data/utils/venn/fmin/bisect.js +1 -2
  283. package/lib/data/utils/venn/fmin/bisect.js.map +1 -1
  284. package/lib/data/utils/venn/fmin/blas1.js +7 -8
  285. package/lib/data/utils/venn/fmin/blas1.js.map +1 -1
  286. package/lib/data/utils/venn/fmin/conjugateGradient.js +2 -3
  287. package/lib/data/utils/venn/fmin/conjugateGradient.js.map +1 -1
  288. package/lib/data/utils/venn/fmin/gradientDescent.js +2 -3
  289. package/lib/data/utils/venn/fmin/gradientDescent.js.map +1 -1
  290. package/lib/data/utils/venn/fmin/linesearch.js +1 -2
  291. package/lib/data/utils/venn/fmin/linesearch.js.map +1 -1
  292. package/lib/data/utils/venn/fmin/nelderMead.js +1 -2
  293. package/lib/data/utils/venn/fmin/nelderMead.js.map +1 -1
  294. package/lib/data/utils/venn/layout.js +10 -11
  295. package/lib/data/utils/venn/layout.js.map +1 -1
  296. package/lib/data/wordCloud.js +3 -3
  297. package/lib/data/wordCloud.js.map +1 -1
  298. package/lib/index.d.ts +2 -0
  299. package/lib/interaction/adaptiveFilter.js +7 -8
  300. package/lib/interaction/adaptiveFilter.js.map +1 -1
  301. package/lib/interaction/brushAxisHighlight.js +4 -4
  302. package/lib/interaction/brushAxisHighlight.js.map +1 -1
  303. package/lib/interaction/brushFilter.js +2 -3
  304. package/lib/interaction/brushFilter.js.map +1 -1
  305. package/lib/interaction/brushHighlight.js +3 -4
  306. package/lib/interaction/brushHighlight.js.map +1 -1
  307. package/lib/interaction/brushXFilter.js +1 -2
  308. package/lib/interaction/brushXFilter.js.map +1 -1
  309. package/lib/interaction/brushXHighlight.js +2 -3
  310. package/lib/interaction/brushXHighlight.js.map +1 -1
  311. package/lib/interaction/brushYFilter.js +1 -2
  312. package/lib/interaction/brushYFilter.js.map +1 -1
  313. package/lib/interaction/brushYHighlight.js +2 -3
  314. package/lib/interaction/brushYHighlight.js.map +1 -1
  315. package/lib/interaction/chartIndex.js +1 -2
  316. package/lib/interaction/chartIndex.js.map +1 -1
  317. package/lib/interaction/elementHighlight.js +2 -3
  318. package/lib/interaction/elementHighlight.js.map +1 -1
  319. package/lib/interaction/elementHighlightByColor.js +1 -2
  320. package/lib/interaction/elementHighlightByColor.js.map +1 -1
  321. package/lib/interaction/elementHighlightByX.js +1 -2
  322. package/lib/interaction/elementHighlightByX.js.map +1 -1
  323. package/lib/interaction/elementHoverScale.d.ts +23 -0
  324. package/lib/interaction/elementHoverScale.js +226 -0
  325. package/lib/interaction/elementHoverScale.js.map +1 -0
  326. package/lib/interaction/elementPointMove.js +1 -2
  327. package/lib/interaction/elementPointMove.js.map +1 -1
  328. package/lib/interaction/elementSelect.js +2 -3
  329. package/lib/interaction/elementSelect.js.map +1 -1
  330. package/lib/interaction/elementSelectByColor.js +1 -2
  331. package/lib/interaction/elementSelectByColor.js.map +1 -1
  332. package/lib/interaction/elementSelectByX.js +1 -2
  333. package/lib/interaction/elementSelectByX.js.map +1 -1
  334. package/lib/interaction/event.js +11 -4
  335. package/lib/interaction/event.js.map +1 -1
  336. package/lib/interaction/fisheye.js +1 -2
  337. package/lib/interaction/fisheye.js.map +1 -1
  338. package/lib/interaction/index.d.ts +1 -0
  339. package/lib/interaction/index.js +3 -1
  340. package/lib/interaction/index.js.map +1 -1
  341. package/lib/interaction/legendFilter.d.ts +2 -0
  342. package/lib/interaction/legendFilter.js +249 -33
  343. package/lib/interaction/legendFilter.js.map +1 -1
  344. package/lib/interaction/legendHighlight.js +1 -2
  345. package/lib/interaction/legendHighlight.js.map +1 -1
  346. package/lib/interaction/poptip.js +1 -2
  347. package/lib/interaction/poptip.js.map +1 -1
  348. package/lib/interaction/scrollbarFilter.js +4 -3
  349. package/lib/interaction/scrollbarFilter.js.map +1 -1
  350. package/lib/interaction/sliderFilter.js +2 -2
  351. package/lib/interaction/sliderFilter.js.map +1 -1
  352. package/lib/interaction/sliderWheel.js +1 -2
  353. package/lib/interaction/sliderWheel.js.map +1 -1
  354. package/lib/interaction/tooltip.d.ts +2 -2
  355. package/lib/interaction/tooltip.js +22 -16
  356. package/lib/interaction/tooltip.js.map +1 -1
  357. package/lib/interaction/treemapDrillDown.js +1 -2
  358. package/lib/interaction/treemapDrillDown.js.map +1 -1
  359. package/lib/interaction/utils.d.ts +2 -2
  360. package/lib/interaction/utils.js +34 -34
  361. package/lib/interaction/utils.js.map +1 -1
  362. package/lib/label-transform/exceedAdjust.js.map +1 -1
  363. package/lib/label-transform/overflowStroke.js.map +1 -1
  364. package/lib/label-transform/overlapDodgeY.js.map +1 -1
  365. package/lib/label-transform/utils.js +2 -3
  366. package/lib/label-transform/utils.js.map +1 -1
  367. package/lib/lib/builtinlib.js +1 -2
  368. package/lib/lib/builtinlib.js.map +1 -1
  369. package/lib/lib/core.d.ts +2 -1
  370. package/lib/lib/core.js +2 -2
  371. package/lib/lib/core.js.map +1 -1
  372. package/lib/lib/geo.js +1 -2
  373. package/lib/lib/geo.js.map +1 -1
  374. package/lib/lib/graph.js +1 -2
  375. package/lib/lib/graph.js.map +1 -1
  376. package/lib/lib/lite.js +1 -2
  377. package/lib/lib/lite.js.map +1 -1
  378. package/lib/lib/plot.js +1 -2
  379. package/lib/lib/plot.js.map +1 -1
  380. package/lib/lib/std.d.ts +1 -0
  381. package/lib/lib/std.js +1 -2
  382. package/lib/lib/std.js.map +1 -1
  383. package/lib/mark/area.js.map +1 -1
  384. package/lib/mark/box.js +3 -3
  385. package/lib/mark/box.js.map +1 -1
  386. package/lib/mark/boxplot.js.map +1 -1
  387. package/lib/mark/chord.js +2 -2
  388. package/lib/mark/chord.js.map +1 -1
  389. package/lib/mark/density.js +1 -1
  390. package/lib/mark/density.js.map +1 -1
  391. package/lib/mark/gauge.js.map +1 -1
  392. package/lib/mark/line.js.map +1 -1
  393. package/lib/mark/polygon.js.map +1 -1
  394. package/lib/mark/range.js +2 -2
  395. package/lib/mark/range.js.map +1 -1
  396. package/lib/mark/sankey.js.map +1 -1
  397. package/lib/mark/utils.js +16 -17
  398. package/lib/mark/utils.js.map +1 -1
  399. package/lib/runtime/component.js +10 -11
  400. package/lib/runtime/component.js.map +1 -1
  401. package/lib/runtime/coordinate.js +12 -13
  402. package/lib/runtime/coordinate.js.map +1 -1
  403. package/lib/runtime/layout.js +4 -5
  404. package/lib/runtime/layout.js.map +1 -1
  405. package/lib/runtime/library.js +2 -3
  406. package/lib/runtime/library.js.map +1 -1
  407. package/lib/runtime/mark.js +4 -5
  408. package/lib/runtime/mark.js.map +1 -1
  409. package/lib/runtime/option-preprocess/axis-breaks.js +2 -2
  410. package/lib/runtime/option-preprocess/axis-breaks.js.map +1 -1
  411. package/lib/runtime/option-preprocess/index.js +1 -2
  412. package/lib/runtime/option-preprocess/index.js.map +1 -1
  413. package/lib/runtime/option-preprocess/style.js +1 -2
  414. package/lib/runtime/option-preprocess/style.js.map +1 -1
  415. package/lib/runtime/plot.js +4 -4
  416. package/lib/runtime/plot.js.map +1 -1
  417. package/lib/runtime/render.js +3 -4
  418. package/lib/runtime/render.js.map +1 -1
  419. package/lib/runtime/scale.js +27 -18
  420. package/lib/runtime/scale.js.map +1 -1
  421. package/lib/runtime/transform.js +13 -13
  422. package/lib/runtime/transform.js.map +1 -1
  423. package/lib/shape/area/curve.js.map +1 -1
  424. package/lib/shape/axis-breaks/axis-breaks.js.map +1 -1
  425. package/lib/shape/box/box.js.map +1 -1
  426. package/lib/shape/box/violin.js.map +1 -1
  427. package/lib/shape/connector/connector.js.map +1 -1
  428. package/lib/shape/heatmap/renderer/gradient.js +1 -2
  429. package/lib/shape/heatmap/renderer/gradient.js.map +1 -1
  430. package/lib/shape/heatmap/renderer/index.js +1 -2
  431. package/lib/shape/heatmap/renderer/index.js.map +1 -1
  432. package/lib/shape/interval/color.js +2 -2
  433. package/lib/shape/interval/color.js.map +1 -1
  434. package/lib/shape/interval/funnel.js.map +1 -1
  435. package/lib/shape/interval/pyramid.js.map +1 -1
  436. package/lib/shape/label/label.js +17 -7
  437. package/lib/shape/label/label.js.map +1 -1
  438. package/lib/shape/label/position/area.js +1 -2
  439. package/lib/shape/label/position/area.js.map +1 -1
  440. package/lib/shape/label/position/default.js +6 -7
  441. package/lib/shape/label/position/default.js.map +1 -1
  442. package/lib/shape/label/position/outside.js +5 -6
  443. package/lib/shape/label/position/outside.js.map +1 -1
  444. package/lib/shape/label/position/spider.js +1 -2
  445. package/lib/shape/label/position/spider.js.map +1 -1
  446. package/lib/shape/label/position/surround.js +1 -2
  447. package/lib/shape/label/position/surround.js.map +1 -1
  448. package/lib/shape/label/position/utils.js +2 -3
  449. package/lib/shape/label/position/utils.js.map +1 -1
  450. package/lib/shape/line/curve.js.map +1 -1
  451. package/lib/shape/line/trail.js.map +1 -1
  452. package/lib/shape/link/arc.js.map +1 -1
  453. package/lib/shape/link/vhv.js.map +1 -1
  454. package/lib/shape/liquid/liquid.js.map +1 -1
  455. package/lib/shape/liquid/wave.js +1 -2
  456. package/lib/shape/liquid/wave.js.map +1 -1
  457. package/lib/shape/point/color.js +2 -2
  458. package/lib/shape/point/color.js.map +1 -1
  459. package/lib/shape/polygon/polygon.js.map +1 -1
  460. package/lib/shape/polygon/ribbon.js.map +1 -1
  461. package/lib/shape/text/advance.d.ts +1 -1
  462. package/lib/shape/text/advance.js.map +1 -1
  463. package/lib/shape/utils.js +11 -12
  464. package/lib/shape/utils.js.map +1 -1
  465. package/lib/shape/vector/vector.js.map +1 -1
  466. package/lib/spec/interaction.d.ts +15 -2
  467. package/lib/theme/create.d.ts +1 -1
  468. package/lib/theme/create.js +4 -4
  469. package/lib/theme/create.js.map +1 -1
  470. package/lib/theme/dark.js +5 -4
  471. package/lib/theme/dark.js.map +1 -1
  472. package/lib/transform/diffY.js.map +1 -1
  473. package/lib/transform/dodgeX.js.map +1 -1
  474. package/lib/transform/filter.js.map +1 -1
  475. package/lib/transform/jitter.js +3 -3
  476. package/lib/transform/jitter.js.map +1 -1
  477. package/lib/transform/maybeDefaultX.js.map +1 -1
  478. package/lib/transform/maybeDefaultY.js.map +1 -1
  479. package/lib/transform/maybeTitle.js.map +1 -1
  480. package/lib/transform/maybeVisualPosition.js +1 -1
  481. package/lib/transform/maybeVisualPosition.js.map +1 -1
  482. package/lib/transform/normalizeY.js.map +1 -1
  483. package/lib/transform/pack.js.map +1 -1
  484. package/lib/transform/sample.js.map +1 -1
  485. package/lib/transform/sort.js.map +1 -1
  486. package/lib/transform/stackEnter.js.map +1 -1
  487. package/lib/transform/stackY.js +2 -2
  488. package/lib/transform/stackY.js.map +1 -1
  489. package/lib/transform/symmetryY.js.map +1 -1
  490. package/lib/transform/utils/helper.js +8 -9
  491. package/lib/transform/utils/helper.js.map +1 -1
  492. package/lib/transform/utils/lttb.js +1 -2
  493. package/lib/transform/utils/lttb.js.map +1 -1
  494. package/lib/transform/utils/order.js +4 -5
  495. package/lib/transform/utils/order.js.map +1 -1
  496. package/lib/utils/angle.js +3 -4
  497. package/lib/utils/angle.js.map +1 -1
  498. package/lib/utils/array.js +9 -10
  499. package/lib/utils/array.js.map +1 -1
  500. package/lib/utils/bounds.js +4 -5
  501. package/lib/utils/bounds.js.map +1 -1
  502. package/lib/utils/color.js +1 -2
  503. package/lib/utils/color.js.map +1 -1
  504. package/lib/utils/coordinate.d.ts +0 -1
  505. package/lib/utils/coordinate.js +14 -15
  506. package/lib/utils/coordinate.js.map +1 -1
  507. package/lib/utils/createElement.js +1 -2
  508. package/lib/utils/createElement.js.map +1 -1
  509. package/lib/utils/dateFormat.js +1 -2
  510. package/lib/utils/dateFormat.js.map +1 -1
  511. package/lib/utils/expr.js +2 -2
  512. package/lib/utils/expr.js.map +1 -1
  513. package/lib/utils/flow.js +1 -2
  514. package/lib/utils/flow.js.map +1 -1
  515. package/lib/utils/helper.js +30 -31
  516. package/lib/utils/helper.js.map +1 -1
  517. package/lib/utils/lru.js +1 -2
  518. package/lib/utils/lru.js.map +1 -1
  519. package/lib/utils/mark.js +4 -5
  520. package/lib/utils/mark.js.map +1 -1
  521. package/lib/utils/marker.d.ts +1 -1
  522. package/lib/utils/marker.js +4 -4
  523. package/lib/utils/marker.js.map +1 -1
  524. package/lib/utils/number.js +2 -3
  525. package/lib/utils/number.js.map +1 -1
  526. package/lib/utils/scale.js +7 -7
  527. package/lib/utils/scale.js.map +1 -1
  528. package/lib/utils/selection.js +2 -2
  529. package/lib/utils/selection.js.map +1 -1
  530. package/lib/utils/size.js +2 -3
  531. package/lib/utils/size.js.map +1 -1
  532. package/lib/utils/string.js +2 -3
  533. package/lib/utils/string.js.map +1 -1
  534. package/lib/utils/style.js +4 -5
  535. package/lib/utils/style.js.map +1 -1
  536. package/lib/utils/traverse-elements.js +1 -2
  537. package/lib/utils/traverse-elements.js.map +1 -1
  538. package/lib/utils/treeDataTransform.js +1 -2
  539. package/lib/utils/treeDataTransform.js.map +1 -1
  540. package/lib/utils/vector.js +8 -9
  541. package/lib/utils/vector.js.map +1 -1
  542. package/package.json +5 -4
  543. package/src/component/axis.ts +3 -0
  544. package/src/component/constant.ts +12 -0
  545. package/src/component/legendCategory.ts +13 -1
  546. package/src/component/legendContinuous.ts +6 -0
  547. package/src/component/scrollbar.ts +2 -1
  548. package/src/interaction/elementHoverScale.ts +285 -0
  549. package/src/interaction/event.ts +10 -2
  550. package/src/interaction/index.ts +1 -0
  551. package/src/interaction/legendFilter.ts +260 -14
  552. package/src/interaction/scrollbarFilter.ts +2 -1
  553. package/src/interaction/tooltip.ts +16 -7
  554. package/src/lib/core.ts +2 -0
  555. package/src/runtime/mark.ts +2 -2
  556. package/src/runtime/plot.ts +1 -0
  557. package/src/spec/interaction.ts +16 -0
  558. package/src/theme/create.ts +3 -1
  559. package/src/theme/dark.ts +5 -4
  560. package/src/utils/helper.ts +6 -6
@@ -1,10 +1,12 @@
1
1
  import { DisplayObject } from '@antv/g';
2
2
  import { deepMix, throttle } from '@antv/util';
3
+ import { Base } from '@antv/scale';
3
4
  import { subObject } from '../utils/helper';
4
5
  import { ANNOTATION_MARKS } from '../component/constant';
5
6
  import { useState, setCursor, restoreCursor } from './utils';
6
7
 
7
8
  export const CATEGORY_LEGEND_CLASS_NAME = 'legend-category';
9
+ export const CATEGORY_LEGEND_CLASS_NAME_HTML = 'legend-html';
8
10
 
9
11
  export const CONTINUOUS_LEGEND_CLASS_NAME = 'legend-continuous';
10
12
 
@@ -35,6 +37,9 @@ export function itemsOf(root) {
35
37
  export function legendsOf(root) {
36
38
  return root.getElementsByClassName(CATEGORY_LEGEND_CLASS_NAME);
37
39
  }
40
+ export function legendsHtmlOf(root) {
41
+ return root.getElementsByClassName(CATEGORY_LEGEND_CLASS_NAME_HTML);
42
+ }
38
43
 
39
44
  export function legendsContinuousOf(root) {
40
45
  return root.getElementsByClassName(CONTINUOUS_LEGEND_CLASS_NAME);
@@ -65,6 +70,21 @@ export function attributesOf(root) {
65
70
  return child.attributes;
66
71
  }
67
72
 
73
+ function getScaleByMarkKey(
74
+ scale: Record<string, Base<any>>,
75
+ markKey: string,
76
+ channelName: string,
77
+ ) {
78
+ const seriesKey = Object.keys(scale).find((channel) => {
79
+ if (channel.startsWith(channelName)) {
80
+ const options = scale[channel].getOptions();
81
+ return options.name === channelName && options.markKey === markKey;
82
+ }
83
+ });
84
+
85
+ return scale[seriesKey] ?? scale[channelName];
86
+ }
87
+
68
88
  function legendFilterOrdinal(
69
89
  root: DisplayObject,
70
90
  {
@@ -254,22 +274,215 @@ function legendFilterOrdinal(
254
274
  if (focusIcon) {
255
275
  focusIcon.removeEventListener('click', focusIconClick.get(item));
256
276
  }
257
-
258
- emitter.on('legend:focus', onFocus);
259
- emitter.off('legend:filter', onFilter);
260
- emitter.off('legend:reset', onEnd);
261
277
  }
278
+ emitter.off('legend:focus', onFocus);
279
+ emitter.off('legend:filter', onFilter);
280
+ emitter.off('legend:reset', onEnd);
281
+ };
282
+ }
283
+
284
+ function legendFilterOrdinalHtml(
285
+ root: DisplayObject,
286
+ { domain, filter, defaultSelect, emitter, channel },
287
+ ) {
288
+ // HTML DOM event handlers.
289
+ const htmlItemClick = new Map();
290
+ const htmlItemPointerenter = new Map();
291
+ const htmlItemPointerout = new Map();
292
+
293
+ let selectedValues = [...domain];
294
+
295
+ // Helper function to get chart container element.
296
+ const getChartContainer = () => {
297
+ // Use the same approach as tooltip.ts to get container.
298
+ const view = root.ownerDocument?.defaultView;
299
+ if (!view) return document.body;
300
+
301
+ const canvas: any = view.getContextService().getDomElement();
302
+ return (canvas.parentElement as unknown as HTMLElement) || document.body;
303
+ };
304
+
305
+ // Helper function to bind HTML DOM events.
306
+ const bindHtmlDomEvents = () => {
307
+ const chartContainer = getChartContainer();
308
+
309
+ // Find HTML legend containers within this chart's container.
310
+ const htmlContainer = chartContainer.querySelector('.legend-html');
311
+
312
+ const htmlClick = async (event) => {
313
+ // Find the element with legend-value attribute by traversing up from the target.
314
+ let targetElement = event.target as Element;
315
+ while (targetElement && !targetElement.hasAttribute('legend-value')) {
316
+ targetElement = targetElement.parentElement;
317
+ if (targetElement === htmlContainer) break; // Stop if we reach the container.
318
+ }
319
+
320
+ if (!targetElement || !targetElement.hasAttribute('legend-value')) return;
321
+
322
+ event.preventDefault();
323
+ event.stopPropagation();
324
+
325
+ const value = targetElement.getAttribute('legend-value');
326
+ if (!value) return;
327
+
328
+ const index = selectedValues.indexOf(value);
329
+ if (index === -1) selectedValues.push(value);
330
+ else selectedValues.splice(index, 1);
331
+
332
+ await filter(selectedValues);
333
+ updateHtmlLegendState();
334
+
335
+ if (selectedValues.length === domain.length) {
336
+ emitter.emit('legend:reset', { nativeEvent: true });
337
+ } else {
338
+ emitter.emit('legend:filter', {
339
+ nativeEvent: true,
340
+ data: {
341
+ channel,
342
+ values: selectedValues,
343
+ },
344
+ });
345
+ }
346
+ };
347
+
348
+ // Bind HTML DOM events to the container using event delegation.
349
+ htmlContainer.addEventListener('click', htmlClick);
350
+
351
+ // Store handlers for cleanup.
352
+ htmlItemClick.set(htmlContainer, htmlClick);
353
+ };
354
+
355
+ // Helper function to update HTML legend visual state.
356
+ const updateHtmlLegendState = () => {
357
+ const chartContainer = getChartContainer();
358
+ const htmlLegendItems = chartContainer.querySelectorAll('[legend-value]');
359
+
360
+ htmlLegendItems.forEach((htmlItem) => {
361
+ const value = htmlItem.getAttribute('legend-value');
362
+ if (!value) return;
363
+
364
+ // Check if this value exists in the domain (belongs to this chart instance).
365
+ if (!domain.includes(value)) return;
366
+
367
+ const isSelected = selectedValues.includes(value);
368
+ const htmlElement = htmlItem as HTMLElement;
369
+
370
+ if (!isSelected) {
371
+ // Apply unselected style.
372
+ // User can override style via CSS.
373
+ htmlElement.style.opacity = '0.4';
374
+ htmlElement.classList.add('legend-item-inactive');
375
+ } else {
376
+ // Apply selected style.
377
+ htmlElement.style.opacity = '1';
378
+ htmlElement.classList.remove('legend-item-inactive');
379
+ }
380
+ });
381
+ };
382
+
383
+ // Bind HTML DOM events.
384
+ bindHtmlDomEvents();
385
+
386
+ const onFocus = async (event) => {
387
+ const { nativeEvent } = event;
388
+ if (nativeEvent) return;
389
+
390
+ const { data } = event;
391
+ const { channel: specifiedChannel, value } = data;
392
+ if (specifiedChannel !== channel) return;
393
+
394
+ selectedValues = [value];
395
+
396
+ await filter(selectedValues);
397
+ updateHtmlLegendState();
398
+ };
399
+
400
+ const onFilter = async (event) => {
401
+ const { nativeEvent } = event;
402
+ if (nativeEvent) return;
403
+ const { data } = event;
404
+ const { channel: specifiedChannel, values } = data;
405
+ if (specifiedChannel !== channel) return;
406
+ selectedValues = values;
407
+ await filter(selectedValues);
408
+ updateHtmlLegendState();
409
+ };
410
+
411
+ const onEnd = async (event) => {
412
+ const { nativeEvent } = event;
413
+ if (nativeEvent) return;
414
+ selectedValues = [...domain];
415
+ await filter(selectedValues);
416
+ updateHtmlLegendState();
417
+ };
418
+
419
+ emitter.on('legend:filter', onFilter);
420
+ emitter.on('legend:focus', onFocus);
421
+ emitter.on('legend:reset', onEnd);
422
+
423
+ if (defaultSelect) {
424
+ emitter.emit('legend:filter', {
425
+ data: { channel, values: defaultSelect },
426
+ });
427
+ }
428
+
429
+ return () => {
430
+ // Clean up HTML DOM event listeners.
431
+ const chartContainer = getChartContainer();
432
+ const htmlLegendItems = chartContainer.querySelectorAll('[legend-value]');
433
+
434
+ htmlLegendItems.forEach((htmlItem) => {
435
+ const value = htmlItem.getAttribute('legend-value');
436
+ if (!value) return;
437
+
438
+ // Only clean up items that belong to this chart instance.
439
+ if (!domain.includes(value)) return;
440
+
441
+ const clickHandler = htmlItemClick.get(htmlItem);
442
+ const pointerenterHandler = htmlItemPointerenter.get(htmlItem);
443
+ const pointeroutHandler = htmlItemPointerout.get(htmlItem);
444
+
445
+ if (clickHandler) {
446
+ htmlItem.removeEventListener('click', clickHandler);
447
+ }
448
+ if (pointerenterHandler) {
449
+ htmlItem.removeEventListener('pointerenter', pointerenterHandler);
450
+ }
451
+ if (pointeroutHandler) {
452
+ htmlItem.removeEventListener('pointerout', pointeroutHandler);
453
+ }
454
+ });
455
+
456
+ // Clear HTML DOM handler maps.
457
+ htmlItemClick.clear();
458
+ htmlItemPointerenter.clear();
459
+ htmlItemPointerout.clear();
460
+
461
+ // Clean up emitter listeners.
462
+ emitter.off('legend:filter', onFilter);
463
+ emitter.off('legend:focus', onFocus);
464
+ emitter.off('legend:reset', onEnd);
262
465
  };
263
466
  }
264
467
 
265
468
  function legendFilterContinuous(_, { legend, filter, emitter, channel }) {
266
- const onValueChange = ({ detail: { value } }) => {
267
- filter(value);
469
+ const { attributes } = legend;
470
+ const onValueChange = (data) => {
471
+ const { value } = data.detail;
472
+ const domainValue = value.map((d) => {
473
+ const matchRealValue = attributes.data?.find((item) => item.value === d);
474
+ // For threshold/quantile scale, use domain value instead of threshold index.
475
+ if (matchRealValue) return matchRealValue.domainValue ?? d;
476
+
477
+ return d;
478
+ });
479
+
480
+ filter(domainValue);
268
481
  emitter.emit({
269
482
  nativeEvent: true,
270
483
  data: {
271
484
  channel,
272
- values: value,
485
+ values: domainValue,
273
486
  },
274
487
  });
275
488
  };
@@ -296,9 +509,20 @@ async function filterView(
296
509
  const { marks } = viewOptions;
297
510
  // Add filter transform for every marks,
298
511
  // which will skip for mark without color channel.
512
+
513
+ const channelScale = legend.attributes?.scales?.find(
514
+ (s) => s.name === channel,
515
+ );
299
516
  const newMarks = marks.map((mark) => {
300
- if (mark.type === 'legends') return mark;
517
+ // Only filter marks with the same scale key.
518
+ if (
519
+ // if key is not defined, use default channel name.
520
+ (mark.scale[channel].key ?? channel) !==
521
+ (channelScale?.key ?? channelScale?.name)
522
+ )
523
+ return mark;
301
524
 
525
+ if (mark.type === 'legends') return mark;
302
526
  // Skip Annotation marks.
303
527
  if (ANNOTATION_MARKS.includes(mark.type)) return mark;
304
528
 
@@ -311,16 +535,24 @@ async function filterView(
311
535
  if (data.length) {
312
536
  newTransform.splice(index + 1, 0, {
313
537
  type: 'filter',
314
- [channel]: { value, ordinal },
538
+ [channel]: {
539
+ value,
540
+ ordinal,
541
+ },
315
542
  });
316
543
  }
317
544
 
318
545
  // Set domain of scale to preserve encoding.
319
546
  const newScale = Object.fromEntries(
320
- channels.map((channel) => [
321
- channel,
322
- { domain: view.scale[channel].getOptions().domain },
323
- ]),
547
+ channels.map((channel) => {
548
+ const matchScale = getScaleByMarkKey(
549
+ view.scale,
550
+ viewOptions.key,
551
+ channel,
552
+ );
553
+
554
+ return [channel, { domain: matchScale.getOptions().domain }];
555
+ }),
324
556
  );
325
557
  return deepMix({}, mark, {
326
558
  transform: newTransform,
@@ -353,6 +585,7 @@ export function LegendFilter() {
353
585
  };
354
586
  const legends = [
355
587
  ...legendsOf(container),
588
+ ...legendsHtmlOf(container),
356
589
  ...legendsContinuousOf(container),
357
590
  ];
358
591
  const allChannels = legends.flatMap(channelsOf);
@@ -370,8 +603,9 @@ export function LegendFilter() {
370
603
  channels,
371
604
  allChannels,
372
605
  };
606
+
373
607
  if (legend.className === CATEGORY_LEGEND_CLASS_NAME) {
374
- return legendFilterOrdinal(container, {
608
+ return legendFilterOrdinal(legend, {
375
609
  legends: itemsOf,
376
610
  marker: markerOf,
377
611
  label: labelOf,
@@ -390,6 +624,18 @@ export function LegendFilter() {
390
624
  channel,
391
625
  emitter,
392
626
  });
627
+ } else if (legend.className === CATEGORY_LEGEND_CLASS_NAME_HTML) {
628
+ return legendFilterOrdinalHtml(container, {
629
+ domain,
630
+ filter: (value) => {
631
+ const options = { ...common, value, ordinal: true };
632
+ if (isFacet) filter(facets, options);
633
+ else filter(context, options);
634
+ },
635
+ defaultSelect: legend.attributes.defaultSelect,
636
+ channel,
637
+ emitter,
638
+ });
393
639
  } else {
394
640
  return legendFilterContinuous(container, {
395
641
  legend,
@@ -1,6 +1,7 @@
1
+ import { G2_CLASS_PREFIX } from '../component/constant';
1
2
  import { SliderFilter } from './sliderFilter';
2
3
 
3
- export const SCROLLBAR_CLASS_NAME = 'g2-scrollbar';
4
+ export const SCROLLBAR_CLASS_NAME = `${G2_CLASS_PREFIX}scrollbar`;
4
5
 
5
6
  export function ScrollbarFilter(options: any = {}) {
6
7
  return (context, _, emitter) => {
@@ -14,6 +14,7 @@ import { angle, sub, dist } from '../utils/vector';
14
14
  import { invert } from '../utils/scale';
15
15
  import { BBox } from '../runtime';
16
16
  import { CALLBACK_ITEM_SYMBOL } from '../runtime/transform';
17
+ import { G2_CLASS_PREFIX, g2Selector } from '../component/constant';
17
18
  import {
18
19
  selectG2Elements,
19
20
  createXKey,
@@ -79,8 +80,8 @@ function createTooltip(
79
80
  offset: [number, number] = [10, 10],
80
81
  ) {
81
82
  const defaults = {
82
- '.g2-tooltip': {},
83
- '.g2-tooltip-title': {
83
+ [g2Selector('tooltip')]: {},
84
+ [g2Selector('tooltip-title')]: {
84
85
  overflow: 'hidden',
85
86
  'white-space': 'nowrap',
86
87
  'text-overflow': 'ellipsis',
@@ -99,7 +100,7 @@ function createTooltip(
99
100
  title: '',
100
101
  offset,
101
102
  template: {
102
- prefixCls: 'g2-',
103
+ prefixCls: G2_CLASS_PREFIX,
103
104
  },
104
105
  style: deepMix(defaults, css),
105
106
  },
@@ -529,7 +530,7 @@ function updateMarker(root, { data, style, theme }) {
529
530
  const fill = type === 'hollow' ? 'transparent' : originColor;
530
531
  const stroke = type === 'hollow' ? originColor : '#fff';
531
532
  const shape = new Circle({
532
- className: 'g2-tooltip-marker',
533
+ className: `${G2_CLASS_PREFIX}tooltip-marker`,
533
534
  style: {
534
535
  cx: point[0],
535
536
  cy: point[1],
@@ -948,6 +949,7 @@ export function seriesTooltip(
948
949
  style: _style = {},
949
950
  css = {},
950
951
  clickLock = false,
952
+ disableAutoHide = false,
951
953
  ...rest
952
954
  }: Record<string, any>,
953
955
  ) {
@@ -1095,7 +1097,8 @@ export function seriesTooltip(
1095
1097
  ) as (...args: any[]) => void;
1096
1098
 
1097
1099
  const hide = (event: MouseEvent) => {
1098
- if (clickLock && root.getAttribute(LOCKED_SYMBOL)) return;
1100
+ if ((clickLock && root.getAttribute(LOCKED_SYMBOL)) || disableAutoHide)
1101
+ return;
1099
1102
  hideTooltip({ root, single, emitter, event });
1100
1103
  };
1101
1104
 
@@ -1220,6 +1223,7 @@ export function tooltip(
1220
1223
  preserve = false,
1221
1224
  css = {},
1222
1225
  clickLock = false,
1226
+ disableAutoHide = false,
1223
1227
  }: Record<string, any>,
1224
1228
  ) {
1225
1229
  const elements = elementsof(root);
@@ -1236,7 +1240,9 @@ export function tooltip(
1236
1240
  shared,
1237
1241
  });
1238
1242
  if (!element) {
1239
- hideTooltip({ root, single, emitter, event });
1243
+ if (!disableAutoHide) {
1244
+ hideTooltip({ root, single, emitter, event });
1245
+ }
1240
1246
  return;
1241
1247
  }
1242
1248
  const k = groupKey(element);
@@ -1258,7 +1264,9 @@ export function tooltip(
1258
1264
  }
1259
1265
 
1260
1266
  if (isEmptyTooltipData(data)) {
1261
- hideTooltip({ root, single, emitter, event });
1267
+ if (!disableAutoHide) {
1268
+ hideTooltip({ root, single, emitter, event });
1269
+ }
1262
1270
  return;
1263
1271
  }
1264
1272
 
@@ -1295,6 +1303,7 @@ export function tooltip(
1295
1303
  ) as (...args: any[]) => void;
1296
1304
 
1297
1305
  const pointerleave = (event) => {
1306
+ if (disableAutoHide) return;
1298
1307
  hideTooltip({ root, single, emitter, event });
1299
1308
  };
1300
1309
 
package/src/lib/core.ts CHANGED
@@ -85,6 +85,7 @@ import {
85
85
  ElementHighlight,
86
86
  ElementHighlightByX,
87
87
  ElementHighlightByColor,
88
+ ElementHoverScale,
88
89
  ElementSelect,
89
90
  ElementSelectByX,
90
91
  ElementSelectByColor,
@@ -296,6 +297,7 @@ export function corelib() {
296
297
  'interaction.elementHighlight': ElementHighlight,
297
298
  'interaction.elementHighlightByX': ElementHighlightByX,
298
299
  'interaction.elementHighlightByColor': ElementHighlightByColor,
300
+ 'interaction.elementHoverScale': ElementHoverScale,
299
301
  'interaction.elementSelect': ElementSelect,
300
302
  'interaction.elementSelectByX': ElementSelectByX,
301
303
  'interaction.elementSelectByColor': ElementSelectByColor,
@@ -39,7 +39,7 @@ export async function initializeMark(
39
39
  context,
40
40
  );
41
41
 
42
- const { encode, scale, data, tooltip, key: markerKey } = transformedMark;
42
+ const { encode, scale, data, tooltip, key: markKey } = transformedMark;
43
43
 
44
44
  // Skip mark with non-tabular data. Do not skip empty
45
45
  // data, they are useful for facet to display axes.
@@ -107,7 +107,7 @@ export async function initializeMark(
107
107
  scaleKey: independent || isConstant ? Symbol('independent') : key,
108
108
  scale: {
109
109
  type,
110
- markerKey,
110
+ markKey,
111
111
  range: finalRange,
112
112
  ...scaleOptions,
113
113
  quantitative,
@@ -1296,6 +1296,7 @@ function getLabels(
1296
1296
  points,
1297
1297
  dependentElement: element,
1298
1298
  }));
1299
+ // @ts-ignore
1299
1300
  return selector ? selector(F) : F;
1300
1301
  }
1301
1302
 
@@ -7,6 +7,7 @@ export type Interaction =
7
7
  | ElementHighlightInteraction
8
8
  | ElementHighlightByColorInteraction
9
9
  | ElementHighlightByXInteraction
10
+ | ElementHoverScaleInteraction
10
11
  | ElementSelectByColorInteraction
11
12
  | ElementSelectByXInteraction
12
13
  | ElementSelectInteraction
@@ -30,6 +31,7 @@ export type InteractionTypes =
30
31
  | 'elementHighlight'
31
32
  | 'elementHighlightByX'
32
33
  | 'elementHighlightByColor'
34
+ | 'elementHoverScale'
33
35
  | 'fisheye'
34
36
  | 'chartIndex'
35
37
  | 'elementSelect'
@@ -144,6 +146,19 @@ export type ElementHighlightByColorInteraction = {
144
146
  delay?: number;
145
147
  } & Record<`${'link' | 'background'}${any}`, any>;
146
148
 
149
+ export type ElementHoverScaleInteraction = {
150
+ type?: 'elementHoverScale';
151
+ scale?: number;
152
+ scaleOrigin?: string;
153
+ shadow?: boolean;
154
+ shadowColor?: string;
155
+ shadowBlur?: number;
156
+ shadowOffsetX?: number;
157
+ shadowOffsetY?: number;
158
+ zIndex?: number;
159
+ delay?: number;
160
+ } & Record<`state${any}`, any>;
161
+
147
162
  export type PoptipInteraction = {
148
163
  type?: 'poptip';
149
164
  offsetX?: number;
@@ -189,6 +204,7 @@ export type TooltipInteraction = {
189
204
  marker?: boolean;
190
205
  groupName?: boolean;
191
206
  disableNative?: boolean;
207
+ disableAutoHide?: boolean;
192
208
  offset?: [number, number];
193
209
  position?: TooltipStyleProps['position'];
194
210
  bounding?: BBox;
@@ -1,3 +1,5 @@
1
+ import { g2Selector } from '../component/constant';
2
+
1
3
  export function create({
2
4
  colorDefault,
3
5
  colorBlack,
@@ -436,7 +438,7 @@ export function create({
436
438
  },
437
439
  tooltip: {
438
440
  css: {
439
- '.g2-tooltip': {
441
+ [g2Selector('tooltip')]: {
440
442
  'font-family': 'sans-serif',
441
443
  },
442
444
  },
package/src/theme/dark.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { deepMix } from '@antv/util';
2
2
  import { ThemeComponent as TC, Theme } from '../runtime';
3
+ import { g2Selector } from '../component/constant';
3
4
  import { create } from './create';
4
5
 
5
6
  export type DarkOptions = Theme;
@@ -66,17 +67,17 @@ export const Dark: TC<DarkOptions> = (options) => {
66
67
  crosshairsLineWidth: 1,
67
68
  crosshairsStrokeOpacity: 0.25,
68
69
  css: {
69
- '.g2-tooltip': {
70
+ [g2Selector('tooltip')]: {
70
71
  background: '#1f1f1f',
71
72
  opacity: 0.95,
72
73
  },
73
- '.g2-tooltip-title': {
74
+ [g2Selector('tooltip-title')]: {
74
75
  color: '#A6A6A6',
75
76
  },
76
- '.g2-tooltip-list-item-name-label': {
77
+ [g2Selector('tooltip-list-item-name-label')]: {
77
78
  color: '#A6A6A6',
78
79
  },
79
- '.g2-tooltip-list-item-value': {
80
+ [g2Selector('tooltip-list-item-value')]: {
80
81
  color: '#A6A6A6',
81
82
  },
82
83
  },
@@ -62,16 +62,16 @@ export function seriesOf(elemenet: G2Element): string {
62
62
  }
63
63
 
64
64
  /**
65
- * Get series scale by markerKey
65
+ * Get series scale by markKey
66
66
  */
67
- function getSeriesByMarkerKey(scale: Record<string, Base<any>>, datum) {
68
- // For path mark, markerKey is in datum.element?.__data__?.markKey.
69
- const markerKey = datum.markKey ?? datum.element?.__data__?.markKey;
67
+ function getSeriesByMarkKey(scale: Record<string, Base<any>>, datum) {
68
+ // For path mark, markKey is in datum.element?.__data__?.markKey.
69
+ const markKey = datum.markKey ?? datum.element?.__data__?.markKey;
70
70
 
71
71
  const seriesKey = Object.keys(scale).find((channel) => {
72
72
  if (channel.startsWith('series')) {
73
73
  const options = scale[channel].getOptions();
74
- return options.name === 'series' && options.markerKey === markerKey;
74
+ return options.name === 'series' && options.markKey === markKey;
75
75
  }
76
76
  });
77
77
  return scale[seriesKey] ?? scale.series;
@@ -83,7 +83,7 @@ function getSeriesByMarkerKey(scale: Record<string, Base<any>>, datum) {
83
83
  export function groupNameOf(scale: Record<string, Base<any>>, datum) {
84
84
  const { color: scaleColor, facet = false } = scale;
85
85
  const { color, series } = datum;
86
- const scaleSeries = getSeriesByMarkerKey(scale, datum);
86
+ const scaleSeries = getSeriesByMarkKey(scale, datum);
87
87
 
88
88
  const invertAble = (scale) => {
89
89
  return (