@antv/g2 5.0.0-beta.3 → 5.0.0-beta.5

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 (459) hide show
  1. package/dist/g2-lite.min.js +5 -2
  2. package/dist/g2.min.js +5 -2
  3. package/esm/api/mark/mark.js +1 -2
  4. package/esm/api/mark/mark.js.map +1 -1
  5. package/esm/api/mark/types.d.ts +1 -2
  6. package/esm/component/axis.js +46 -24
  7. package/esm/component/axis.js.map +1 -1
  8. package/esm/component/index.d.ts +4 -0
  9. package/esm/component/index.js +2 -0
  10. package/esm/component/index.js.map +1 -1
  11. package/esm/component/legendCategory.js +1 -0
  12. package/esm/component/legendCategory.js.map +1 -1
  13. package/esm/component/slider.d.ts +9 -0
  14. package/esm/component/slider.js +57 -0
  15. package/esm/component/slider.js.map +1 -0
  16. package/esm/component/sliderX.d.ts +7 -0
  17. package/esm/component/sliderX.js +9 -0
  18. package/esm/component/sliderX.js.map +1 -0
  19. package/esm/component/sliderY.d.ts +7 -0
  20. package/esm/component/sliderY.js +9 -0
  21. package/esm/component/sliderY.js.map +1 -0
  22. package/esm/composition/facetRect.js +4 -4
  23. package/esm/composition/facetRect.js.map +1 -1
  24. package/esm/composition/mark.js +3 -1
  25. package/esm/composition/mark.js.map +1 -1
  26. package/esm/composition/repeatMatrix.js +2 -2
  27. package/esm/composition/repeatMatrix.js.map +1 -1
  28. package/esm/data/filter.d.ts +3 -3
  29. package/esm/data/filter.js.map +1 -1
  30. package/esm/data/index.d.ts +3 -1
  31. package/esm/data/index.js +1 -0
  32. package/esm/data/index.js.map +1 -1
  33. package/esm/data/sort.d.ts +8 -0
  34. package/esm/data/sort.js +12 -0
  35. package/esm/data/sort.js.map +1 -0
  36. package/esm/interaction/builtin/brushHighlight.d.ts +1 -1
  37. package/esm/interaction/builtin/tooltip.d.ts +6 -4
  38. package/esm/interaction/index.d.ts +5 -0
  39. package/esm/interaction/index.js +5 -0
  40. package/esm/interaction/index.js.map +1 -1
  41. package/esm/interaction/native/brushHighlight.d.ts +15 -0
  42. package/esm/interaction/native/brushHighlight.js +283 -0
  43. package/esm/interaction/native/brushHighlight.js.map +1 -0
  44. package/esm/interaction/native/brushXHighlight.d.ts +1 -0
  45. package/esm/interaction/native/brushXHighlight.js +8 -0
  46. package/esm/interaction/native/brushXHighlight.js.map +1 -0
  47. package/esm/interaction/native/brushYHighlight.d.ts +1 -0
  48. package/esm/interaction/native/brushYHighlight.js +8 -0
  49. package/esm/interaction/native/brushYHighlight.js.map +1 -0
  50. package/esm/interaction/native/legendFilter.d.ts +8 -0
  51. package/esm/interaction/native/legendFilter.js +180 -0
  52. package/esm/interaction/native/legendFilter.js.map +1 -0
  53. package/esm/interaction/native/tooltip.d.ts +2 -2
  54. package/esm/interaction/native/tooltip.js +134 -44
  55. package/esm/interaction/native/tooltip.js.map +1 -1
  56. package/esm/interaction/native/utils.d.ts +5 -1
  57. package/esm/interaction/native/utils.js +25 -2
  58. package/esm/interaction/native/utils.js.map +1 -1
  59. package/esm/label-transform/contrastReverse.d.ts +9 -0
  60. package/esm/label-transform/contrastReverse.js +48 -0
  61. package/esm/label-transform/contrastReverse.js.map +1 -0
  62. package/esm/label-transform/index.d.ts +8 -8
  63. package/esm/label-transform/index.js +4 -4
  64. package/esm/label-transform/index.js.map +1 -1
  65. package/esm/label-transform/overflowHide.d.ts +7 -0
  66. package/esm/label-transform/overflowHide.js +18 -0
  67. package/esm/label-transform/overflowHide.js.map +1 -0
  68. package/esm/label-transform/overlapDodgeY.d.ts +7 -0
  69. package/esm/label-transform/{dodgeY.js → overlapDodgeY.js} +4 -4
  70. package/esm/label-transform/overlapDodgeY.js.map +1 -0
  71. package/esm/label-transform/overlapHide.d.ts +7 -0
  72. package/esm/label-transform/overlapHide.js +24 -0
  73. package/esm/label-transform/overlapHide.js.map +1 -0
  74. package/esm/mark/area.js +1 -1
  75. package/esm/mark/area.js.map +1 -1
  76. package/esm/mark/line.js +1 -1
  77. package/esm/mark/line.js.map +1 -1
  78. package/esm/runtime/component.js +29 -1
  79. package/esm/runtime/component.js.map +1 -1
  80. package/esm/runtime/plot.js +38 -13
  81. package/esm/runtime/plot.js.map +1 -1
  82. package/esm/runtime/scale.js +17 -5
  83. package/esm/runtime/scale.js.map +1 -1
  84. package/esm/runtime/transform.js +10 -4
  85. package/esm/runtime/transform.js.map +1 -1
  86. package/esm/runtime/types/common.d.ts +1 -0
  87. package/esm/runtime/types/mark.d.ts +1 -1
  88. package/esm/runtime/types/options.d.ts +2 -0
  89. package/esm/runtime/types/theme.d.ts +5 -0
  90. package/esm/shape/label/label.js +3 -3
  91. package/esm/shape/label/label.js.map +1 -1
  92. package/esm/shape/label/position/area.d.ts +13 -0
  93. package/esm/shape/label/position/area.js +28 -0
  94. package/esm/shape/label/position/area.js.map +1 -0
  95. package/esm/shape/label/position/bottom.d.ts +1 -0
  96. package/esm/shape/label/position/bottom.js +2 -0
  97. package/esm/shape/label/position/bottom.js.map +1 -0
  98. package/esm/shape/label/position/bottomLeft.d.ts +1 -0
  99. package/esm/shape/label/position/bottomLeft.js +2 -0
  100. package/esm/shape/label/position/bottomLeft.js.map +1 -0
  101. package/esm/shape/label/position/bottomRight.d.ts +1 -0
  102. package/esm/shape/label/position/bottomRight.js +2 -0
  103. package/esm/shape/label/position/bottomRight.js.map +1 -0
  104. package/esm/shape/label/position/default.d.ts +20 -0
  105. package/esm/shape/label/{position.js → position/default.js} +9 -45
  106. package/esm/shape/label/position/default.js.map +1 -0
  107. package/esm/shape/label/position/index.d.ts +13 -0
  108. package/esm/shape/label/position/index.js +14 -0
  109. package/esm/shape/label/position/index.js.map +1 -0
  110. package/esm/shape/label/position/inside.d.ts +1 -0
  111. package/esm/shape/label/position/inside.js +2 -0
  112. package/esm/shape/label/position/inside.js.map +1 -0
  113. package/esm/shape/label/position/left.d.ts +1 -0
  114. package/esm/shape/label/position/left.js +2 -0
  115. package/esm/shape/label/position/left.js.map +1 -0
  116. package/esm/shape/label/position/outside.d.ts +1 -0
  117. package/esm/shape/label/position/outside.js +2 -0
  118. package/esm/shape/label/position/outside.js.map +1 -0
  119. package/esm/shape/label/position/right.d.ts +1 -0
  120. package/esm/shape/label/position/right.js +2 -0
  121. package/esm/shape/label/position/right.js.map +1 -0
  122. package/esm/shape/label/position/spider.d.ts +7 -0
  123. package/esm/shape/label/position/spider.js +40 -0
  124. package/esm/shape/label/position/spider.js.map +1 -0
  125. package/esm/shape/label/position/surround.d.ts +7 -0
  126. package/esm/shape/label/position/surround.js +37 -0
  127. package/esm/shape/label/position/surround.js.map +1 -0
  128. package/esm/shape/label/position/top.d.ts +1 -0
  129. package/esm/shape/label/position/top.js +2 -0
  130. package/esm/shape/label/position/top.js.map +1 -0
  131. package/esm/shape/label/position/topLeft.d.ts +1 -0
  132. package/esm/shape/label/position/topLeft.js +2 -0
  133. package/esm/shape/label/position/topLeft.js.map +1 -0
  134. package/esm/shape/label/position/topRight.d.ts +1 -0
  135. package/esm/shape/label/position/topRight.js +2 -0
  136. package/esm/shape/label/position/topRight.js.map +1 -0
  137. package/esm/spec/composition.d.ts +2 -0
  138. package/esm/spec/data.d.ts +10 -3
  139. package/esm/spec/geometry.d.ts +2 -1
  140. package/esm/spec/interaction.d.ts +28 -5
  141. package/esm/spec/labelTransform.d.ts +24 -11
  142. package/esm/spec/theme.d.ts +5 -2
  143. package/esm/spec/transform.d.ts +7 -2
  144. package/esm/stdlib/index.js +9 -10
  145. package/esm/stdlib/index.js.map +1 -1
  146. package/esm/theme/academy.d.ts +3 -0
  147. package/esm/theme/academy.js +402 -0
  148. package/esm/theme/academy.js.map +1 -0
  149. package/esm/theme/dark.js +80 -29
  150. package/esm/theme/dark.js.map +1 -1
  151. package/esm/theme/index.d.ts +1 -0
  152. package/esm/theme/index.js +1 -0
  153. package/esm/theme/index.js.map +1 -1
  154. package/esm/theme/light.js +71 -19
  155. package/esm/theme/light.js.map +1 -1
  156. package/esm/transform/filter.d.ts +7 -0
  157. package/esm/transform/filter.js +42 -0
  158. package/esm/transform/filter.js.map +1 -0
  159. package/esm/transform/index.d.ts +2 -0
  160. package/esm/transform/index.js +1 -0
  161. package/esm/transform/index.js.map +1 -1
  162. package/esm/transform/maybeTooltip.js +3 -1
  163. package/esm/transform/maybeTooltip.js.map +1 -1
  164. package/esm/utils/bounds.d.ts +26 -0
  165. package/esm/utils/bounds.js +41 -0
  166. package/esm/utils/bounds.js.map +1 -0
  167. package/esm/utils/color.d.ts +6 -0
  168. package/esm/utils/color.js +7 -0
  169. package/esm/utils/color.js.map +1 -0
  170. package/esm/utils/coordinate.d.ts +1 -0
  171. package/esm/utils/coordinate.js +12 -0
  172. package/esm/utils/coordinate.js.map +1 -1
  173. package/esm/utils/helper.d.ts +1 -0
  174. package/esm/utils/helper.js +3 -0
  175. package/esm/utils/helper.js.map +1 -1
  176. package/esm/utils/selection.d.ts +1 -0
  177. package/esm/utils/selection.js.map +1 -1
  178. package/esm/utils/size.js +1 -1
  179. package/esm/utils/size.js.map +1 -1
  180. package/lib/api/mark/mark.js +1 -2
  181. package/lib/api/mark/mark.js.map +1 -1
  182. package/lib/api/mark/types.d.ts +1 -2
  183. package/lib/component/axis.js +46 -24
  184. package/lib/component/axis.js.map +1 -1
  185. package/lib/component/index.d.ts +4 -0
  186. package/lib/component/index.js +5 -1
  187. package/lib/component/index.js.map +1 -1
  188. package/lib/component/legendCategory.js +1 -0
  189. package/lib/component/legendCategory.js.map +1 -1
  190. package/lib/component/slider.d.ts +9 -0
  191. package/lib/component/slider.js +61 -0
  192. package/lib/component/slider.js.map +1 -0
  193. package/lib/component/sliderX.d.ts +7 -0
  194. package/lib/component/sliderX.js +13 -0
  195. package/lib/component/sliderX.js.map +1 -0
  196. package/lib/component/sliderY.d.ts +7 -0
  197. package/lib/component/sliderY.js +13 -0
  198. package/lib/component/sliderY.js.map +1 -0
  199. package/lib/composition/facetRect.js +4 -4
  200. package/lib/composition/facetRect.js.map +1 -1
  201. package/lib/composition/mark.js +3 -1
  202. package/lib/composition/mark.js.map +1 -1
  203. package/lib/composition/repeatMatrix.js +2 -2
  204. package/lib/composition/repeatMatrix.js.map +1 -1
  205. package/lib/data/filter.d.ts +3 -3
  206. package/lib/data/filter.js.map +1 -1
  207. package/lib/data/index.d.ts +3 -1
  208. package/lib/data/index.js +3 -1
  209. package/lib/data/index.js.map +1 -1
  210. package/lib/data/sort.d.ts +8 -0
  211. package/lib/data/sort.js +17 -0
  212. package/lib/data/sort.js.map +1 -0
  213. package/lib/interaction/builtin/brushHighlight.d.ts +1 -1
  214. package/lib/interaction/builtin/tooltip.d.ts +6 -4
  215. package/lib/interaction/index.d.ts +5 -0
  216. package/lib/interaction/index.js +11 -1
  217. package/lib/interaction/index.js.map +1 -1
  218. package/lib/interaction/native/brushHighlight.d.ts +15 -0
  219. package/lib/interaction/native/brushHighlight.js +289 -0
  220. package/lib/interaction/native/brushHighlight.js.map +1 -0
  221. package/lib/interaction/native/brushXHighlight.d.ts +1 -0
  222. package/lib/interaction/native/brushXHighlight.js +12 -0
  223. package/lib/interaction/native/brushXHighlight.js.map +1 -0
  224. package/lib/interaction/native/brushYHighlight.d.ts +1 -0
  225. package/lib/interaction/native/brushYHighlight.js +12 -0
  226. package/lib/interaction/native/brushYHighlight.js.map +1 -0
  227. package/lib/interaction/native/legendFilter.d.ts +8 -0
  228. package/lib/interaction/native/legendFilter.js +184 -0
  229. package/lib/interaction/native/legendFilter.js.map +1 -0
  230. package/lib/interaction/native/tooltip.d.ts +2 -2
  231. package/lib/interaction/native/tooltip.js +131 -41
  232. package/lib/interaction/native/tooltip.js.map +1 -1
  233. package/lib/interaction/native/utils.d.ts +5 -1
  234. package/lib/interaction/native/utils.js +30 -3
  235. package/lib/interaction/native/utils.js.map +1 -1
  236. package/lib/label-transform/contrastReverse.d.ts +9 -0
  237. package/lib/label-transform/contrastReverse.js +52 -0
  238. package/lib/label-transform/contrastReverse.js.map +1 -0
  239. package/lib/label-transform/index.d.ts +8 -8
  240. package/lib/label-transform/index.js +9 -9
  241. package/lib/label-transform/index.js.map +1 -1
  242. package/lib/label-transform/overflowHide.d.ts +7 -0
  243. package/lib/label-transform/overflowHide.js +22 -0
  244. package/lib/label-transform/overflowHide.js.map +1 -0
  245. package/lib/label-transform/overlapDodgeY.d.ts +7 -0
  246. package/lib/label-transform/{dodgeY.js → overlapDodgeY.js} +6 -6
  247. package/lib/label-transform/overlapDodgeY.js.map +1 -0
  248. package/lib/label-transform/overlapHide.d.ts +7 -0
  249. package/lib/label-transform/overlapHide.js +28 -0
  250. package/lib/label-transform/overlapHide.js.map +1 -0
  251. package/lib/mark/area.js +1 -1
  252. package/lib/mark/area.js.map +1 -1
  253. package/lib/mark/line.js +1 -1
  254. package/lib/mark/line.js.map +1 -1
  255. package/lib/runtime/component.js +29 -1
  256. package/lib/runtime/component.js.map +1 -1
  257. package/lib/runtime/plot.js +38 -13
  258. package/lib/runtime/plot.js.map +1 -1
  259. package/lib/runtime/scale.js +16 -4
  260. package/lib/runtime/scale.js.map +1 -1
  261. package/lib/runtime/transform.js +10 -4
  262. package/lib/runtime/transform.js.map +1 -1
  263. package/lib/runtime/types/common.d.ts +1 -0
  264. package/lib/runtime/types/mark.d.ts +1 -1
  265. package/lib/runtime/types/options.d.ts +2 -0
  266. package/lib/runtime/types/theme.d.ts +5 -0
  267. package/lib/shape/label/label.js +3 -3
  268. package/lib/shape/label/label.js.map +1 -1
  269. package/lib/shape/label/position/area.d.ts +13 -0
  270. package/lib/shape/label/position/area.js +32 -0
  271. package/lib/shape/label/position/area.js.map +1 -0
  272. package/lib/shape/label/position/bottom.d.ts +1 -0
  273. package/lib/shape/label/position/bottom.js +6 -0
  274. package/lib/shape/label/position/bottom.js.map +1 -0
  275. package/lib/shape/label/position/bottomLeft.d.ts +1 -0
  276. package/lib/shape/label/position/bottomLeft.js +6 -0
  277. package/lib/shape/label/position/bottomLeft.js.map +1 -0
  278. package/lib/shape/label/position/bottomRight.d.ts +1 -0
  279. package/lib/shape/label/position/bottomRight.js +6 -0
  280. package/lib/shape/label/position/bottomRight.js.map +1 -0
  281. package/lib/shape/label/position/default.d.ts +20 -0
  282. package/lib/shape/label/{position.js → position/default.js} +10 -43
  283. package/lib/shape/label/position/default.js.map +1 -0
  284. package/lib/shape/label/position/index.d.ts +13 -0
  285. package/lib/shape/label/position/index.js +30 -0
  286. package/lib/shape/label/position/index.js.map +1 -0
  287. package/lib/shape/label/position/inside.d.ts +1 -0
  288. package/lib/shape/label/position/inside.js +6 -0
  289. package/lib/shape/label/position/inside.js.map +1 -0
  290. package/lib/shape/label/position/left.d.ts +1 -0
  291. package/lib/shape/label/position/left.js +6 -0
  292. package/lib/shape/label/position/left.js.map +1 -0
  293. package/lib/shape/label/position/outside.d.ts +1 -0
  294. package/lib/shape/label/position/outside.js +6 -0
  295. package/lib/shape/label/position/outside.js.map +1 -0
  296. package/lib/shape/label/position/right.d.ts +1 -0
  297. package/lib/shape/label/position/right.js +6 -0
  298. package/lib/shape/label/position/right.js.map +1 -0
  299. package/lib/shape/label/position/spider.d.ts +7 -0
  300. package/lib/shape/label/position/spider.js +44 -0
  301. package/lib/shape/label/position/spider.js.map +1 -0
  302. package/lib/shape/label/position/surround.d.ts +7 -0
  303. package/lib/shape/label/position/surround.js +41 -0
  304. package/lib/shape/label/position/surround.js.map +1 -0
  305. package/lib/shape/label/position/top.d.ts +1 -0
  306. package/lib/shape/label/position/top.js +6 -0
  307. package/lib/shape/label/position/top.js.map +1 -0
  308. package/lib/shape/label/position/topLeft.d.ts +1 -0
  309. package/lib/shape/label/position/topLeft.js +6 -0
  310. package/lib/shape/label/position/topLeft.js.map +1 -0
  311. package/lib/shape/label/position/topRight.d.ts +1 -0
  312. package/lib/shape/label/position/topRight.js +6 -0
  313. package/lib/shape/label/position/topRight.js.map +1 -0
  314. package/lib/spec/composition.d.ts +2 -0
  315. package/lib/spec/data.d.ts +10 -3
  316. package/lib/spec/geometry.d.ts +2 -1
  317. package/lib/spec/interaction.d.ts +28 -5
  318. package/lib/spec/labelTransform.d.ts +24 -11
  319. package/lib/spec/theme.d.ts +5 -2
  320. package/lib/spec/transform.d.ts +7 -2
  321. package/lib/stdlib/index.js +3 -4
  322. package/lib/stdlib/index.js.map +1 -1
  323. package/lib/theme/academy.d.ts +3 -0
  324. package/lib/theme/academy.js +406 -0
  325. package/lib/theme/academy.js.map +1 -0
  326. package/lib/theme/dark.js +80 -29
  327. package/lib/theme/dark.js.map +1 -1
  328. package/lib/theme/index.d.ts +1 -0
  329. package/lib/theme/index.js +3 -1
  330. package/lib/theme/index.js.map +1 -1
  331. package/lib/theme/light.js +71 -19
  332. package/lib/theme/light.js.map +1 -1
  333. package/lib/transform/filter.d.ts +7 -0
  334. package/lib/transform/filter.js +46 -0
  335. package/lib/transform/filter.js.map +1 -0
  336. package/lib/transform/index.d.ts +2 -0
  337. package/lib/transform/index.js +3 -1
  338. package/lib/transform/index.js.map +1 -1
  339. package/lib/transform/maybeTooltip.js +3 -1
  340. package/lib/transform/maybeTooltip.js.map +1 -1
  341. package/lib/utils/bounds.d.ts +26 -0
  342. package/lib/utils/bounds.js +48 -0
  343. package/lib/utils/bounds.js.map +1 -0
  344. package/lib/utils/color.d.ts +6 -0
  345. package/lib/utils/color.js +11 -0
  346. package/lib/utils/color.js.map +1 -0
  347. package/lib/utils/coordinate.d.ts +1 -0
  348. package/lib/utils/coordinate.js +14 -1
  349. package/lib/utils/coordinate.js.map +1 -1
  350. package/lib/utils/helper.d.ts +1 -0
  351. package/lib/utils/helper.js +5 -1
  352. package/lib/utils/helper.js.map +1 -1
  353. package/lib/utils/selection.d.ts +1 -0
  354. package/lib/utils/selection.js.map +1 -1
  355. package/lib/utils/size.js +1 -1
  356. package/lib/utils/size.js.map +1 -1
  357. package/package.json +4 -3
  358. package/src/api/mark/mark.ts +1 -2
  359. package/src/api/mark/types.ts +1 -2
  360. package/src/component/axis.ts +56 -96
  361. package/src/component/index.ts +4 -0
  362. package/src/component/legendCategory.ts +1 -0
  363. package/src/component/slider.ts +61 -0
  364. package/src/component/sliderX.ts +16 -0
  365. package/src/component/sliderY.ts +16 -0
  366. package/src/composition/facetRect.ts +4 -2
  367. package/src/composition/mark.ts +4 -0
  368. package/src/composition/repeatMatrix.ts +8 -1
  369. package/src/data/filter.ts +3 -3
  370. package/src/data/index.ts +3 -1
  371. package/src/data/sort.ts +18 -0
  372. package/src/interaction/index.ts +6 -0
  373. package/src/interaction/native/brushHighlight.ts +346 -0
  374. package/src/interaction/native/brushXHighlight.ts +11 -0
  375. package/src/interaction/native/brushYHighlight.ts +11 -0
  376. package/src/interaction/native/legendFilter.ts +195 -0
  377. package/src/interaction/native/tooltip.ts +173 -45
  378. package/src/interaction/native/utils.ts +33 -1
  379. package/src/label-transform/contrastReverse.ts +56 -0
  380. package/src/label-transform/index.ts +8 -8
  381. package/src/label-transform/overflowHide.ts +23 -0
  382. package/src/label-transform/{dodgeY.ts → overlapDodgeY.ts} +6 -6
  383. package/src/label-transform/overlapHide.ts +32 -0
  384. package/src/mark/area.ts +1 -1
  385. package/src/mark/line.ts +1 -1
  386. package/src/runtime/component.ts +49 -2
  387. package/src/runtime/plot.ts +46 -11
  388. package/src/runtime/scale.ts +15 -7
  389. package/src/runtime/transform.ts +13 -4
  390. package/src/runtime/types/common.ts +1 -0
  391. package/src/runtime/types/mark.ts +1 -1
  392. package/src/runtime/types/options.ts +2 -0
  393. package/src/runtime/types/theme.ts +5 -0
  394. package/src/shape/label/label.ts +4 -3
  395. package/src/shape/label/position/area.ts +39 -0
  396. package/src/shape/label/position/bottom.ts +1 -0
  397. package/src/shape/label/position/bottomLeft.ts +1 -0
  398. package/src/shape/label/position/bottomRight.ts +1 -0
  399. package/src/shape/label/{position.ts → position/default.ts} +12 -56
  400. package/src/shape/label/position/index.ts +13 -0
  401. package/src/shape/label/position/inside.ts +1 -0
  402. package/src/shape/label/position/left.ts +1 -0
  403. package/src/shape/label/position/outside.ts +1 -0
  404. package/src/shape/label/position/right.ts +1 -0
  405. package/src/shape/label/position/spider.ts +46 -0
  406. package/src/shape/label/position/surround.ts +42 -0
  407. package/src/shape/label/position/top.ts +1 -0
  408. package/src/shape/label/position/topLeft.ts +1 -0
  409. package/src/shape/label/position/topRight.ts +1 -0
  410. package/src/spec/composition.ts +2 -0
  411. package/src/spec/data.ts +12 -2
  412. package/src/spec/geometry.ts +3 -1
  413. package/src/spec/interaction.ts +38 -4
  414. package/src/spec/labelTransform.ts +29 -11
  415. package/src/spec/theme.ts +6 -2
  416. package/src/spec/transform.ts +9 -1
  417. package/src/stdlib/index.ts +31 -9
  418. package/src/theme/academy.ts +408 -0
  419. package/src/theme/dark.ts +81 -29
  420. package/src/theme/index.ts +1 -0
  421. package/src/theme/light.ts +71 -19
  422. package/src/transform/filter.ts +48 -0
  423. package/src/transform/index.ts +2 -0
  424. package/src/transform/maybeTooltip.ts +3 -1
  425. package/src/utils/bounds.ts +52 -0
  426. package/src/utils/color.ts +12 -0
  427. package/src/utils/coordinate.ts +12 -0
  428. package/src/utils/helper.ts +4 -0
  429. package/src/utils/selection.ts +2 -0
  430. package/src/utils/size.ts +1 -1
  431. package/esm/label-transform/dodgeY.d.ts +0 -7
  432. package/esm/label-transform/dodgeY.js.map +0 -1
  433. package/esm/label-transform/hideOverlap.d.ts +0 -4
  434. package/esm/label-transform/hideOverlap.js +0 -48
  435. package/esm/label-transform/hideOverlap.js.map +0 -1
  436. package/esm/label-transform/spider.d.ts +0 -7
  437. package/esm/label-transform/spider.js +0 -30
  438. package/esm/label-transform/spider.js.map +0 -1
  439. package/esm/label-transform/surround.d.ts +0 -7
  440. package/esm/label-transform/surround.js +0 -30
  441. package/esm/label-transform/surround.js.map +0 -1
  442. package/esm/shape/label/position.d.ts +0 -25
  443. package/esm/shape/label/position.js.map +0 -1
  444. package/lib/label-transform/dodgeY.d.ts +0 -7
  445. package/lib/label-transform/dodgeY.js.map +0 -1
  446. package/lib/label-transform/hideOverlap.d.ts +0 -4
  447. package/lib/label-transform/hideOverlap.js +0 -52
  448. package/lib/label-transform/hideOverlap.js.map +0 -1
  449. package/lib/label-transform/spider.d.ts +0 -7
  450. package/lib/label-transform/spider.js +0 -34
  451. package/lib/label-transform/spider.js.map +0 -1
  452. package/lib/label-transform/surround.d.ts +0 -7
  453. package/lib/label-transform/surround.js +0 -34
  454. package/lib/label-transform/surround.js.map +0 -1
  455. package/lib/shape/label/position.d.ts +0 -25
  456. package/lib/shape/label/position.js.map +0 -1
  457. package/src/label-transform/hideOverlap.ts +0 -62
  458. package/src/label-transform/spider.ts +0 -37
  459. package/src/label-transform/surround.ts +0 -37
@@ -0,0 +1 @@
1
+ export { getDefaultStyle as bottomLeft } from './default';
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.bottomLeft = void 0;
4
+ var default_1 = require("./default");
5
+ Object.defineProperty(exports, "bottomLeft", { enumerable: true, get: function () { return default_1.getDefaultStyle; } });
6
+ //# sourceMappingURL=bottomLeft.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bottomLeft.js","sourceRoot":"src/","sources":["shape/label/position/bottomLeft.ts"],"names":[],"mappings":";;;AAAA,qCAA0D;AAAjD,qGAAA,eAAe,OAAc"}
@@ -0,0 +1 @@
1
+ export { getDefaultStyle as bottomRight } from './default';
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.bottomRight = void 0;
4
+ var default_1 = require("./default");
5
+ Object.defineProperty(exports, "bottomRight", { enumerable: true, get: function () { return default_1.getDefaultStyle; } });
6
+ //# sourceMappingURL=bottomRight.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bottomRight.js","sourceRoot":"src/","sources":["shape/label/position/bottomRight.ts"],"names":[],"mappings":";;;AAAA,qCAA2D;AAAlD,sGAAA,eAAe,OAAe"}
@@ -0,0 +1,20 @@
1
+ import { Coordinate } from '@antv/coord';
2
+ import { Vector2 } from '../../../runtime';
3
+ export type LabelPosition = 'top' | 'left' | 'right' | 'bottom' | 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' | 'inside' | 'outside' | 'area' | 'spider' | 'surround';
4
+ export declare function inferNonCircularStyle(position: LabelPosition, points: Vector2[], value: Record<string, any>, coordinate: Coordinate): any;
5
+ export declare function inferRadialStyle(position: LabelPosition, points: Vector2[], value: Record<string, any>, coordinate: Coordinate): {
6
+ textAlign: string;
7
+ textBaseline: string;
8
+ rotate: number;
9
+ x: number;
10
+ y: number;
11
+ };
12
+ export declare function inferCircularStyle(position: LabelPosition, points: Vector2[], value: Record<string, any>, coordinate: Coordinate): {
13
+ connector: any;
14
+ connectorPoints: Vector2[];
15
+ dx: number;
16
+ textAlign: string;
17
+ textBaseline: string;
18
+ rotate: number;
19
+ };
20
+ export declare function getDefaultStyle(position: LabelPosition, points: Vector2[], value: Record<string, any>, coordinate: Coordinate): any;
@@ -1,11 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.area = exports.outside = exports.inside = exports.bottomRight = exports.bottomLeft = exports.topRight = exports.topLeft = exports.left = exports.right = exports.bottom = exports.top = void 0;
4
- const d3_array_1 = require("d3-array");
5
- const utils_1 = require("../../shape/utils");
6
- const coordinate_1 = require("../../utils/coordinate");
7
- const helper_1 = require("../../utils/helper");
8
- const vector_1 = require("../../utils/vector");
3
+ exports.getDefaultStyle = exports.inferCircularStyle = exports.inferRadialStyle = exports.inferNonCircularStyle = void 0;
4
+ const utils_1 = require("../../../shape/utils");
5
+ const coordinate_1 = require("../../../utils/coordinate");
6
+ const helper_1 = require("../../../utils/helper");
7
+ const vector_1 = require("../../../utils/vector");
9
8
  function inferNonCircularStyle(position, points, value, coordinate) {
10
9
  const { bounds } = value;
11
10
  const [[x0, y0], [x1, y1]] = bounds;
@@ -43,6 +42,7 @@ function inferNonCircularStyle(position, points, value, coordinate) {
43
42
  textBaseline: 'middle',
44
43
  });
45
44
  }
45
+ exports.inferNonCircularStyle = inferNonCircularStyle;
46
46
  function inferRadialStyle(position, points, value, coordinate) {
47
47
  const { y, y1, autoRotate, rotateToAlignArc } = value;
48
48
  const center = coordinate.getCenter();
@@ -58,6 +58,7 @@ function inferRadialStyle(position, points, value, coordinate) {
58
58
  })();
59
59
  return Object.assign(Object.assign({}, point), { textAlign: position === 'inside' ? 'center' : 'start', textBaseline: 'middle', rotate });
60
60
  }
61
+ exports.inferRadialStyle = inferRadialStyle;
61
62
  function arcPoint(center, angle, radius) {
62
63
  return [
63
64
  center[0] + Math.sin(angle) * radius,
@@ -110,6 +111,7 @@ function inferCircularStyle(position, points, value, coordinate) {
110
111
  const toPoint = (v, x = 'x', y = 'y') => ({ [x]: v[0], [y]: v[1] });
111
112
  return Object.assign(Object.assign(Object.assign(Object.assign({}, toPoint(p0, 'x0', 'y0')), toPoint(p1)), textStyle(position, sign > 0 || (0, coordinate_1.isRadial)(coordinate))), connectorStyle);
112
113
  }
114
+ exports.inferCircularStyle = inferCircularStyle;
113
115
  function inferIdentityStyle(position, points, value, coordinate) {
114
116
  const { bounds } = value;
115
117
  const [p] = bounds;
@@ -134,40 +136,5 @@ function getDefaultStyle(position, points, value, coordinate) {
134
136
  : inferNonCircularStyle;
135
137
  return inferDefaultStyle(position, points, value, coordinate);
136
138
  }
137
- exports.top = getDefaultStyle;
138
- exports.bottom = getDefaultStyle;
139
- exports.right = getDefaultStyle;
140
- exports.left = getDefaultStyle;
141
- exports.topLeft = getDefaultStyle;
142
- exports.topRight = getDefaultStyle;
143
- exports.bottomLeft = getDefaultStyle;
144
- exports.bottomRight = getDefaultStyle;
145
- exports.inside = getDefaultStyle;
146
- exports.outside = getDefaultStyle;
147
- /**
148
- * Only for Area label.
149
- */
150
- function area(position, points, value, coordinate) {
151
- const l = points.length / 2;
152
- const Y1 = points.slice(0, l);
153
- const Y0 = points.slice(l);
154
- // Get the maximal space for label.
155
- let idx = (0, d3_array_1.maxIndex)(Y1, (p, i) => Math.abs(p[1] - Y0[i][1]));
156
- // Do not show label at first and last.
157
- idx = Math.max(Math.min(idx, l - 2), 1);
158
- const mid = (i) => [Y1[i][0], (Y1[i][1] + Y0[i][1]) / 2];
159
- const point = mid(idx);
160
- const prev = mid(idx - 1);
161
- const next = mid(idx + 1);
162
- // todo: G rotate only support deg.
163
- const rotate = ((0, vector_1.angle)((0, vector_1.sub)(next, prev)) / Math.PI) * 180;
164
- return {
165
- x: point[0],
166
- y: point[1],
167
- transform: `rotate(${rotate}deg)`,
168
- textAlign: 'center',
169
- textBaseline: 'middle',
170
- };
171
- }
172
- exports.area = area;
173
- //# sourceMappingURL=position.js.map
139
+ exports.getDefaultStyle = getDefaultStyle;
140
+ //# sourceMappingURL=default.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"default.js","sourceRoot":"src/","sources":["shape/label/position/default.ts"],"names":[],"mappings":";;;AAEA,gDAAoD;AACpD,0DAAiE;AACjE,kDAAwD;AACxD,kDAA4C;AAiB5C,SAAgB,qBAAqB,CACnC,QAAuB,EACvB,MAAiB,EACjB,KAA0B,EAC1B,UAAsB;IAEtB,MAAM,EAAE,MAAM,EAAE,GAAG,KAAK,CAAC;IACzB,MAAM,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,GAAG,MAAM,CAAC;IACpC,MAAM,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC;IAClB,MAAM,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC;IAClB,MAAM,EAAE,GAAG,CAAC,OAAO,EAAE,EAAE;QACrB,MAAM,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC;QACjC,MAAM,EAAE,GAAG,IAAA,wBAAe,EAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QACvC,MAAM,EAAE,GAAG,IAAA,wBAAe,EAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QACvC,uCACK,OAAO,KACV,CAAC,EAAE,CAAC,EAAE,IAAI,E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,MAAM,EAAE,KAAK,EAAE,UAAU,CAAC,CAAC;AAChE,CAAC;AAtBD,0CAsBC"}
@@ -0,0 +1,13 @@
1
+ export { area } from './area';
2
+ export { bottom } from './bottom';
3
+ export { bottomLeft } from './bottomLeft';
4
+ export { bottomRight } from './bottomRight';
5
+ export { inside } from './inside';
6
+ export { left } from './left';
7
+ export { outside } from './outside';
8
+ export { right } from './right';
9
+ export { spider } from './spider';
10
+ export { surround } from './surround';
11
+ export { top } from './top';
12
+ export { topLeft } from './topLeft';
13
+ export { topRight } from './topRight';
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.topRight = exports.topLeft = exports.top = exports.surround = exports.spider = exports.right = exports.outside = exports.left = exports.inside = exports.bottomRight = exports.bottomLeft = exports.bottom = exports.area = void 0;
4
+ var area_1 = require("./area");
5
+ Object.defineProperty(exports, "area", { enumerable: true, get: function () { return area_1.area; } });
6
+ var bottom_1 = require("./bottom");
7
+ Object.defineProperty(exports, "bottom", { enumerable: true, get: function () { return bottom_1.bottom; } });
8
+ var bottomLeft_1 = require("./bottomLeft");
9
+ Object.defineProperty(exports, "bottomLeft", { enumerable: true, get: function () { return bottomLeft_1.bottomLeft; } });
10
+ var bottomRight_1 = require("./bottomRight");
11
+ Object.defineProperty(exports, "bottomRight", { enumerable: true, get: function () { return bottomRight_1.bottomRight; } });
12
+ var inside_1 = require("./inside");
13
+ Object.defineProperty(exports, "inside", { enumerable: true, get: function () { return inside_1.inside; } });
14
+ var left_1 = require("./left");
15
+ Object.defineProperty(exports, "left", { enumerable: true, get: function () { return left_1.left; } });
16
+ var outside_1 = require("./outside");
17
+ Object.defineProperty(exports, "outside", { enumerable: true, get: function () { return outside_1.outside; } });
18
+ var right_1 = require("./right");
19
+ Object.defineProperty(exports, "right", { enumerable: true, get: function () { return right_1.right; } });
20
+ var spider_1 = require("./spider");
21
+ Object.defineProperty(exports, "spider", { enumerable: true, get: function () { return spider_1.spider; } });
22
+ var surround_1 = require("./surround");
23
+ Object.defineProperty(exports, "surround", { enumerable: true, get: function () { return surround_1.surround; } });
24
+ var top_1 = require("./top");
25
+ Object.defineProperty(exports, "top", { enumerable: true, get: function () { return top_1.top; } });
26
+ var topLeft_1 = require("./topLeft");
27
+ Object.defineProperty(exports, "topLeft", { enumerable: true, get: function () { return topLeft_1.topLeft; } });
28
+ var topRight_1 = require("./topRight");
29
+ Object.defineProperty(exports, "topRight", { enumerable: true, get: function () { return topRight_1.topRight; } });
30
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"src/","sources":["shape/label/position/index.ts"],"names":[],"mappings":";;;AAAA,+BAA8B;AAArB,4FAAA,IAAI,OAAA;AACb,mCAAkC;AAAzB,gGAAA,MAAM,OAAA;AACf,2CAA0C;AAAjC,wGAAA,UAAU,OAAA;AACnB,6CAA4C;AAAnC,0GAAA,WAAW,OAAA;AACpB,mCAAkC;AAAzB,gGAAA,MAAM,OAAA;AACf,+BAA8B;AAArB,4FAAA,IAAI,OAAA;AACb,qCAAoC;AAA3B,kGAAA,OAAO,OAAA;AAChB,iCAAgC;AAAvB,8FAAA,KAAK,OAAA;AACd,mCAAkC;AAAzB,gGAAA,MAAM,OAAA;AACf,uCAAsC;AAA7B,oGAAA,QAAQ,OAAA;AACjB,6BAA4B;AAAnB,0FAAA,GAAG,OAAA;AACZ,qCAAoC;AAA3B,kGAAA,OAAO,OAAA;AAChB,uCAAsC;AAA7B,oGAAA,QAAQ,OAAA"}
@@ -0,0 +1 @@
1
+ export { getDefaultStyle as inside } from './default';
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.inside = void 0;
4
+ var default_1 = require("./default");
5
+ Object.defineProperty(exports, "inside", { enumerable: true, get: function () { return default_1.getDefaultStyle; } });
6
+ //# sourceMappingURL=inside.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inside.js","sourceRoot":"src/","sources":["shape/label/position/inside.ts"],"names":[],"mappings":";;;AAAA,qCAAsD;AAA7C,iGAAA,eAAe,OAAU"}
@@ -0,0 +1 @@
1
+ export { getDefaultStyle as left } from './default';
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.left = void 0;
4
+ var default_1 = require("./default");
5
+ Object.defineProperty(exports, "left", { enumerable: true, get: function () { return default_1.getDefaultStyle; } });
6
+ //# sourceMappingURL=left.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"left.js","sourceRoot":"src/","sources":["shape/label/position/left.ts"],"names":[],"mappings":";;;AAAA,qCAAoD;AAA3C,+FAAA,eAAe,OAAQ"}
@@ -0,0 +1 @@
1
+ export { getDefaultStyle as outside } from './default';
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.outside = void 0;
4
+ var default_1 = require("./default");
5
+ Object.defineProperty(exports, "outside", { enumerable: true, get: function () { return default_1.getDefaultStyle; } });
6
+ //# sourceMappingURL=outside.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"outside.js","sourceRoot":"src/","sources":["shape/label/position/outside.ts"],"names":[],"mappings":";;;AAAA,qCAAuD;AAA9C,kGAAA,eAAe,OAAW"}
@@ -0,0 +1 @@
1
+ export { getDefaultStyle as right } from './default';
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.right = void 0;
4
+ var default_1 = require("./default");
5
+ Object.defineProperty(exports, "right", { enumerable: true, get: function () { return default_1.getDefaultStyle; } });
6
+ //# sourceMappingURL=right.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"right.js","sourceRoot":"src/","sources":["shape/label/position/right.ts"],"names":[],"mappings":";;;AAAA,qCAAqD;AAA5C,gGAAA,eAAe,OAAS"}
@@ -0,0 +1,7 @@
1
+ import { Coordinate } from '@antv/coord';
2
+ import { Vector2 } from '../../../runtime';
3
+ import { LabelPosition } from './default';
4
+ /**
5
+ * Spider label transform only suitable for the labels in polar coordinate, labels should distinguish coordinate type.
6
+ */
7
+ export declare function spider(position: LabelPosition, points: Vector2[], value: Record<string, any>, coordinate: Coordinate, options: any): any;
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ var __rest = (this && this.__rest) || function (s, e) {
3
+ var t = {};
4
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
5
+ t[p] = s[p];
6
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
7
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
8
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
9
+ t[p[i]] = s[p[i]];
10
+ }
11
+ return t;
12
+ };
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.spider = void 0;
15
+ const vector_1 = require("../../../utils/vector");
16
+ const coordinate_1 = require("../../../utils/coordinate");
17
+ const helper_1 = require("../../../utils/helper");
18
+ const default_1 = require("./default");
19
+ /**
20
+ * Spider label transform only suitable for the labels in polar coordinate, labels should distinguish coordinate type.
21
+ */
22
+ function spider(position, points, value, coordinate, options) {
23
+ if (!(0, coordinate_1.isCircular)(coordinate))
24
+ return {};
25
+ const { edgeDistance = 0 } = options;
26
+ const style = __rest((0, default_1.inferCircularStyle)('outside', points, value, coordinate), []);
27
+ const { x: coordX, width } = coordinate.getOptions();
28
+ const center = coordinate.getCenter();
29
+ // todo: How to configure spider.
30
+ const margin = (0, helper_1.maybePercentage)(edgeDistance, width);
31
+ const edgeX = coordX + margin;
32
+ const edgeX1 = coordX + width - margin;
33
+ const { x: originX, x0, y0 } = style;
34
+ const dx = originX <= center[0] ? edgeX - originX : edgeX1 - originX;
35
+ style.x += dx;
36
+ const { x, y } = style;
37
+ const p0 = (0, vector_1.sub)([x0, y0], center);
38
+ const p1 = (0, vector_1.sub)([0, y], center);
39
+ const p1x = p0[1] ? (p0[0] * p1[1]) / p0[1] + center[0] : x;
40
+ style.connectorPoints = [[p1x - x, 0]];
41
+ return style;
42
+ }
43
+ exports.spider = spider;
44
+ //# sourceMappingURL=spider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"spider.js","sourceRoot":"src/","sources":["shape/label/position/spider.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AACA,kDAA4C;AAE5C,0DAAuD;AACvD,kDAAwD;AACxD,uCAA8D;AAE9D;;GAEG;AACH,SAAgB,MAAM,CACpB,QAAuB,EACvB,MAAiB,EACjB,KAA0B,EAC1B,UAAsB,EACtB,OAAO;IAEP,IAAI,CAAC,IAAA,uBAAU,EAAC,UAAU,CAAC;QAAE,OAAO,EAAE,CAAC;IACvC,MAAM,EAAE,YAAY,GAAG,CAAC,EAAE,GAAG,OAAO,CAAC;IAErC,MAAW,KAAK,UAAU,IAAA,4BAAkB,EAC1C,SAAS,EACT,MAAM,EACN,KAAK,EACL,UAAU,CACX,EALK,EAAY,CAKjB,CAAC;IACF,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,UAAU,CAAC,UAAU,EAAE,CAAC;IACrD,MAAM,MAAM,GAAG,UAAU,CAAC,SAAS,EAAE,CAAC;IACtC,iCAAiC;IACjC,MAAM,MAAM,GAAG,IAAA,wBAAe,EAAC,YAAY,EAAE,KAAK,CAAC,CAAC;IAEpD,MAAM,KAAK,GAAG,MAAM,GAAG,MAAM,CAAC;IAC9B,MAAM,MAAM,GAAG,MAAM,GAAG,KAAK,GAAG,MAAM,CAAC;IAEvC,MAAM,EAAE,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,KAAK,CAAC;IACrC,MAAM,EAAE,GAAG,OAAO,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,GAAG,OAAO,CAAC,CAAC,CAAC,MAAM,GAAG,OAAO,CAAC;IACrE,KAAK,CAAC,CAAC,IAAI,EAAE,CAAC;IAEd,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,GAAG,KAAK,CAAC;IACvB,MAAM,EAAE,GAAG,IAAA,YAAG,EAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,MAAM,CAAC,CAAC;IACjC,MAAM,EAAE,GAAG,IAAA,YAAG,EAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;IAC/B,MAAM,GAAG,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC5D,KAAK,CAAC,eAAe,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IAEvC,OAAO,KAAK,CAAC;AACf,CAAC;AAnCD,wBAmCC"}
@@ -0,0 +1,7 @@
1
+ import { Coordinate } from '@antv/coord';
2
+ import { Vector2 } from '../../../runtime';
3
+ import { LabelPosition } from './default';
4
+ /**
5
+ * Surround label transform is used to make labels surround circular.
6
+ */
7
+ export declare function surround(position: LabelPosition, points: Vector2[], value: Record<string, any>, coordinate: Coordinate, options: any): any;
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ var __rest = (this && this.__rest) || function (s, e) {
3
+ var t = {};
4
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
5
+ t[p] = s[p];
6
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
7
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
8
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
9
+ t[p[i]] = s[p[i]];
10
+ }
11
+ return t;
12
+ };
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.surround = void 0;
15
+ const coordinate_1 = require("../../../utils/coordinate");
16
+ const vector_1 = require("../../../utils/vector");
17
+ const default_1 = require("./default");
18
+ /**
19
+ * Surround label transform is used to make labels surround circular.
20
+ */
21
+ function surround(position, points, value, coordinate, options) {
22
+ if (!(0, coordinate_1.isCircular)(coordinate))
23
+ return {};
24
+ const { offset = 12 } = options;
25
+ const style = __rest((0, default_1.inferCircularStyle)('outside', points, value, coordinate), []);
26
+ const center = coordinate.getCenter();
27
+ const radius = (0, coordinate_1.getRadius)(coordinate) + offset;
28
+ const { x0, y0, connector, connectorLength2 = 0 } = style;
29
+ const labelAngle = (0, vector_1.angleWithQuadrant)([x0 - center[0], y0 - center[1]]);
30
+ const length2 = connector
31
+ ? connectorLength2 * (Math.sin(labelAngle) < 0 ? -1 : 1)
32
+ : 0;
33
+ const newX = center[0] + Math.sin(labelAngle) * radius;
34
+ const newY = center[1] - Math.cos(labelAngle) * radius;
35
+ style.x = newX + length2;
36
+ style.y = newY;
37
+ style.connectorPoints = [[-length2, 0]];
38
+ return style;
39
+ }
40
+ exports.surround = surround;
41
+ //# sourceMappingURL=surround.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"surround.js","sourceRoot":"src/","sources":["shape/label/position/surround.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAGA,0DAAkE;AAClE,kDAA0D;AAC1D,uCAA8D;AAE9D;;GAEG;AACH,SAAgB,QAAQ,CACtB,QAAuB,EACvB,MAAiB,EACjB,KAA0B,EAC1B,UAAsB,EACtB,OAAO;IAEP,IAAI,CAAC,IAAA,uBAAU,EAAC,UAAU,CAAC;QAAE,OAAO,EAAE,CAAC;IAEvC,MAAM,EAAE,MAAM,GAAG,EAAE,EAAE,GAAG,OAAO,CAAC;IAChC,MAAW,KAAK,UAAU,IAAA,4BAAkB,EAC1C,SAAS,EACT,MAAM,EACN,KAAK,EACL,UAAU,CACX,EALK,EAAY,CAKjB,CAAC;IACF,MAAM,MAAM,GAAG,UAAU,CAAC,SAAS,EAAE,CAAC;IACtC,MAAM,MAAM,GAAG,IAAA,sBAAS,EAAC,UAAU,CAAC,GAAG,MAAM,CAAC;IAE9C,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,SAAS,EAAE,gBAAgB,GAAG,CAAC,EAAE,GAAG,KAAK,CAAC;IAC1D,MAAM,UAAU,GAAG,IAAA,0BAAiB,EAAC,CAAC,EAAE,GAAG,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACvE,MAAM,OAAO,GAAG,SAAS;QACvB,CAAC,CAAC,gBAAgB,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACxD,CAAC,CAAC,CAAC,CAAC;IACN,MAAM,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,GAAG,MAAM,CAAC;IACvD,MAAM,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,GAAG,MAAM,CAAC;IACvD,KAAK,CAAC,CAAC,GAAG,IAAI,GAAG,OAAO,CAAC;IACzB,KAAK,CAAC,CAAC,GAAG,IAAI,CAAC;IACf,KAAK,CAAC,eAAe,GAAG,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC;IAExC,OAAO,KAAK,CAAC;AACf,CAAC;AA/BD,4BA+BC"}
@@ -0,0 +1 @@
1
+ export { getDefaultStyle as top } from './default';
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.top = void 0;
4
+ var default_1 = require("./default");
5
+ Object.defineProperty(exports, "top", { enumerable: true, get: function () { return default_1.getDefaultStyle; } });
6
+ //# sourceMappingURL=top.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"top.js","sourceRoot":"src/","sources":["shape/label/position/top.ts"],"names":[],"mappings":";;;AAAA,qCAAmD;AAA1C,8FAAA,eAAe,OAAO"}
@@ -0,0 +1 @@
1
+ export { getDefaultStyle as topLeft } from './default';
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.topLeft = void 0;
4
+ var default_1 = require("./default");
5
+ Object.defineProperty(exports, "topLeft", { enumerable: true, get: function () { return default_1.getDefaultStyle; } });
6
+ //# sourceMappingURL=topLeft.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"topLeft.js","sourceRoot":"src/","sources":["shape/label/position/topLeft.ts"],"names":[],"mappings":";;;AAAA,qCAAuD;AAA9C,kGAAA,eAAe,OAAW"}
@@ -0,0 +1 @@
1
+ export { getDefaultStyle as topRight } from './default';
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.topRight = void 0;
4
+ var default_1 = require("./default");
5
+ Object.defineProperty(exports, "topRight", { enumerable: true, get: function () { return default_1.getDefaultStyle; } });
6
+ //# sourceMappingURL=topRight.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"topRight.js","sourceRoot":"src/","sources":["shape/label/position/topRight.ts"],"names":[],"mappings":";;;AAAA,qCAAwD;AAA/C,mGAAA,eAAe,OAAY"}
@@ -12,6 +12,7 @@ type EventType = (...args: any[]) => void;
12
12
  export type Node = MarkComposition | ViewComposition | SpaceLayerComposition | SpaceFlexComposition | RepeatMatrixComposition | FacetRectComposition | FacetCircleComposition | GeoViewComposition | TimingKeyframeComposition;
13
13
  export type MarkComposition = Geometry & {
14
14
  title?: Title;
15
+ clip?: boolean;
15
16
  };
16
17
  export type ViewComposition = {
17
18
  type?: 'view';
@@ -47,6 +48,7 @@ export type ViewComposition = {
47
48
  legend?: Record<string, any>;
48
49
  on?: Record<string, EventType | EventType[]>;
49
50
  style?: Record<string, any>;
51
+ clip?: boolean;
50
52
  };
51
53
  export type SpaceLayerComposition = {
52
54
  type?: 'spaceLayer';
@@ -14,8 +14,8 @@ export type InlineConnector = {
14
14
  value?: any;
15
15
  transform?: DataTransform[];
16
16
  };
17
- export type DataTransform = SortByTransform | PickTransform | RenameTransform | SubsetTransform | FoldTransform | JoinTransform | FilterTransform | MapTransform | CustomTransform;
18
- export type DataTransformTypes = 'sortBy' | 'pick' | 'rename' | 'subset' | 'fold' | 'join' | 'filter' | 'map' | 'custom' | DataComponent;
17
+ export type DataTransform = SortByTransform | SortTransform | PickTransform | RenameTransform | SubsetTransform | FoldTransform | JoinTransform | FilterDataTransform | MapTransform | CustomTransform;
18
+ export type DataTransformTypes = 'sortBy' | 'sort' | 'pick' | 'rename' | 'subset' | 'fold' | 'join' | 'filter' | 'map' | 'custom' | DataComponent;
19
19
  export type SortByTransform = {
20
20
  type?: 'sortBy';
21
21
  /** type: [field, order]; order: true => ascend, false => descend */
@@ -35,13 +35,20 @@ export type SubsetTransform = {
35
35
  end?: number;
36
36
  fields?: string[];
37
37
  };
38
- export type FilterTransform = {
38
+ export type FilterDataTransform = {
39
39
  type?: 'filter';
40
40
  /**
41
41
  * The filter condition, same with [Array.prototype.filter](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Array/filter).
42
42
  */
43
43
  callback?: (v: any, idx: number, arr: any[]) => boolean;
44
44
  };
45
+ export type SortTransform = {
46
+ type?: 'sort';
47
+ /**
48
+ * The sort comparator, same with [Array.prototype.sort](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort).
49
+ */
50
+ callback?: (a: any, b: any) => number;
51
+ };
45
52
  export type FoldTransform = {
46
53
  type?: 'fold';
47
54
  fields?: string[];
@@ -9,7 +9,7 @@ import { Theme } from './theme';
9
9
  import { ClusterTransform, Data } from './data';
10
10
  export type Geometry = IntervalGeometry | RectGeometry | LineGeometry | PointGeometry | TextGeometry | CellGeometry | AreaGeometry | NodeGeometry | EdgeGeometry | ImageGeometry | PolygonGeometry | BoxGeometry | VectorGeometry | LineXMark | LineYMark | RangeMark | RangeXMark | RangeYMark | ConnectorMark | SankeyMark | PathMark | TreemapMark | PackMark | BoxPlotMark | ShapeMark | ForceGraphMark | TreeMark | WordCloudMark | CustomComponent;
11
11
  export type GeometryTypes = 'interval' | 'rect' | 'line' | 'point' | 'text' | 'cell' | 'area' | 'node' | 'edge' | 'link' | 'image' | 'polygon' | 'box' | 'vector' | 'lineX' | 'lineY' | 'connector' | 'range' | 'rangeX' | 'rangeY' | 'sankey' | 'path' | 'treemap' | 'pack' | 'boxplot' | 'shape' | 'forceGraph' | 'tree' | 'wordCloud' | MarkComponent;
12
- export type ChannelTypes = 'x' | 'y' | 'x1' | 'y1' | 'series' | 'color' | 'opacity' | 'shape' | 'enterType' | 'enterEasing' | 'enterDuration' | 'enterDelay' | 'enter' | 'size' | 'tooltip' | 'title' | 'key' | 'groupKey' | 'label' | 'position' | 'series';
12
+ export type ChannelTypes = 'x' | 'y' | 'x1' | 'y1' | 'series' | 'color' | 'opacity' | 'shape' | 'enterType' | 'enterEasing' | 'enterDuration' | 'enterDelay' | 'enter' | 'size' | 'tooltip' | 'title' | 'key' | 'groupKey' | 'label' | 'position' | 'series' | `tooltip${number}`;
13
13
  export type BaseGeometry<T extends GeometryTypes, C extends string = ChannelTypes> = {
14
14
  type?: T | string;
15
15
  class?: string;
@@ -35,6 +35,7 @@ export type BaseGeometry<T extends GeometryTypes, C extends string = ChannelType
35
35
  scale?: Partial<Record<C, Scale>>;
36
36
  axis?: Partial<Record<'x' | 'y' | 'position' | `position${number}`, Axis | boolean>> | boolean;
37
37
  legend?: Partial<Record<'size' | 'color', Legend | boolean>> | boolean;
38
+ slider?: Partial<Record<'x' | 'y', any>>;
38
39
  coordinates?: Coordinate[];
39
40
  style?: Record<string, any>;
40
41
  interactions?: Interaction[];
@@ -1,17 +1,34 @@
1
+ import { ChannelTypes } from 'spec';
1
2
  import { InteractionComponent } from '../runtime';
2
3
  import { ActiveRegionAction, PoptipAction, TooltipAction } from './action';
3
4
  import { FisheyeCoordinate } from './coordinate';
4
- export type Interaction = ElementHighlightInteraction | ElementHighlightByColorInteraction | ElementHighlightByXInteraction | ElementSelectByColorInteraction | ElementSelectByXInteraction | ElementSelectInteraction | TooltipInteraction | FisheyeInteraction | ChartIndex | CustomInteraction;
5
- export type InteractionTypes = 'elementHighlight' | 'elementHighlightByX' | 'elementHighlightByColor' | 'fisheye' | 'chartIndex' | 'elementSelect' | 'elementSelectByX' | 'elementSelectByColor' | 'fisheye' | 'tooltip' | InteractionComponent;
5
+ export type Interaction = ElementHighlightInteraction | ElementHighlightByColorInteraction | ElementHighlightByXInteraction | ElementSelectByColorInteraction | ElementSelectByXInteraction | ElementSelectInteraction | TooltipInteraction | FisheyeInteraction | ChartIndex | CustomInteraction | LegendFilterInteraction | BrushHighlightInteraction | BrushXHighlightInteraction | BrushYHighlightInteraction;
6
+ export type InteractionTypes = 'elementHighlight' | 'elementHighlightByX' | 'elementHighlightByColor' | 'fisheye' | 'chartIndex' | 'elementSelect' | 'elementSelectByX' | 'elementSelectByColor' | 'fisheye' | 'tooltip' | 'legendFilter' | 'brushXHighlight' | 'brushYHighlight' | 'brushHighlight' | InteractionComponent;
6
7
  export type BrushInteraction = {
7
8
  type?: 'brush';
8
9
  brushType?: 'rect' | 'rectX' | 'rectY' | 'polygon';
9
10
  };
10
11
  export type BrushHighlightInteraction = {
11
12
  type?: 'brushHighlight';
12
- brushType?: 'rect' | 'rectX' | 'rectY' | 'polygon';
13
- multiple?: boolean;
14
- };
13
+ reverse?: boolean;
14
+ shared?: boolean;
15
+ series?: boolean;
16
+ facet?: boolean;
17
+ } & Record<`${'mask' | 'highlighted' | 'unhighlighted'}${any}`, any>;
18
+ export type BrushXHighlightInteraction = {
19
+ type?: 'brushXHighlight';
20
+ reverse?: boolean;
21
+ shared?: boolean;
22
+ series?: boolean;
23
+ facet?: boolean;
24
+ } & Record<`${'mask' | 'highlighted' | 'unhighlighted'}${any}`, any>;
25
+ export type BrushYHighlightInteraction = {
26
+ type?: 'brushYHighlight';
27
+ reverse?: boolean;
28
+ shared?: boolean;
29
+ series?: boolean;
30
+ facet?: boolean;
31
+ } & Record<`${'mask' | 'highlighted' | 'unhighlighted'}${any}`, any>;
15
32
  export type BrushVisibleInteraction = {
16
33
  type?: 'brushVisible';
17
34
  brushType?: 'rect' | 'rectX' | 'rectY' | 'polygon';
@@ -41,6 +58,11 @@ export type ElementHighlightByColorInteraction = {
41
58
  type?: 'elementHighlightByColor';
42
59
  color?: string;
43
60
  } & Record<`${'link' | 'highlighted' | 'unhighlighted'}${any}`, any>;
61
+ export type LegendFilterInteraction = {
62
+ type?: 'legendFilter';
63
+ channel?: ChannelTypes;
64
+ [key: string]: any;
65
+ } & Record<`${'marker' | 'label'}Unselected${any}`, any>;
44
66
  export type ChartIndex = {
45
67
  type?: 'chartIndex';
46
68
  wait?: number;
@@ -60,6 +82,7 @@ export type TooltipInteraction = Omit<TooltipAction, 'type'> & {
60
82
  type?: 'tooltip';
61
83
  shared?: boolean;
62
84
  series?: boolean;
85
+ facet?: boolean;
63
86
  item?: any;
64
87
  };
65
88
  export type FisheyeInteraction = {
@@ -1,17 +1,30 @@
1
- export type LabelTransform = HideOverlapLabelTransform | DodgeYLabelTransform;
2
- export type HideOverlapLabelTransform = {
3
- type?: 'hideOverlap';
1
+ import { DisplayObject } from '@antv/g';
2
+ export type LabelTransform = OverlapHideTransform | OverlapDodgeYTransform | ContrastReverseTransform | OverflowHideTransform;
3
+ export type OverlapHideTransform = {
4
+ type?: 'overlapHide';
5
+ /**
6
+ * The hide priority, is the comparator for label.sort().
7
+ */
8
+ priority?: (a: DisplayObject, b: DisplayObject) => number;
4
9
  };
5
- export type DodgeYLabelTransform = {
6
- type?: 'dodgeY';
7
- maxIter?: number;
10
+ export type OverlapDodgeYTransform = {
11
+ type?: 'overlapDodgeY';
12
+ maxIterations?: number;
8
13
  maxError?: number;
9
14
  padding?: number;
10
15
  };
11
- export type SpiderLabelTransform = {
12
- type?: 'spider';
13
- edgeDistance?: string | number;
16
+ export type ContrastReverseTransform = {
17
+ type: 'contrastReverse';
18
+ /**
19
+ * Transform when the contrast ratio < threshold.
20
+ * Default is `4.5`.
21
+ */
22
+ threshold?: number;
23
+ /**
24
+ * The optional color palette, default is [#000, #fff].
25
+ */
26
+ palette?: string[];
14
27
  };
15
- export type SurroundLabelTransform = {
16
- type?: 'surround';
28
+ export type OverflowHideTransform = {
29
+ type: 'overflowHide';
17
30
  };
@@ -1,12 +1,15 @@
1
1
  import { Theme as ThemeOptions, ThemeComponent } from '../runtime/types/component';
2
- export type Theme = LightTheme | DarkTheme | CustomTheme;
3
- export type ThemeTypes = 'light' | 'dark' | ThemeComponent;
2
+ export type Theme = LightTheme | DarkTheme | AcademyTheme | CustomTheme;
3
+ export type ThemeTypes = 'light' | 'dark' | 'academy' | ThemeComponent;
4
4
  export type LightTheme = {
5
5
  type?: 'light';
6
6
  } & ThemeOptions;
7
7
  export type DarkTheme = {
8
8
  type?: 'dark';
9
9
  } & ThemeOptions;
10
+ export type AcademyTheme = {
11
+ type?: 'academy';
12
+ } & ThemeOptions;
10
13
  export type CustomTheme = {
11
14
  type?: ThemeComponent;
12
15
  } & ThemeOptions;