@antv/g2 4.1.25 → 4.1.29

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 (543) hide show
  1. package/CHANGELOG.md +1116 -0
  2. package/{README.zh-CN.md → README.en-US.md} +39 -38
  3. package/README.md +39 -38
  4. package/dist/g2.min.js +31 -3
  5. package/dist/g2.min.js.map +1 -1
  6. package/esm/animate/index.js +1 -1
  7. package/esm/animate/index.js.map +1 -1
  8. package/esm/animate/interface.js +1 -0
  9. package/esm/chart/chart.js +1 -3
  10. package/esm/chart/chart.js.map +1 -1
  11. package/esm/chart/controller/annotation.js +14 -44
  12. package/esm/chart/controller/annotation.js.map +1 -1
  13. package/esm/chart/controller/coordinate.js +1 -2
  14. package/esm/chart/controller/coordinate.js.map +1 -1
  15. package/esm/chart/controller/scrollbar.js +3 -7
  16. package/esm/chart/controller/scrollbar.js.map +1 -1
  17. package/esm/chart/controller/slider.js +1 -2
  18. package/esm/chart/controller/slider.js.map +1 -1
  19. package/esm/chart/controller/tooltip.js +12 -7
  20. package/esm/chart/controller/tooltip.js.map +1 -1
  21. package/esm/chart/layout/auto.js +2 -2
  22. package/esm/chart/layout/auto.js.map +1 -1
  23. package/esm/chart/layout/constraint/bounds.d.ts +32 -0
  24. package/esm/chart/layout/constraint/bounds.js +30 -0
  25. package/esm/chart/layout/constraint/bounds.js.map +1 -0
  26. package/esm/chart/layout/constraint/constraint.d.ts +31 -0
  27. package/esm/chart/layout/constraint/constraint.js +81 -0
  28. package/esm/chart/layout/constraint/constraint.js.map +1 -0
  29. package/esm/chart/layout/constraint/gauss.d.ts +11 -0
  30. package/esm/chart/layout/constraint/gauss.js +63 -0
  31. package/esm/chart/layout/constraint/gauss.js.map +1 -0
  32. package/esm/chart/layout/constraint/index.d.ts +5 -0
  33. package/esm/chart/layout/constraint/index.js +30 -0
  34. package/esm/chart/layout/constraint/index.js.map +1 -0
  35. package/esm/chart/layout/constraint/solver.d.ts +40 -0
  36. package/esm/chart/layout/constraint/solver.js +77 -0
  37. package/esm/chart/layout/constraint/solver.js.map +1 -0
  38. package/esm/chart/layout/constraint/types.d.ts +21 -0
  39. package/esm/chart/layout/constraint/types.js +13 -0
  40. package/esm/chart/layout/constraint/types.js.map +1 -0
  41. package/esm/chart/layout/constraint/variable.d.ts +24 -0
  42. package/esm/chart/layout/constraint/variable.js +28 -0
  43. package/esm/chart/layout/constraint/variable.js.map +1 -0
  44. package/esm/chart/layout/padding-cal.js +2 -2
  45. package/esm/chart/layout/padding-cal.js.map +1 -1
  46. package/esm/chart/view.d.ts +41 -1
  47. package/esm/chart/view.js +65 -9
  48. package/esm/chart/view.js.map +1 -1
  49. package/esm/core.d.ts +1 -1
  50. package/esm/core.js +1 -1
  51. package/esm/core.js.map +1 -1
  52. package/esm/facet/facet.d.ts +5 -0
  53. package/esm/facet/facet.js +47 -12
  54. package/esm/facet/facet.js.map +1 -1
  55. package/esm/facet/tree.js +1 -1
  56. package/esm/facet/tree.js.map +1 -1
  57. package/esm/geometry/base.d.ts +34 -7
  58. package/esm/geometry/base.js +131 -74
  59. package/esm/geometry/base.js.map +1 -1
  60. package/esm/geometry/element/index.js.map +1 -1
  61. package/esm/geometry/heatmap.d.ts +1 -2
  62. package/esm/geometry/heatmap.js +13 -13
  63. package/esm/geometry/heatmap.js.map +1 -1
  64. package/esm/geometry/label/base.js +1 -1
  65. package/esm/geometry/label/base.js.map +1 -1
  66. package/esm/geometry/label/interface.js +1 -0
  67. package/esm/geometry/label/layout/interval/adjust-position.js.map +1 -1
  68. package/esm/geometry/label/layout/interval/hide-overlap.js.map +1 -1
  69. package/esm/geometry/label/layout/path/adjust-position.js.map +1 -1
  70. package/esm/geometry/label/layout/pie/distribute.js +1 -1
  71. package/esm/geometry/label/layout/pie/distribute.js.map +1 -1
  72. package/esm/geometry/label/layout/point/adjust-position.js.map +1 -1
  73. package/esm/geometry/label/pie.js +1 -2
  74. package/esm/geometry/label/pie.js.map +1 -1
  75. package/esm/geometry/path.d.ts +1 -2
  76. package/esm/geometry/path.js +46 -20
  77. package/esm/geometry/path.js.map +1 -1
  78. package/esm/geometry/shape/schema/index.js +1 -1
  79. package/esm/geometry/shape/schema/index.js.map +1 -1
  80. package/esm/geometry/util/diff.d.ts +11 -0
  81. package/esm/geometry/util/diff.js +30 -0
  82. package/esm/geometry/util/diff.js.map +1 -0
  83. package/esm/interface.d.ts +11 -10
  84. package/esm/interface.js +1 -0
  85. package/esm/interface.js.map +1 -1
  86. package/esm/theme/style-sheet/dark.d.ts +2 -2
  87. package/esm/theme/style-sheet/dark.js +2 -2
  88. package/esm/theme/style-sheet/dark.js.map +1 -1
  89. package/esm/theme/style-sheet/light.d.ts +2 -2
  90. package/esm/theme/style-sheet/light.js +2 -2
  91. package/esm/theme/style-sheet/light.js.map +1 -1
  92. package/esm/theme/util/create-by-style-sheet.js +1 -1
  93. package/esm/theme/util/create-by-style-sheet.js.map +1 -1
  94. package/esm/util/annotation.js +2 -0
  95. package/esm/util/annotation.js.map +1 -1
  96. package/esm/util/attr.js +2 -2
  97. package/esm/util/attr.js.map +1 -1
  98. package/esm/util/collision-detect.js +2 -2
  99. package/esm/util/collision-detect.js.map +1 -1
  100. package/esm/util/facet.js +1 -1
  101. package/esm/util/facet.js.map +1 -1
  102. package/esm/util/helper.d.ts +1 -1
  103. package/esm/util/helper.js +3 -3
  104. package/esm/util/helper.js.map +1 -1
  105. package/esm/util/legend.js +2 -1
  106. package/esm/util/legend.js.map +1 -1
  107. package/esm/util/padding.js +3 -3
  108. package/esm/util/padding.js.map +1 -1
  109. package/esm/util/scale.js +3 -4
  110. package/esm/util/scale.js.map +1 -1
  111. package/esm/util/stat.js +2 -2
  112. package/esm/util/stat.js.map +1 -1
  113. package/esm/util/text.js +2 -2
  114. package/esm/util/text.js.map +1 -1
  115. package/esm/util/types.js +1 -0
  116. package/lib/animate/animation/fade.js +3 -3
  117. package/lib/animate/animation/fade.js.map +1 -1
  118. package/lib/animate/animation/grow-in.js +3 -3
  119. package/lib/animate/animation/grow-in.js.map +1 -1
  120. package/lib/animate/animation/sector-path-update.js +11 -11
  121. package/lib/animate/animation/sector-path-update.js.map +1 -1
  122. package/lib/animate/animation/wave-in.js +2 -2
  123. package/lib/animate/animation/wave-in.js.map +1 -1
  124. package/lib/animate/animation/zoom.js +2 -2
  125. package/lib/animate/animation/zoom.js.map +1 -1
  126. package/lib/animate/index.js +10 -10
  127. package/lib/animate/index.js.map +1 -1
  128. package/lib/api.js +1 -1
  129. package/lib/api.js.map +1 -1
  130. package/lib/base.js +2 -2
  131. package/lib/base.js.map +1 -1
  132. package/lib/chart/chart.js +12 -14
  133. package/lib/chart/chart.js.map +1 -1
  134. package/lib/chart/controller/annotation.js +67 -97
  135. package/lib/chart/controller/annotation.js.map +1 -1
  136. package/lib/chart/controller/axis.js +64 -64
  137. package/lib/chart/controller/axis.js.map +1 -1
  138. package/lib/chart/controller/base.js +1 -1
  139. package/lib/chart/controller/base.js.map +1 -1
  140. package/lib/chart/controller/coordinate.js +6 -7
  141. package/lib/chart/controller/coordinate.js.map +1 -1
  142. package/lib/chart/controller/gesture.js +1 -1
  143. package/lib/chart/controller/gesture.js.map +1 -1
  144. package/lib/chart/controller/legend.js +45 -45
  145. package/lib/chart/controller/legend.js.map +1 -1
  146. package/lib/chart/controller/scrollbar.js +26 -30
  147. package/lib/chart/controller/scrollbar.js.map +1 -1
  148. package/lib/chart/controller/slider.js +25 -26
  149. package/lib/chart/controller/slider.js.map +1 -1
  150. package/lib/chart/controller/tooltip.js +45 -40
  151. package/lib/chart/controller/tooltip.js.map +1 -1
  152. package/lib/chart/index.js +7 -3
  153. package/lib/chart/index.js.map +1 -1
  154. package/lib/chart/layout/auto.js +6 -6
  155. package/lib/chart/layout/auto.js.map +1 -1
  156. package/lib/chart/layout/constraint/bounds.d.ts +32 -0
  157. package/lib/chart/layout/constraint/bounds.js +33 -0
  158. package/lib/chart/layout/constraint/bounds.js.map +1 -0
  159. package/lib/chart/layout/constraint/constraint.d.ts +31 -0
  160. package/lib/chart/layout/constraint/constraint.js +84 -0
  161. package/lib/chart/layout/constraint/constraint.js.map +1 -0
  162. package/lib/chart/layout/constraint/gauss.d.ts +11 -0
  163. package/lib/chart/layout/constraint/gauss.js +68 -0
  164. package/lib/chart/layout/constraint/gauss.js.map +1 -0
  165. package/lib/chart/layout/constraint/index.d.ts +5 -0
  166. package/lib/chart/layout/constraint/index.js +38 -0
  167. package/lib/chart/layout/constraint/index.js.map +1 -0
  168. package/lib/chart/layout/constraint/solver.d.ts +40 -0
  169. package/lib/chart/layout/constraint/solver.js +80 -0
  170. package/lib/chart/layout/constraint/solver.js.map +1 -0
  171. package/lib/chart/layout/constraint/types.d.ts +21 -0
  172. package/lib/chart/layout/constraint/types.js +16 -0
  173. package/lib/chart/layout/constraint/types.js.map +1 -0
  174. package/lib/chart/layout/constraint/variable.d.ts +24 -0
  175. package/lib/chart/layout/constraint/variable.js +31 -0
  176. package/lib/chart/layout/constraint/variable.js.map +1 -0
  177. package/lib/chart/layout/padding-cal.js +1 -1
  178. package/lib/chart/layout/padding-cal.js.map +1 -1
  179. package/lib/chart/util/scale-pool.js +12 -12
  180. package/lib/chart/util/scale-pool.js.map +1 -1
  181. package/lib/chart/view.d.ts +41 -1
  182. package/lib/chart/view.js +142 -86
  183. package/lib/chart/view.js.map +1 -1
  184. package/lib/component/labels.js +32 -32
  185. package/lib/component/labels.js.map +1 -1
  186. package/lib/component/update-label.js +4 -4
  187. package/lib/component/update-label.js.map +1 -1
  188. package/lib/core.d.ts +1 -1
  189. package/lib/core.js +8 -8
  190. package/lib/core.js.map +1 -1
  191. package/lib/dependents.js +1 -1
  192. package/lib/facet/circle.js +10 -10
  193. package/lib/facet/circle.js.map +1 -1
  194. package/lib/facet/facet.d.ts +5 -0
  195. package/lib/facet/facet.js +56 -21
  196. package/lib/facet/facet.js.map +1 -1
  197. package/lib/facet/index.js +7 -5
  198. package/lib/facet/index.js.map +1 -1
  199. package/lib/facet/list.js +9 -9
  200. package/lib/facet/list.js.map +1 -1
  201. package/lib/facet/matrix.js +13 -13
  202. package/lib/facet/matrix.js.map +1 -1
  203. package/lib/facet/mirror.js +10 -10
  204. package/lib/facet/mirror.js.map +1 -1
  205. package/lib/facet/rect.js +16 -16
  206. package/lib/facet/rect.js.map +1 -1
  207. package/lib/facet/tree.js +10 -10
  208. package/lib/facet/tree.js.map +1 -1
  209. package/lib/geometry/area.js +2 -2
  210. package/lib/geometry/area.js.map +1 -1
  211. package/lib/geometry/base.d.ts +34 -7
  212. package/lib/geometry/base.js +203 -146
  213. package/lib/geometry/base.js.map +1 -1
  214. package/lib/geometry/edge.js +2 -2
  215. package/lib/geometry/edge.js.map +1 -1
  216. package/lib/geometry/element/index.js +22 -22
  217. package/lib/geometry/element/index.js.map +1 -1
  218. package/lib/geometry/heatmap.d.ts +1 -2
  219. package/lib/geometry/heatmap.js +18 -18
  220. package/lib/geometry/heatmap.js.map +1 -1
  221. package/lib/geometry/interval.js +7 -7
  222. package/lib/geometry/interval.js.map +1 -1
  223. package/lib/geometry/label/base.js +33 -33
  224. package/lib/geometry/label/base.js.map +1 -1
  225. package/lib/geometry/label/interval.js +15 -15
  226. package/lib/geometry/label/interval.js.map +1 -1
  227. package/lib/geometry/label/layout/adjust-color.js +1 -1
  228. package/lib/geometry/label/layout/adjust-color.js.map +1 -1
  229. package/lib/geometry/label/layout/hide-overlap.js +3 -3
  230. package/lib/geometry/label/layout/hide-overlap.js.map +1 -1
  231. package/lib/geometry/label/layout/interval/adjust-position.js +2 -2
  232. package/lib/geometry/label/layout/interval/adjust-position.js.map +1 -1
  233. package/lib/geometry/label/layout/interval/hide-overlap.js +7 -7
  234. package/lib/geometry/label/layout/interval/hide-overlap.js.map +1 -1
  235. package/lib/geometry/label/layout/limit-in-canvas.js +2 -2
  236. package/lib/geometry/label/layout/limit-in-canvas.js.map +1 -1
  237. package/lib/geometry/label/layout/limit-in-plot.js +5 -5
  238. package/lib/geometry/label/layout/limit-in-plot.js.map +1 -1
  239. package/lib/geometry/label/layout/limit-in-shape.js +1 -1
  240. package/lib/geometry/label/layout/limit-in-shape.js.map +1 -1
  241. package/lib/geometry/label/layout/overlap.js +2 -2
  242. package/lib/geometry/label/layout/overlap.js.map +1 -1
  243. package/lib/geometry/label/layout/path/adjust-position.js +5 -5
  244. package/lib/geometry/label/layout/path/adjust-position.js.map +1 -1
  245. package/lib/geometry/label/layout/pie/distribute.js +8 -8
  246. package/lib/geometry/label/layout/pie/distribute.js.map +1 -1
  247. package/lib/geometry/label/layout/pie/outer.js +16 -16
  248. package/lib/geometry/label/layout/pie/outer.js.map +1 -1
  249. package/lib/geometry/label/layout/pie/spider.js +18 -18
  250. package/lib/geometry/label/layout/pie/spider.js.map +1 -1
  251. package/lib/geometry/label/layout/point/adjust-position.js +5 -5
  252. package/lib/geometry/label/layout/point/adjust-position.js.map +1 -1
  253. package/lib/geometry/label/pie.js +8 -9
  254. package/lib/geometry/label/pie.js.map +1 -1
  255. package/lib/geometry/label/polar.js +14 -14
  256. package/lib/geometry/label/polar.js.map +1 -1
  257. package/lib/geometry/label/util/index.js +4 -4
  258. package/lib/geometry/label/util/index.js.map +1 -1
  259. package/lib/geometry/line.js +2 -2
  260. package/lib/geometry/line.js.map +1 -1
  261. package/lib/geometry/path.d.ts +1 -2
  262. package/lib/geometry/path.js +50 -24
  263. package/lib/geometry/path.js.map +1 -1
  264. package/lib/geometry/point.js +3 -3
  265. package/lib/geometry/point.js.map +1 -1
  266. package/lib/geometry/polygon.js +5 -5
  267. package/lib/geometry/polygon.js.map +1 -1
  268. package/lib/geometry/schema.js +4 -4
  269. package/lib/geometry/schema.js.map +1 -1
  270. package/lib/geometry/shape/area/index.js +4 -4
  271. package/lib/geometry/shape/area/index.js.map +1 -1
  272. package/lib/geometry/shape/area/line.js +2 -2
  273. package/lib/geometry/shape/area/line.js.map +1 -1
  274. package/lib/geometry/shape/area/smooth-line.js +2 -2
  275. package/lib/geometry/shape/area/smooth-line.js.map +1 -1
  276. package/lib/geometry/shape/area/smooth.js +2 -2
  277. package/lib/geometry/shape/area/smooth.js.map +1 -1
  278. package/lib/geometry/shape/area/util.js +5 -5
  279. package/lib/geometry/shape/area/util.js.map +1 -1
  280. package/lib/geometry/shape/base.js +11 -11
  281. package/lib/geometry/shape/base.js.map +1 -1
  282. package/lib/geometry/shape/edge/arc.js +11 -11
  283. package/lib/geometry/shape/edge/arc.js.map +1 -1
  284. package/lib/geometry/shape/edge/index.js +6 -6
  285. package/lib/geometry/shape/edge/index.js.map +1 -1
  286. package/lib/geometry/shape/edge/smooth.js +4 -4
  287. package/lib/geometry/shape/edge/smooth.js.map +1 -1
  288. package/lib/geometry/shape/edge/util.js +1 -1
  289. package/lib/geometry/shape/edge/util.js.map +1 -1
  290. package/lib/geometry/shape/edge/vhv.js +4 -4
  291. package/lib/geometry/shape/edge/vhv.js.map +1 -1
  292. package/lib/geometry/shape/interval/funnel.js +5 -5
  293. package/lib/geometry/shape/interval/funnel.js.map +1 -1
  294. package/lib/geometry/shape/interval/hollow-rect.js +7 -7
  295. package/lib/geometry/shape/interval/hollow-rect.js.map +1 -1
  296. package/lib/geometry/shape/interval/index.js +10 -10
  297. package/lib/geometry/shape/interval/index.js.map +1 -1
  298. package/lib/geometry/shape/interval/line.js +7 -7
  299. package/lib/geometry/shape/interval/line.js.map +1 -1
  300. package/lib/geometry/shape/interval/pyramid.js +5 -5
  301. package/lib/geometry/shape/interval/pyramid.js.map +1 -1
  302. package/lib/geometry/shape/interval/tick.js +4 -4
  303. package/lib/geometry/shape/interval/tick.js.map +1 -1
  304. package/lib/geometry/shape/interval/util.js +8 -8
  305. package/lib/geometry/shape/interval/util.js.map +1 -1
  306. package/lib/geometry/shape/line/index.js +11 -11
  307. package/lib/geometry/shape/line/index.js.map +1 -1
  308. package/lib/geometry/shape/line/step.js +7 -7
  309. package/lib/geometry/shape/line/step.js.map +1 -1
  310. package/lib/geometry/shape/point/hollow.js +3 -3
  311. package/lib/geometry/shape/point/hollow.js.map +1 -1
  312. package/lib/geometry/shape/point/image.js +2 -2
  313. package/lib/geometry/shape/point/image.js.map +1 -1
  314. package/lib/geometry/shape/point/index.js +5 -5
  315. package/lib/geometry/shape/point/index.js.map +1 -1
  316. package/lib/geometry/shape/point/solid.js +3 -3
  317. package/lib/geometry/shape/point/solid.js.map +1 -1
  318. package/lib/geometry/shape/point/util.js +3 -3
  319. package/lib/geometry/shape/point/util.js.map +1 -1
  320. package/lib/geometry/shape/polygon/index.js +7 -7
  321. package/lib/geometry/shape/polygon/index.js.map +1 -1
  322. package/lib/geometry/shape/polygon/square.js +5 -5
  323. package/lib/geometry/shape/polygon/square.js.map +1 -1
  324. package/lib/geometry/shape/schema/box.js +6 -6
  325. package/lib/geometry/shape/schema/box.js.map +1 -1
  326. package/lib/geometry/shape/schema/candle.js +5 -5
  327. package/lib/geometry/shape/schema/candle.js.map +1 -1
  328. package/lib/geometry/shape/schema/index.js +2 -2
  329. package/lib/geometry/shape/schema/index.js.map +1 -1
  330. package/lib/geometry/shape/util/get-path-points.js +4 -4
  331. package/lib/geometry/shape/util/get-path-points.js.map +1 -1
  332. package/lib/geometry/shape/util/get-style.js +4 -4
  333. package/lib/geometry/shape/util/get-style.js.map +1 -1
  334. package/lib/geometry/shape/util/path.js +7 -6
  335. package/lib/geometry/shape/util/path.js.map +1 -1
  336. package/lib/geometry/shape/util/split-points.js +2 -2
  337. package/lib/geometry/shape/util/split-points.js.map +1 -1
  338. package/lib/geometry/shape/violin/hollow.js +8 -8
  339. package/lib/geometry/shape/violin/hollow.js.map +1 -1
  340. package/lib/geometry/shape/violin/index.js +9 -9
  341. package/lib/geometry/shape/violin/index.js.map +1 -1
  342. package/lib/geometry/shape/violin/smooth.js +4 -4
  343. package/lib/geometry/shape/violin/smooth.js.map +1 -1
  344. package/lib/geometry/util/diff.d.ts +11 -0
  345. package/lib/geometry/util/diff.js +34 -0
  346. package/lib/geometry/util/diff.js.map +1 -0
  347. package/lib/geometry/util/get-shape-type.js +1 -1
  348. package/lib/geometry/util/get-shape-type.js.map +1 -1
  349. package/lib/geometry/util/group-data.js +1 -1
  350. package/lib/geometry/util/group-data.js.map +1 -1
  351. package/lib/geometry/util/is-model-change.js +2 -2
  352. package/lib/geometry/util/is-model-change.js.map +1 -1
  353. package/lib/geometry/util/parse-fields.js +1 -1
  354. package/lib/geometry/util/parse-fields.js.map +1 -1
  355. package/lib/geometry/util/shape-size.js +9 -9
  356. package/lib/geometry/util/shape-size.js.map +1 -1
  357. package/lib/geometry/violin.js +5 -5
  358. package/lib/geometry/violin.js.map +1 -1
  359. package/lib/index.js +193 -193
  360. package/lib/index.js.map +1 -1
  361. package/lib/interaction/action/active-region.js +19 -19
  362. package/lib/interaction/action/active-region.js.map +1 -1
  363. package/lib/interaction/action/base.js +1 -1
  364. package/lib/interaction/action/base.js.map +1 -1
  365. package/lib/interaction/action/callback.js +2 -2
  366. package/lib/interaction/action/callback.js.map +1 -1
  367. package/lib/interaction/action/component/list-active.js +2 -2
  368. package/lib/interaction/action/component/list-active.js.map +1 -1
  369. package/lib/interaction/action/component/list-checked.js +5 -5
  370. package/lib/interaction/action/component/list-checked.js.map +1 -1
  371. package/lib/interaction/action/component/list-highlight-util.js +1 -1
  372. package/lib/interaction/action/component/list-highlight-util.js.map +1 -1
  373. package/lib/interaction/action/component/list-highlight.js +7 -7
  374. package/lib/interaction/action/component/list-highlight.js.map +1 -1
  375. package/lib/interaction/action/component/list-selected.js +2 -2
  376. package/lib/interaction/action/component/list-selected.js.map +1 -1
  377. package/lib/interaction/action/component/list-state.js +15 -15
  378. package/lib/interaction/action/component/list-state.js.map +1 -1
  379. package/lib/interaction/action/component/list-unchecked.js +2 -2
  380. package/lib/interaction/action/component/list-unchecked.js.map +1 -1
  381. package/lib/interaction/action/component/tooltip/ellipsis-text.js +6 -6
  382. package/lib/interaction/action/component/tooltip/ellipsis-text.js.map +1 -1
  383. package/lib/interaction/action/component/tooltip/geometry.js +4 -4
  384. package/lib/interaction/action/component/tooltip/geometry.js.map +1 -1
  385. package/lib/interaction/action/component/tooltip/sibling.js +7 -7
  386. package/lib/interaction/action/component/tooltip/sibling.js.map +1 -1
  387. package/lib/interaction/action/cursor.js +2 -2
  388. package/lib/interaction/action/cursor.js.map +1 -1
  389. package/lib/interaction/action/data/filter.js +7 -7
  390. package/lib/interaction/action/data/filter.js.map +1 -1
  391. package/lib/interaction/action/data/range-filter.js +3 -3
  392. package/lib/interaction/action/data/range-filter.js.map +1 -1
  393. package/lib/interaction/action/data/sibling-filter.js +6 -6
  394. package/lib/interaction/action/data/sibling-filter.js.map +1 -1
  395. package/lib/interaction/action/element/active.js +2 -2
  396. package/lib/interaction/action/element/active.js.map +1 -1
  397. package/lib/interaction/action/element/filter.js +16 -16
  398. package/lib/interaction/action/element/filter.js.map +1 -1
  399. package/lib/interaction/action/element/highlight-by-color.js +5 -5
  400. package/lib/interaction/action/element/highlight-by-color.js.map +1 -1
  401. package/lib/interaction/action/element/highlight-by-x.js +6 -6
  402. package/lib/interaction/action/element/highlight-by-x.js.map +1 -1
  403. package/lib/interaction/action/element/highlight-util.js +3 -3
  404. package/lib/interaction/action/element/highlight-util.js.map +1 -1
  405. package/lib/interaction/action/element/highlight.js +8 -8
  406. package/lib/interaction/action/element/highlight.js.map +1 -1
  407. package/lib/interaction/action/element/link-by-color.js +9 -9
  408. package/lib/interaction/action/element/link-by-color.js.map +1 -1
  409. package/lib/interaction/action/element/range-active.js +2 -2
  410. package/lib/interaction/action/element/range-active.js.map +1 -1
  411. package/lib/interaction/action/element/range-highlight.js +4 -4
  412. package/lib/interaction/action/element/range-highlight.js.map +1 -1
  413. package/lib/interaction/action/element/range-selected.js +2 -2
  414. package/lib/interaction/action/element/range-selected.js.map +1 -1
  415. package/lib/interaction/action/element/range-state.js +18 -18
  416. package/lib/interaction/action/element/range-state.js.map +1 -1
  417. package/lib/interaction/action/element/selected.js +2 -2
  418. package/lib/interaction/action/element/selected.js.map +1 -1
  419. package/lib/interaction/action/element/sibling-filter.js +18 -18
  420. package/lib/interaction/action/element/sibling-filter.js.map +1 -1
  421. package/lib/interaction/action/element/single-active.js +2 -2
  422. package/lib/interaction/action/element/single-active.js.map +1 -1
  423. package/lib/interaction/action/element/single-highlight.js +5 -5
  424. package/lib/interaction/action/element/single-highlight.js.map +1 -1
  425. package/lib/interaction/action/element/single-selected.js +2 -2
  426. package/lib/interaction/action/element/single-selected.js.map +1 -1
  427. package/lib/interaction/action/element/single-state.js +5 -5
  428. package/lib/interaction/action/element/single-state.js.map +1 -1
  429. package/lib/interaction/action/element/state-base.js +4 -4
  430. package/lib/interaction/action/element/state-base.js.map +1 -1
  431. package/lib/interaction/action/element/state.js +13 -13
  432. package/lib/interaction/action/element/state.js.map +1 -1
  433. package/lib/interaction/action/index.js +5 -1
  434. package/lib/interaction/action/index.js.map +1 -1
  435. package/lib/interaction/action/mask/base.js +5 -5
  436. package/lib/interaction/action/mask/base.js.map +1 -1
  437. package/lib/interaction/action/mask/circle.js +4 -4
  438. package/lib/interaction/action/mask/circle.js.map +1 -1
  439. package/lib/interaction/action/mask/dim-rect.js +6 -6
  440. package/lib/interaction/action/mask/dim-rect.js.map +1 -1
  441. package/lib/interaction/action/mask/path.js +3 -3
  442. package/lib/interaction/action/mask/path.js.map +1 -1
  443. package/lib/interaction/action/mask/rect.js +4 -4
  444. package/lib/interaction/action/mask/rect.js.map +1 -1
  445. package/lib/interaction/action/mask/smooth-path.js +3 -3
  446. package/lib/interaction/action/mask/smooth-path.js.map +1 -1
  447. package/lib/interaction/action/register.js +2 -2
  448. package/lib/interaction/action/register.js.map +1 -1
  449. package/lib/interaction/action/util.js +13 -13
  450. package/lib/interaction/action/util.js.map +1 -1
  451. package/lib/interaction/action/view/button.js +6 -6
  452. package/lib/interaction/action/view/button.js.map +1 -1
  453. package/lib/interaction/action/view/drag.js +3 -3
  454. package/lib/interaction/action/view/drag.js.map +1 -1
  455. package/lib/interaction/action/view/move.js +2 -2
  456. package/lib/interaction/action/view/move.js.map +1 -1
  457. package/lib/interaction/action/view/scale-transform.js +1 -1
  458. package/lib/interaction/action/view/scale-transform.js.map +1 -1
  459. package/lib/interaction/action/view/scale-translate.js +4 -4
  460. package/lib/interaction/action/view/scale-translate.js.map +1 -1
  461. package/lib/interaction/action/view/scale-zoom.js +3 -3
  462. package/lib/interaction/action/view/scale-zoom.js.map +1 -1
  463. package/lib/interaction/context.js +5 -5
  464. package/lib/interaction/context.js.map +1 -1
  465. package/lib/interaction/grammar-interaction.js +20 -20
  466. package/lib/interaction/grammar-interaction.js.map +1 -1
  467. package/lib/interaction/index.js +7 -7
  468. package/lib/interaction/index.js.map +1 -1
  469. package/lib/interface.d.ts +11 -10
  470. package/lib/interface.js.map +1 -1
  471. package/lib/theme/index.js +3 -3
  472. package/lib/theme/index.js.map +1 -1
  473. package/lib/theme/style-sheet/dark.d.ts +2 -2
  474. package/lib/theme/style-sheet/dark.js +5 -4
  475. package/lib/theme/style-sheet/dark.js.map +1 -1
  476. package/lib/theme/style-sheet/light.d.ts +2 -2
  477. package/lib/theme/style-sheet/light.js +5 -4
  478. package/lib/theme/style-sheet/light.js.map +1 -1
  479. package/lib/theme/util/create-by-style-sheet.js +12 -12
  480. package/lib/theme/util/create-by-style-sheet.js.map +1 -1
  481. package/lib/theme/util/create-theme.js +3 -3
  482. package/lib/theme/util/create-theme.js.map +1 -1
  483. package/lib/theme/util/index.js +1 -0
  484. package/lib/theme/util/index.js.map +1 -1
  485. package/lib/util/annotation.js +4 -2
  486. package/lib/util/annotation.js.map +1 -1
  487. package/lib/util/attr.js +1 -1
  488. package/lib/util/attr.js.map +1 -1
  489. package/lib/util/axis.js +8 -8
  490. package/lib/util/axis.js.map +1 -1
  491. package/lib/util/bbox.js +4 -3
  492. package/lib/util/bbox.js.map +1 -1
  493. package/lib/util/collision-detect.js +1 -1
  494. package/lib/util/collision-detect.js.map +1 -1
  495. package/lib/util/color.js +3 -2
  496. package/lib/util/color.js.map +1 -1
  497. package/lib/util/coordinate.js +5 -5
  498. package/lib/util/coordinate.js.map +1 -1
  499. package/lib/util/dom.js +1 -1
  500. package/lib/util/facet.js +1 -1
  501. package/lib/util/facet.js.map +1 -1
  502. package/lib/util/graphics.js +5 -5
  503. package/lib/util/graphics.js.map +1 -1
  504. package/lib/util/grid.js +5 -5
  505. package/lib/util/grid.js.map +1 -1
  506. package/lib/util/helper.d.ts +1 -1
  507. package/lib/util/helper.js +5 -5
  508. package/lib/util/helper.js.map +1 -1
  509. package/lib/util/legend.js +19 -18
  510. package/lib/util/legend.js.map +1 -1
  511. package/lib/util/padding.js +4 -4
  512. package/lib/util/padding.js.map +1 -1
  513. package/lib/util/scale.js +11 -12
  514. package/lib/util/scale.js.map +1 -1
  515. package/lib/util/stat.js +3 -3
  516. package/lib/util/stat.js.map +1 -1
  517. package/lib/util/text.js +12 -11
  518. package/lib/util/text.js.map +1 -1
  519. package/lib/util/tooltip.js +21 -21
  520. package/lib/util/tooltip.js.map +1 -1
  521. package/package.json +21 -27
  522. package/src/chart/controller/annotation.ts +14 -7
  523. package/src/chart/controller/tooltip.ts +11 -1
  524. package/src/chart/layout/constraint/bounds.ts +52 -0
  525. package/src/chart/layout/constraint/constraint.ts +98 -0
  526. package/src/chart/layout/constraint/gauss.ts +71 -0
  527. package/src/chart/layout/constraint/index.ts +30 -0
  528. package/src/chart/layout/constraint/solver.ts +98 -0
  529. package/src/chart/layout/constraint/types.ts +29 -0
  530. package/src/chart/layout/constraint/variable.ts +33 -0
  531. package/src/chart/view.ts +70 -5
  532. package/src/core.ts +1 -1
  533. package/src/facet/facet.ts +50 -20
  534. package/src/geometry/base.ts +133 -60
  535. package/src/geometry/heatmap.ts +17 -18
  536. package/src/geometry/path.ts +48 -22
  537. package/src/geometry/util/diff.ts +29 -0
  538. package/src/interface.ts +8 -6
  539. package/src/theme/style-sheet/dark.ts +2 -2
  540. package/src/theme/style-sheet/light.ts +2 -2
  541. package/src/util/annotation.ts +3 -1
  542. package/src/util/helper.ts +3 -3
  543. package/src/util/legend.ts +7 -4
package/lib/chart/view.js CHANGED
@@ -4,7 +4,7 @@ exports.registerGeometry = exports.View = void 0;
4
4
  var tslib_1 = require("tslib");
5
5
  var util_1 = require("@antv/util");
6
6
  var constant_1 = require("../constant");
7
- var base_1 = tslib_1.__importDefault(require("../base"));
7
+ var base_1 = (0, tslib_1.__importDefault)(require("../base"));
8
8
  var facet_1 = require("../facet");
9
9
  var interaction_1 = require("../interaction");
10
10
  var theme_1 = require("../theme");
@@ -16,9 +16,9 @@ var padding_1 = require("../util/padding");
16
16
  var scale_1 = require("../util/scale");
17
17
  var util_2 = require("../theme/util");
18
18
  var controller_1 = require("./controller");
19
- var coordinate_2 = tslib_1.__importDefault(require("./controller/coordinate"));
20
- var event_1 = tslib_1.__importDefault(require("./event"));
21
- var layout_1 = tslib_1.__importDefault(require("./layout"));
19
+ var coordinate_2 = (0, tslib_1.__importDefault)(require("./controller/coordinate"));
20
+ var event_1 = (0, tslib_1.__importDefault)(require("./event"));
21
+ var layout_1 = (0, tslib_1.__importDefault)(require("./layout"));
22
22
  var scale_pool_1 = require("./util/scale-pool");
23
23
  var padding_cal_1 = require("./layout/padding-cal");
24
24
  var auto_1 = require("./layout/auto");
@@ -27,7 +27,7 @@ var sync_view_padding_1 = require("./util/sync-view-padding");
27
27
  * G2 视图 View 类
28
28
  */
29
29
  var View = /** @class */ (function (_super) {
30
- tslib_1.__extends(View, _super);
30
+ (0, tslib_1.__extends)(View, _super);
31
31
  function View(props) {
32
32
  var _this = _super.call(this, { visible: props.visible }) || this;
33
33
  /** 所有的子 view。 */
@@ -43,10 +43,10 @@ var View = /** @class */ (function (_super) {
43
43
  // 配置信息存储
44
44
  _this.options = {
45
45
  data: [],
46
- animate: true,
46
+ animate: true, // 默认开启动画
47
47
  }; // 初始化为空
48
48
  /** 配置开启的组件插件,默认为全局配置的组件。 */
49
- _this.usedControllers = controller_1.getComponentControllerNames();
49
+ _this.usedControllers = (0, controller_1.getComponentControllerNames)();
50
50
  /** 所有的 scales */
51
51
  _this.scalePool = new scale_pool_1.ScalePool();
52
52
  /** 布局函数 */
@@ -96,7 +96,7 @@ var View = /** @class */ (function (_super) {
96
96
  // });
97
97
  // }
98
98
  };
99
- var _a = props.id, id = _a === void 0 ? util_1.uniqueId('view') : _a, parent = props.parent, canvas = props.canvas, backgroundGroup = props.backgroundGroup, middleGroup = props.middleGroup, foregroundGroup = props.foregroundGroup, _b = props.region, region = _b === void 0 ? { start: { x: 0, y: 0 }, end: { x: 1, y: 1 } } : _b, padding = props.padding, appendPadding = props.appendPadding, theme = props.theme, options = props.options, limitInPlot = props.limitInPlot, syncViewPadding = props.syncViewPadding;
99
+ var _a = props.id, id = _a === void 0 ? (0, util_1.uniqueId)('view') : _a, parent = props.parent, canvas = props.canvas, backgroundGroup = props.backgroundGroup, middleGroup = props.middleGroup, foregroundGroup = props.foregroundGroup, _b = props.region, region = _b === void 0 ? { start: { x: 0, y: 0 }, end: { x: 1, y: 1 } } : _b, padding = props.padding, appendPadding = props.appendPadding, theme = props.theme, options = props.options, limitInPlot = props.limitInPlot, syncViewPadding = props.syncViewPadding;
100
100
  _this.parent = parent;
101
101
  _this.canvas = canvas;
102
102
  _this.backgroundGroup = backgroundGroup;
@@ -106,12 +106,12 @@ var View = /** @class */ (function (_super) {
106
106
  _this.padding = padding;
107
107
  _this.appendPadding = appendPadding;
108
108
  // 接受父 view 传入的参数
109
- _this.options = tslib_1.__assign(tslib_1.__assign({}, _this.options), options);
109
+ _this.options = (0, tslib_1.__assign)((0, tslib_1.__assign)({}, _this.options), options);
110
110
  _this.limitInPlot = limitInPlot;
111
111
  _this.id = id;
112
112
  _this.syncViewPadding = syncViewPadding;
113
113
  // 初始化 theme
114
- _this.themeObject = util_1.isObject(theme) ? util_1.deepMix({}, theme_1.getTheme('default'), util_2.createTheme(theme)) : theme_1.getTheme(theme);
114
+ _this.themeObject = (0, util_1.isObject)(theme) ? (0, util_1.deepMix)({}, (0, theme_1.getTheme)('default'), (0, util_2.createTheme)(theme)) : (0, theme_1.getTheme)(theme);
115
115
  _this.init();
116
116
  return _this;
117
117
  }
@@ -171,6 +171,7 @@ var View = /** @class */ (function (_super) {
171
171
  geometries[i].clear();
172
172
  // view 中使用 geometry 的时候,还需要清空它的容器,不然下一次 chart.geometry() 的时候,又创建了一个,导致泄露, #2799。
173
173
  geometries[i].container.remove(true);
174
+ geometries[i].labelsContainer.remove(true);
174
175
  }
175
176
  this.geometries = [];
176
177
  // 3. 清空 controllers
@@ -205,7 +206,7 @@ var View = /** @class */ (function (_super) {
205
206
  this.emit(constant_1.VIEW_LIFE_CIRCLE.BEFORE_DESTROY);
206
207
  var interactions = this.interactions;
207
208
  // 销毁 interactions
208
- util_1.each(interactions, function (interaction) {
209
+ (0, util_1.each)(interactions, function (interaction) {
209
210
  if (interaction) {
210
211
  // 有可能已经销毁,设置了 undefined
211
212
  interaction.destroy();
@@ -259,7 +260,7 @@ var View = /** @class */ (function (_super) {
259
260
  * @returns View
260
261
  */
261
262
  View.prototype.data = function (data) {
262
- util_1.set(this.options, 'data', data);
263
+ (0, util_1.set)(this.options, 'data', data);
263
264
  this.isDataChanged = true;
264
265
  return this;
265
266
  };
@@ -286,33 +287,33 @@ var View = /** @class */ (function (_super) {
286
287
  * @returns View
287
288
  */
288
289
  View.prototype.filter = function (field, condition) {
289
- if (util_1.isFunction(condition)) {
290
- util_1.set(this.options, ['filters', field], condition);
290
+ if ((0, util_1.isFunction)(condition)) {
291
+ (0, util_1.set)(this.options, ['filters', field], condition);
291
292
  return this;
292
293
  }
293
294
  // condition 为空,则表示删除过滤条件
294
- if (!condition && util_1.get(this.options, ['filters', field])) {
295
+ if (!condition && (0, util_1.get)(this.options, ['filters', field])) {
295
296
  delete this.options.filters[field];
296
297
  }
297
298
  return this;
298
299
  };
299
300
  View.prototype.axis = function (field, axisOption) {
300
- if (util_1.isBoolean(field)) {
301
- util_1.set(this.options, ['axes'], field);
301
+ if ((0, util_1.isBoolean)(field)) {
302
+ (0, util_1.set)(this.options, ['axes'], field);
302
303
  }
303
304
  else {
304
- util_1.set(this.options, ['axes', field], axisOption);
305
+ (0, util_1.set)(this.options, ['axes', field], axisOption);
305
306
  }
306
307
  return this;
307
308
  };
308
309
  View.prototype.legend = function (field, legendOption) {
309
- if (util_1.isBoolean(field)) {
310
- util_1.set(this.options, ['legends'], field);
310
+ if ((0, util_1.isBoolean)(field)) {
311
+ (0, util_1.set)(this.options, ['legends'], field);
311
312
  }
312
- else if (util_1.isString(field)) {
313
- util_1.set(this.options, ['legends', field], legendOption);
314
- if (util_1.isPlainObject(legendOption) && (legendOption === null || legendOption === void 0 ? void 0 : legendOption.selected)) {
315
- util_1.set(this.options, ['filters', field], function (name) {
313
+ else if ((0, util_1.isString)(field)) {
314
+ (0, util_1.set)(this.options, ['legends', field], legendOption);
315
+ if ((0, util_1.isPlainObject)(legendOption) && (legendOption === null || legendOption === void 0 ? void 0 : legendOption.selected)) {
316
+ (0, util_1.set)(this.options, ['filters', field], function (name) {
316
317
  var _a;
317
318
  return (_a = legendOption === null || legendOption === void 0 ? void 0 : legendOption.selected[name]) !== null && _a !== void 0 ? _a : true;
318
319
  });
@@ -320,18 +321,18 @@ var View = /** @class */ (function (_super) {
320
321
  }
321
322
  else {
322
323
  // 设置全局的 legend 配置
323
- util_1.set(this.options, ['legends'], field);
324
+ (0, util_1.set)(this.options, ['legends'], field);
324
325
  }
325
326
  return this;
326
327
  };
327
328
  View.prototype.scale = function (field, scaleOption) {
328
329
  var _this = this;
329
- if (util_1.isString(field)) {
330
- util_1.set(this.options, ['scales', field], scaleOption);
330
+ if ((0, util_1.isString)(field)) {
331
+ (0, util_1.set)(this.options, ['scales', field], scaleOption);
331
332
  }
332
- else if (util_1.isObject(field)) {
333
- util_1.each(field, function (v, k) {
334
- util_1.set(_this.options, ['scales', k], v);
333
+ else if ((0, util_1.isObject)(field)) {
334
+ (0, util_1.each)(field, function (v, k) {
335
+ (0, util_1.set)(_this.options, ['scales', k], v);
335
336
  });
336
337
  }
337
338
  return this;
@@ -351,7 +352,7 @@ var View = /** @class */ (function (_super) {
351
352
  * @returns View
352
353
  */
353
354
  View.prototype.tooltip = function (cfg) {
354
- util_1.set(this.options, 'tooltip', cfg);
355
+ (0, util_1.set)(this.options, 'tooltip', cfg);
355
356
  return this;
356
357
  };
357
358
  /**
@@ -384,11 +385,11 @@ var View = /** @class */ (function (_super) {
384
385
  };
385
386
  View.prototype.coordinate = function (type, coordinateCfg) {
386
387
  // 提供语法糖,使用更简单
387
- if (util_1.isString(type)) {
388
- util_1.set(this.options, 'coordinate', { type: type, cfg: coordinateCfg });
388
+ if ((0, util_1.isString)(type)) {
389
+ (0, util_1.set)(this.options, 'coordinate', { type: type, cfg: coordinateCfg });
389
390
  }
390
391
  else {
391
- util_1.set(this.options, 'coordinate', type);
392
+ (0, util_1.set)(this.options, 'coordinate', type);
392
393
  }
393
394
  // 更新 coordinate 配置
394
395
  this.coordinateController.update(this.options.coordinate);
@@ -426,11 +427,11 @@ var View = /** @class */ (function (_super) {
426
427
  this.facetInstance.destroy();
427
428
  }
428
429
  // 创建新的分面
429
- var Ctor = facet_1.getFacet(type);
430
+ var Ctor = (0, facet_1.getFacet)(type);
430
431
  if (!Ctor) {
431
432
  throw new Error("facet '" + type + "' is not exist!");
432
433
  }
433
- this.facetInstance = new Ctor(this, tslib_1.__assign(tslib_1.__assign({}, cfg), { type: type }));
434
+ this.facetInstance = new Ctor(this, (0, tslib_1.__assign)((0, tslib_1.__assign)({}, cfg), { type: type }));
434
435
  return this;
435
436
  };
436
437
  /*
@@ -444,7 +445,7 @@ var View = /** @class */ (function (_super) {
444
445
  * @returns View
445
446
  */
446
447
  View.prototype.animate = function (status) {
447
- util_1.set(this.options, 'animate', status);
448
+ (0, util_1.set)(this.options, 'animate', status);
448
449
  return this;
449
450
  };
450
451
  /**
@@ -453,7 +454,7 @@ var View = /** @class */ (function (_super) {
453
454
  */
454
455
  View.prototype.updateOptions = function (options) {
455
456
  this.clear(); // 清空
456
- util_1.mix(this.options, options);
457
+ (0, util_1.mix)(this.options, options);
457
458
  // 需要把已存在的 view 销毁,否则会重复创建
458
459
  // 目前针对配置项还没有特别好的 view 更新机制,为了不影响主流流程,所以在这里直接销毁
459
460
  this.views.forEach(function (view) { return view.destroy(); });
@@ -476,7 +477,7 @@ var View = /** @class */ (function (_super) {
476
477
  throw new Error("Can't use built in variable name \"" + name + "\", please change another one.");
477
478
  }
478
479
  // 存入到 option 中
479
- util_1.set(this.options, name, opt);
480
+ (0, util_1.set)(this.options, name, opt);
480
481
  return this;
481
482
  };
482
483
  /**
@@ -492,7 +493,7 @@ var View = /** @class */ (function (_super) {
492
493
  * @returns View
493
494
  */
494
495
  View.prototype.theme = function (theme) {
495
- this.themeObject = util_1.isObject(theme) ? util_1.deepMix({}, this.themeObject, util_2.createTheme(theme)) : theme_1.getTheme(theme);
496
+ this.themeObject = (0, util_1.isObject)(theme) ? (0, util_1.deepMix)({}, this.themeObject, (0, util_2.createTheme)(theme)) : (0, theme_1.getTheme)(theme);
496
497
  return this;
497
498
  };
498
499
  /* end 一系列传入配置的 API */
@@ -514,7 +515,7 @@ var View = /** @class */ (function (_super) {
514
515
  existInteraction.destroy();
515
516
  }
516
517
  // 新建交互实例
517
- var interaction = interaction_1.createInteraction(name, this, cfg);
518
+ var interaction = (0, interaction_1.createInteraction)(name, this, cfg);
518
519
  if (interaction) {
519
520
  interaction.init();
520
521
  this.interactions[name] = interaction;
@@ -587,17 +588,17 @@ var View = /** @class */ (function (_super) {
587
588
  // 子 view 共享 options 配置数据
588
589
  var sharedOptions = {
589
590
  data: this.options.data,
590
- scales: util_1.clone(this.options.scales),
591
- axes: util_1.clone(this.options.axes),
592
- coordinate: util_1.clone(this.coordinateController.getOption()),
593
- tooltip: util_1.clone(this.options.tooltip),
594
- legends: util_1.clone(this.options.legends),
591
+ scales: (0, util_1.clone)(this.options.scales),
592
+ axes: (0, util_1.clone)(this.options.axes),
593
+ coordinate: (0, util_1.clone)(this.coordinateController.getOption()),
594
+ tooltip: (0, util_1.clone)(this.options.tooltip),
595
+ legends: (0, util_1.clone)(this.options.legends),
595
596
  animate: this.options.animate,
596
597
  visible: this.visible,
597
598
  };
598
- var v = new View(tslib_1.__assign(tslib_1.__assign({ parent: this, canvas: this.canvas,
599
+ var v = new View((0, tslib_1.__assign)((0, tslib_1.__assign)({ parent: this, canvas: this.canvas,
599
600
  // 子 view 共用三层 group
600
- backgroundGroup: this.backgroundGroup.addGroup({ zIndex: constant_1.GROUP_Z_INDEX.BG }), middleGroup: this.middleGroup.addGroup({ zIndex: constant_1.GROUP_Z_INDEX.MID }), foregroundGroup: this.foregroundGroup.addGroup({ zIndex: constant_1.GROUP_Z_INDEX.FORE }), theme: this.themeObject, padding: this.padding }, cfg), { options: tslib_1.__assign(tslib_1.__assign({}, sharedOptions), util_1.get(cfg, 'options', {})) }));
601
+ backgroundGroup: this.backgroundGroup.addGroup({ zIndex: constant_1.GROUP_Z_INDEX.BG }), middleGroup: this.middleGroup.addGroup({ zIndex: constant_1.GROUP_Z_INDEX.MID }), foregroundGroup: this.foregroundGroup.addGroup({ zIndex: constant_1.GROUP_Z_INDEX.FORE }), theme: this.themeObject, padding: this.padding }, cfg), { options: (0, tslib_1.__assign)((0, tslib_1.__assign)({}, sharedOptions), (0, util_1.get)(cfg, 'options', {})) }));
601
602
  this.views.push(v);
602
603
  return v;
603
604
  };
@@ -615,7 +616,7 @@ var View = /** @class */ (function (_super) {
615
616
  * @return removedView
616
617
  */
617
618
  View.prototype.removeView = function (view) {
618
- var removedView = util_1.remove(this.views, function (v) { return v === view; })[0];
619
+ var removedView = (0, util_1.remove)(this.views, function (v) { return v === view; })[0];
619
620
  if (removedView) {
620
621
  removedView.destroy();
621
622
  }
@@ -654,14 +655,16 @@ var View = /** @class */ (function (_super) {
654
655
  View.prototype.getYScales = function () {
655
656
  // 拿到所有的 Geometry 的 Y scale,然后去重
656
657
  var tmpMap = {};
657
- return this.geometries.map(function (g) {
658
+ var yScales = [];
659
+ this.geometries.forEach(function (g) {
658
660
  var yScale = g.getYScale();
659
661
  var field = yScale.field;
660
662
  if (!tmpMap[field]) {
661
663
  tmpMap[field] = true;
662
- return yScale;
664
+ yScales.push(yScale);
663
665
  }
664
666
  });
667
+ return yScales;
665
668
  };
666
669
  /**
667
670
  * 获取 x 轴或者 y 轴对应的所有 scale 实例。
@@ -685,11 +688,18 @@ var View = /** @class */ (function (_super) {
685
688
  * @param field 数据字段名称
686
689
  * @param key id
687
690
  */
688
- View.prototype.getScaleByField = function (field, key) {
691
+ View.prototype.getScale = function (field, key) {
689
692
  var defaultKey = key ? key : this.getScaleKey(field);
690
693
  // 调用根节点 view 的方法获取
691
694
  return this.getRootView().scalePool.getScale(defaultKey);
692
695
  };
696
+ /**
697
+ * @deprecated
698
+ * This method will be removed at G2 V4.1. Please use `getScale`.
699
+ */
700
+ View.prototype.getScaleByField = function (field, key) {
701
+ return this.getScale(field, key);
702
+ };
693
703
  /**
694
704
  * 返回所有配置信息。
695
705
  * @returns 所有的 view API 配置。
@@ -704,6 +714,52 @@ var View = /** @class */ (function (_super) {
704
714
  View.prototype.getData = function () {
705
715
  return this.filteredData;
706
716
  };
717
+ /**
718
+ * 获取原始数据
719
+ * @returns 传入 G2 的原始数据
720
+ */
721
+ View.prototype.getOriginalData = function () {
722
+ return this.options.data;
723
+ };
724
+ /**
725
+ * 获取布局后的边距 padding
726
+ * @returns
727
+ */
728
+ View.prototype.getPadding = function () {
729
+ return this.autoPadding.getPadding();
730
+ };
731
+ /**
732
+ * 获取当前 view 有的 geometries
733
+ * @returns
734
+ */
735
+ View.prototype.getGeometries = function () {
736
+ return this.geometries;
737
+ };
738
+ /**
739
+ * 获取 view 中的所有 geome
740
+ */
741
+ View.prototype.getElements = function () {
742
+ return (0, util_1.reduce)(this.geometries, function (elements, geometry) {
743
+ return elements.concat(geometry.getElements());
744
+ }, []);
745
+ };
746
+ /**
747
+ * 根据一定的规则查找 Geometry 的 Elements。
748
+ *
749
+ * ```typescript
750
+ * getElementsBy((element) => {
751
+ * const data = element.getData();
752
+ *
753
+ * return data.a === 'a';
754
+ * });
755
+ * ```
756
+ *
757
+ * @param condition 定义查找规则的回调函数。
758
+ * @returns
759
+ */
760
+ View.prototype.getElementsBy = function (condition) {
761
+ return this.getElements().filter(function (el) { return condition(el); });
762
+ };
707
763
  /**
708
764
  * 获得绘制的层级 group。
709
765
  * @param layer 层级名称。
@@ -723,14 +779,14 @@ var View = /** @class */ (function (_super) {
723
779
  * @param point 坐标点
724
780
  */
725
781
  View.prototype.isPointInPlot = function (point) {
726
- return coordinate_1.isPointInCoordinate(this.getCoordinate(), point);
782
+ return (0, coordinate_1.isPointInCoordinate)(this.getCoordinate(), point);
727
783
  };
728
784
  /**
729
785
  * 获得所有的 legend 对应的 attribute 实例。
730
786
  * @returns 维度字段的 Attribute 数组
731
787
  */
732
788
  View.prototype.getLegendAttributes = function () {
733
- return util_1.flatten(this.geometries.map(function (g) { return g.getGroupAttributes(); }));
789
+ return (0, util_1.flatten)(this.geometries.map(function (g) { return g.getGroupAttributes(); }));
734
790
  };
735
791
  /**
736
792
  * 获取所有的分组字段的 scale 实例。
@@ -739,7 +795,7 @@ var View = /** @class */ (function (_super) {
739
795
  View.prototype.getGroupScales = function () {
740
796
  // 拿到所有的 Geometry 的 分组字段 scale,然后打平去重
741
797
  var scales = this.geometries.map(function (g) { return g.getGroupScales(); });
742
- return helper_1.uniq(util_1.flatten(scales));
798
+ return (0, helper_1.uniq)((0, util_1.flatten)(scales));
743
799
  };
744
800
  /**
745
801
  * 获取 G.Canvas 实例。
@@ -773,7 +829,7 @@ var View = /** @class */ (function (_super) {
773
829
  var yScales = this.getScalesByDim('y');
774
830
  var x;
775
831
  var y;
776
- util_1.each(data, function (value, key) {
832
+ (0, util_1.each)(data, function (value, key) {
777
833
  if (xScales[key]) {
778
834
  x = xScales[key].scale(value);
779
835
  }
@@ -781,7 +837,7 @@ var View = /** @class */ (function (_super) {
781
837
  y = yScales[key].scale(value);
782
838
  }
783
839
  });
784
- if (!util_1.isNil(x) && !util_1.isNil(y)) {
840
+ if (!(0, util_1.isNil)(x) && !(0, util_1.isNil)(y)) {
785
841
  return coordinate.convert({ x: x, y: y });
786
842
  }
787
843
  };
@@ -790,7 +846,7 @@ var View = /** @class */ (function (_super) {
790
846
  * @param name
791
847
  */
792
848
  View.prototype.getController = function (name) {
793
- return util_1.find(this.controllers, function (c) { return c.name === name; });
849
+ return (0, util_1.find)(this.controllers, function (c) { return c.name === name; });
794
850
  };
795
851
  /**
796
852
  * 显示 point 坐标点对应的 tooltip。
@@ -869,7 +925,7 @@ var View = /** @class */ (function (_super) {
869
925
  var record = void 0;
870
926
  for (var j = 0, dataLen = dataArray.length; j < dataLen; j++) {
871
927
  var data = dataArray[j];
872
- record = tooltip_1.findDataByPoint(point, data, geom);
928
+ record = (0, tooltip_1.findDataByPoint)(point, data, geom);
873
929
  if (record) {
874
930
  rst.push(record);
875
931
  }
@@ -904,11 +960,11 @@ var View = /** @class */ (function (_super) {
904
960
  View.prototype.filterData = function (data) {
905
961
  var filters = this.options.filters;
906
962
  // 不存在 filters,则不需要进行数据过滤
907
- if (util_1.size(filters) === 0) {
963
+ if ((0, util_1.size)(filters) === 0) {
908
964
  return data;
909
965
  }
910
966
  // 存在过滤器,则逐个执行过滤,过滤器之间是 与 的关系
911
- return util_1.filter(data, function (datum, idx) {
967
+ return (0, util_1.filter)(data, function (datum, idx) {
912
968
  // 所有的 filter 字段
913
969
  var fields = Object.keys(filters);
914
970
  // 所有的条件都通过,才算通过
@@ -926,8 +982,8 @@ var View = /** @class */ (function (_super) {
926
982
  */
927
983
  View.prototype.filterFieldData = function (field, data) {
928
984
  var filters = this.options.filters;
929
- var condition = util_1.get(filters, field);
930
- if (util_1.isUndefined(condition)) {
985
+ var condition = (0, util_1.get)(filters, field);
986
+ if ((0, util_1.isUndefined)(condition)) {
931
987
  return data;
932
988
  }
933
989
  return data.filter(function (datum, idx) { return condition(datum[field], datum, idx); });
@@ -940,7 +996,7 @@ var View = /** @class */ (function (_super) {
940
996
  var start = this.coordinateBBox.bl;
941
997
  var end = this.coordinateBBox.tr;
942
998
  // 在 defaultLayoutFn 中只会在 coordinateBBox 发生变化的时候会调用 adjustCoordinate(),所以不用担心被置位
943
- if (util_1.isEqual(curStart, start) && util_1.isEqual(curEnd, end)) {
999
+ if ((0, util_1.isEqual)(curStart, start) && (0, util_1.isEqual)(curEnd, end)) {
944
1000
  this.isCoordinateChanged = false;
945
1001
  // 如果大小没有变化则不更新
946
1002
  return;
@@ -973,7 +1029,7 @@ var View = /** @class */ (function (_super) {
973
1029
  if (this.parent) {
974
1030
  return;
975
1031
  }
976
- var background = util_1.get(this.themeObject, 'background');
1032
+ var background = (0, util_1.get)(this.themeObject, 'background');
977
1033
  // 配置了背景色
978
1034
  if (background) {
979
1035
  // 1. 不存在则创建
@@ -1017,7 +1073,7 @@ var View = /** @class */ (function (_super) {
1017
1073
  this.initComponents(isUpdate);
1018
1074
  // 4. 布局计算每隔 view 的 padding 值
1019
1075
  // 4.1. 自动加 auto padding -> absolute padding,并且增加 appendPadding
1020
- this.autoPadding = auto_1.calculatePadding(this).shrink(padding_1.parsePadding(this.appendPadding));
1076
+ this.autoPadding = (0, auto_1.calculatePadding)(this).shrink((0, padding_1.parsePadding)(this.appendPadding));
1021
1077
  // 4.2. 计算出新的 coordinateBBox,更新 Coordinate
1022
1078
  // 这里必须保留,原因是后面子 view 的 viewBBox 或根据 parent 的 coordinateBBox
1023
1079
  this.coordinateBBox = this.viewBBox.shrink(this.autoPadding.getPadding());
@@ -1038,7 +1094,7 @@ var View = /** @class */ (function (_super) {
1038
1094
  // 根据配置获取 padding
1039
1095
  var syncViewPaddingFn = this.syncViewPadding === true
1040
1096
  ? sync_view_padding_1.defaultSyncViewPadding
1041
- : util_1.isFunction(this.syncViewPadding)
1097
+ : (0, util_1.isFunction)(this.syncViewPadding)
1042
1098
  ? this.syncViewPadding
1043
1099
  : undefined;
1044
1100
  if (syncViewPaddingFn) {
@@ -1065,7 +1121,7 @@ var View = /** @class */ (function (_super) {
1065
1121
  View.prototype.renderPaintRecursive = function (isUpdate) {
1066
1122
  var middleGroup = this.middleGroup;
1067
1123
  if (this.limitInPlot) {
1068
- var _a = coordinate_1.getCoordinateClipCfg(this.coordinateInstance), type = _a.type, attrs = _a.attrs;
1124
+ var _a = (0, coordinate_1.getCoordinateClipCfg)(this.coordinateInstance), type = _a.type, attrs = _a.attrs;
1069
1125
  middleGroup.setClip({
1070
1126
  type: type,
1071
1127
  attrs: attrs,
@@ -1096,8 +1152,8 @@ var View = /** @class */ (function (_super) {
1096
1152
  */
1097
1153
  View.prototype.createScale = function (field, data, scaleDef, key) {
1098
1154
  // 1. 合并 field 对应的 scaleDef,合并原则是底层覆盖顶层(就近原则)
1099
- var currentScaleDef = util_1.get(this.options.scales, [field]);
1100
- var mergedScaleDef = tslib_1.__assign(tslib_1.__assign({}, currentScaleDef), scaleDef);
1155
+ var currentScaleDef = (0, util_1.get)(this.options.scales, [field]);
1156
+ var mergedScaleDef = (0, tslib_1.__assign)((0, tslib_1.__assign)({}, currentScaleDef), scaleDef);
1101
1157
  // 2. 是否存在父 view,在则递归,否则创建
1102
1158
  if (this.parent) {
1103
1159
  return this.parent.createScale(field, data, mergedScaleDef, key);
@@ -1180,7 +1236,7 @@ var View = /** @class */ (function (_super) {
1180
1236
  var usedControllers = this.usedControllers;
1181
1237
  for (var i = 0, len = usedControllers.length; i < len; i++) {
1182
1238
  var controllerName = usedControllers[i];
1183
- var Ctor = controller_1.getComponentController(controllerName);
1239
+ var Ctor = (0, controller_1.getComponentController)(controllerName);
1184
1240
  if (Ctor) {
1185
1241
  this.controllers.push(new Ctor(this));
1186
1242
  }
@@ -1282,7 +1338,7 @@ var View = /** @class */ (function (_super) {
1282
1338
  this.createOrUpdateScales();
1283
1339
  // 实例化 Geometry,然后 view 将所有的 scale 管理起来
1284
1340
  var coordinate = this.getCoordinate();
1285
- var scaleDefs = util_1.get(this.options, 'scales', {});
1341
+ var scaleDefs = (0, util_1.get)(this.options, 'scales', {});
1286
1342
  var geometries = this.geometries;
1287
1343
  for (var i = 0, len = geometries.length; i < len; i++) {
1288
1344
  var geometry = geometries[i];
@@ -1349,23 +1405,23 @@ var View = /** @class */ (function (_super) {
1349
1405
  };
1350
1406
  View.prototype.getScaleFields = function () {
1351
1407
  var fields = [];
1352
- var tmpMap = {};
1408
+ var tmpMap = new Map();
1353
1409
  var geometries = this.geometries;
1354
1410
  for (var i = 0; i < geometries.length; i++) {
1355
1411
  var geometry = geometries[i];
1356
1412
  var geometryScales = geometry.getScaleFields();
1357
- helper_1.uniq(geometryScales, fields, tmpMap);
1413
+ (0, helper_1.uniq)(geometryScales, fields, tmpMap);
1358
1414
  }
1359
1415
  return fields;
1360
1416
  };
1361
1417
  View.prototype.getGroupedFields = function () {
1362
1418
  var fields = [];
1363
- var tmpMap = {};
1419
+ var tmpMap = new Map();
1364
1420
  var geometries = this.geometries;
1365
1421
  for (var i = 0; i < geometries.length; i++) {
1366
1422
  var geometry = geometries[i];
1367
1423
  var groupFields = geometry.getGroupFields();
1368
- helper_1.uniq(groupFields, fields, tmpMap);
1424
+ (0, helper_1.uniq)(groupFields, fields, tmpMap);
1369
1425
  }
1370
1426
  return fields;
1371
1427
  };
@@ -1384,17 +1440,17 @@ var View = /** @class */ (function (_super) {
1384
1440
  */
1385
1441
  View.prototype.adjustCategoryScaleRange = function () {
1386
1442
  var _this = this;
1387
- var xyScales = tslib_1.__spreadArrays([this.getXScale()], this.getYScales()).filter(function (e) { return !!e; });
1443
+ var xyScales = (0, tslib_1.__spreadArray)([this.getXScale()], this.getYScales(), true).filter(function (e) { return !!e; });
1388
1444
  var coordinate = this.getCoordinate();
1389
1445
  var scaleOptions = this.options.scales;
1390
- util_1.each(xyScales, function (scale) {
1446
+ (0, util_1.each)(xyScales, function (scale) {
1391
1447
  var field = scale.field, values = scale.values, isCategory = scale.isCategory, isIdentity = scale.isIdentity;
1392
1448
  // 分类或者 identity 的 scale 才进行处理
1393
1449
  if (isCategory || isIdentity) {
1394
1450
  // 存在 value 值,且用户没有配置 range 配置
1395
- if (values && !util_1.get(scaleOptions, [field, 'range'])) {
1451
+ if (values && !(0, util_1.get)(scaleOptions, [field, 'range'])) {
1396
1452
  // 更新 range
1397
- scale.range = scale_1.getDefaultCategoryScaleRange(scale, coordinate, _this.theme);
1453
+ scale.range = (0, scale_1.getDefaultCategoryScaleRange)(scale, coordinate, _this.theme);
1398
1454
  }
1399
1455
  }
1400
1456
  });
@@ -1526,13 +1582,13 @@ var View = /** @class */ (function (_super) {
1526
1582
  }
1527
1583
  // 设置 events
1528
1584
  if (events) {
1529
- util_1.each(events, function (eventCallback, eventName) {
1585
+ (0, util_1.each)(events, function (eventCallback, eventName) {
1530
1586
  _this.on(eventName, eventCallback);
1531
1587
  });
1532
1588
  }
1533
1589
  if (facets) {
1534
- util_1.each(facets, function (facet) {
1535
- var type = facet.type, rest = tslib_1.__rest(facet, ["type"]);
1590
+ (0, util_1.each)(facets, function (facet) {
1591
+ var type = facet.type, rest = (0, tslib_1.__rest)(facet, ["type"]);
1536
1592
  _this.facet(type, rest);
1537
1593
  });
1538
1594
  }
@@ -1541,8 +1597,8 @@ var View = /** @class */ (function (_super) {
1541
1597
  var type = geometryOption.type, _a = geometryOption.cfg, cfg = _a === void 0 ? {} : _a;
1542
1598
  if (this[type]) {
1543
1599
  var geometry_1 = this[type](cfg);
1544
- util_1.each(geometryOption, function (v, k) {
1545
- if (util_1.isFunction(geometry_1[k])) {
1600
+ (0, util_1.each)(geometryOption, function (v, k) {
1601
+ if ((0, util_1.isFunction)(geometry_1[k])) {
1546
1602
  geometry_1[k](v);
1547
1603
  }
1548
1604
  });
@@ -1568,7 +1624,7 @@ function registerGeometry(name, Ctor) {
1568
1624
  // 语法糖,在 view API 上增加原型方法
1569
1625
  View.prototype[name.toLowerCase()] = function (cfg) {
1570
1626
  if (cfg === void 0) { cfg = {}; }
1571
- var props = tslib_1.__assign({
1627
+ var props = (0, tslib_1.__assign)({
1572
1628
  /** 图形容器 */
1573
1629
  container: this.middleGroup.addGroup(), labelsContainer: this.foregroundGroup.addGroup() }, cfg);
1574
1630
  var geometry = new Ctor(props);