@antv/g2 5.0.0-alpha.0 → 5.0.0-alpha.1

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 (923) hide show
  1. package/README.en-US.md +47 -75
  2. package/README.md +47 -83
  3. package/dist/g2.min.js +3 -3
  4. package/esm/animation/fadeIn.js +4 -6
  5. package/esm/animation/fadeIn.js.map +1 -1
  6. package/esm/animation/fadeOut.js +4 -4
  7. package/esm/animation/fadeOut.js.map +1 -1
  8. package/esm/animation/morphing.js +4 -5
  9. package/esm/animation/morphing.js.map +1 -1
  10. package/esm/animation/scaleInX.js +4 -5
  11. package/esm/animation/scaleInX.js.map +1 -1
  12. package/esm/animation/scaleInY.js +4 -5
  13. package/esm/animation/scaleInY.js.map +1 -1
  14. package/esm/animation/scaleOutX.js +4 -5
  15. package/esm/animation/scaleOutX.js.map +1 -1
  16. package/esm/animation/scaleOutY.js +4 -5
  17. package/esm/animation/scaleOutY.js.map +1 -1
  18. package/esm/api/chart.d.ts +4 -1
  19. package/esm/api/chart.js +12 -4
  20. package/esm/api/chart.js.map +1 -1
  21. package/esm/api/composition/circle.js.map +1 -1
  22. package/esm/api/composition/flex.js.map +1 -1
  23. package/esm/api/composition/keyframe.js.map +1 -1
  24. package/esm/api/composition/layer.js.map +1 -1
  25. package/esm/api/composition/matrix.js.map +1 -1
  26. package/esm/api/composition/rect.js.map +1 -1
  27. package/esm/api/composition/view.js.map +1 -1
  28. package/esm/api/index.d.ts +1 -0
  29. package/esm/api/index.js +1 -0
  30. package/esm/api/index.js.map +1 -1
  31. package/esm/api/library.d.ts +3 -0
  32. package/esm/api/library.js +7 -0
  33. package/esm/api/library.js.map +1 -0
  34. package/esm/api/mark/mark.js.map +1 -1
  35. package/esm/composition/circle.js +1 -1
  36. package/esm/composition/circle.js.map +1 -1
  37. package/esm/composition/flex.js +4 -2
  38. package/esm/composition/flex.js.map +1 -1
  39. package/esm/composition/layer.js +3 -3
  40. package/esm/composition/layer.js.map +1 -1
  41. package/esm/composition/mark.js +2 -1
  42. package/esm/composition/mark.js.map +1 -1
  43. package/esm/composition/rect.js +29 -30
  44. package/esm/composition/rect.js.map +1 -1
  45. package/esm/composition/utils.d.ts +6 -0
  46. package/esm/composition/utils.js +19 -0
  47. package/esm/composition/utils.js.map +1 -1
  48. package/esm/composition/view.js +3 -2
  49. package/esm/composition/view.js.map +1 -1
  50. package/esm/coordinate/fisheye.d.ts +1 -1
  51. package/esm/coordinate/fisheye.js +1 -1
  52. package/esm/coordinate/fisheye.js.map +1 -1
  53. package/esm/coordinate/fisheyeX.d.ts +7 -0
  54. package/esm/coordinate/fisheyeX.js +6 -0
  55. package/esm/coordinate/fisheyeX.js.map +1 -0
  56. package/esm/coordinate/fisheyeY.d.ts +7 -0
  57. package/esm/coordinate/fisheyeY.js +6 -0
  58. package/esm/coordinate/fisheyeY.js.map +1 -0
  59. package/esm/coordinate/helix.d.ts +7 -0
  60. package/esm/coordinate/helix.js +11 -0
  61. package/esm/coordinate/helix.js.map +1 -0
  62. package/esm/coordinate/index.d.ts +7 -0
  63. package/esm/coordinate/index.js +7 -0
  64. package/esm/coordinate/index.js.map +1 -1
  65. package/esm/coordinate/reflect.d.ts +7 -0
  66. package/esm/coordinate/reflect.js +10 -0
  67. package/esm/coordinate/reflect.js.map +1 -0
  68. package/esm/coordinate/reflectX.d.ts +7 -0
  69. package/esm/coordinate/reflectX.js +10 -0
  70. package/esm/coordinate/reflectX.js.map +1 -0
  71. package/esm/coordinate/reflectY.d.ts +7 -0
  72. package/esm/coordinate/reflectY.js +10 -0
  73. package/esm/coordinate/reflectY.js.map +1 -0
  74. package/esm/coordinate/theta.d.ts +7 -0
  75. package/esm/coordinate/theta.js +11 -0
  76. package/esm/coordinate/theta.js.map +1 -0
  77. package/esm/data/arc.d.ts +0 -0
  78. package/esm/data/arc.js +19 -0
  79. package/esm/data/arc.js.map +1 -0
  80. package/esm/data/cluster.d.ts +0 -0
  81. package/esm/data/cluster.js +47 -0
  82. package/esm/data/cluster.js.map +1 -0
  83. package/esm/data/connector.d.ts +7 -0
  84. package/esm/data/connector.js +9 -0
  85. package/esm/data/connector.js.map +1 -0
  86. package/esm/data/fetch.d.ts +4 -0
  87. package/esm/{transform/preprocessor → data}/fetch.js +10 -19
  88. package/esm/data/fetch.js.map +1 -0
  89. package/esm/{transform/preprocessor → data}/filterBy.d.ts +3 -3
  90. package/esm/{transform/preprocessor → data}/filterBy.js +2 -7
  91. package/esm/data/filterBy.js.map +1 -0
  92. package/esm/data/fold.d.ts +10 -0
  93. package/esm/data/fold.js +24 -0
  94. package/esm/data/fold.js.map +1 -0
  95. package/esm/data/index.d.ts +9 -0
  96. package/esm/data/index.js +10 -0
  97. package/esm/data/index.js.map +1 -0
  98. package/esm/data/inline.d.ts +4 -0
  99. package/esm/data/inline.js +6 -0
  100. package/esm/data/inline.js.map +1 -0
  101. package/esm/data/pick.d.ts +7 -0
  102. package/esm/{transform/preprocessor → data}/pick.js +1 -3
  103. package/esm/data/pick.js.map +1 -0
  104. package/esm/{transform/preprocessor → data}/rename.d.ts +3 -3
  105. package/esm/{transform/preprocessor → data}/rename.js +4 -7
  106. package/esm/data/rename.js.map +1 -0
  107. package/esm/data/sankey.d.ts +0 -0
  108. package/esm/data/sankey.js +96 -0
  109. package/esm/data/sankey.js.map +1 -0
  110. package/esm/data/sortBy.d.ts +7 -0
  111. package/esm/{transform/preprocessor → data}/sortBy.js +4 -9
  112. package/esm/data/sortBy.js.map +1 -0
  113. package/esm/data/subset.d.ts +7 -0
  114. package/esm/{transform/preprocessor → data}/subset.js +5 -10
  115. package/esm/data/subset.js.map +1 -0
  116. package/esm/data/tree.d.ts +0 -0
  117. package/esm/data/tree.js +10 -0
  118. package/esm/data/tree.js.map +1 -0
  119. package/esm/{transform → data}/utils/arc/arc.d.ts +0 -0
  120. package/esm/{transform → data}/utils/arc/arc.js +0 -0
  121. package/esm/data/utils/arc/arc.js.map +1 -0
  122. package/esm/{transform → data}/utils/arc/index.d.ts +0 -0
  123. package/esm/{transform → data}/utils/arc/index.js +0 -0
  124. package/esm/data/utils/arc/index.js.map +1 -0
  125. package/esm/{transform → data}/utils/arc/sort.d.ts +0 -0
  126. package/esm/{transform → data}/utils/arc/sort.js +0 -0
  127. package/esm/data/utils/arc/sort.js.map +1 -0
  128. package/esm/{transform → data}/utils/arc/types.d.ts +0 -0
  129. package/esm/{transform → data}/utils/arc/types.js +0 -0
  130. package/esm/data/utils/arc/types.js.map +1 -0
  131. package/esm/{transform → data}/utils/d3-cloud/index.d.ts +0 -0
  132. package/esm/{transform → data}/utils/d3-cloud/index.js +0 -0
  133. package/esm/data/utils/d3-cloud/index.js.map +1 -0
  134. package/esm/{transform → data}/utils/d3-sankey/align.d.ts +0 -0
  135. package/esm/{transform → data}/utils/d3-sankey/align.js +0 -0
  136. package/esm/data/utils/d3-sankey/align.js.map +1 -0
  137. package/esm/{transform → data}/utils/d3-sankey/constant.d.ts +0 -0
  138. package/esm/{transform → data}/utils/d3-sankey/constant.js +0 -0
  139. package/esm/data/utils/d3-sankey/constant.js.map +1 -0
  140. package/esm/{transform → data}/utils/d3-sankey/index.d.ts +0 -0
  141. package/esm/{transform → data}/utils/d3-sankey/index.js +0 -0
  142. package/esm/data/utils/d3-sankey/index.js.map +1 -0
  143. package/esm/{transform → data}/utils/d3-sankey/sankey.d.ts +0 -0
  144. package/esm/{transform → data}/utils/d3-sankey/sankey.js +0 -0
  145. package/esm/data/utils/d3-sankey/sankey.js.map +1 -0
  146. package/esm/{transform → data}/utils/flow.d.ts +0 -0
  147. package/esm/{transform → data}/utils/flow.js +0 -0
  148. package/esm/data/utils/flow.js.map +1 -0
  149. package/esm/{transform → data}/utils/memo.d.ts +0 -0
  150. package/esm/{transform → data}/utils/memo.js +0 -0
  151. package/esm/data/utils/memo.js.map +1 -0
  152. package/esm/data/voronoi.d.ts +0 -0
  153. package/esm/data/voronoi.js +27 -0
  154. package/esm/data/voronoi.js.map +1 -0
  155. package/esm/data/wordCloud.d.ts +0 -0
  156. package/esm/data/wordCloud.js +100 -0
  157. package/esm/data/wordCloud.js.map +1 -0
  158. package/esm/index.d.ts +1 -1
  159. package/esm/index.js +1 -1
  160. package/esm/index.js.map +1 -1
  161. package/esm/interaction/action/service/fisheyeFocus.js +7 -3
  162. package/esm/interaction/action/service/fisheyeFocus.js.map +1 -1
  163. package/esm/interaction/action/transformer/filter.js +9 -3
  164. package/esm/interaction/action/transformer/filter.js.map +1 -1
  165. package/esm/interaction/builtin/fisheye.d.ts +2 -0
  166. package/esm/labelLayout/hideOverlap.d.ts +2 -0
  167. package/esm/labelLayout/hideOverlap.js +38 -0
  168. package/esm/labelLayout/hideOverlap.js.map +1 -0
  169. package/esm/labelLayout/index.d.ts +1 -0
  170. package/esm/labelLayout/index.js +2 -0
  171. package/esm/labelLayout/index.js.map +1 -0
  172. package/esm/mark/utils.d.ts +1 -3
  173. package/esm/mark/utils.js +1 -1
  174. package/esm/mark/utils.js.map +1 -1
  175. package/esm/runtime/component.js +11 -3
  176. package/esm/runtime/component.js.map +1 -1
  177. package/esm/runtime/coordinate.d.ts +4 -0
  178. package/esm/runtime/coordinate.js +16 -0
  179. package/esm/runtime/coordinate.js.map +1 -1
  180. package/esm/runtime/index.d.ts +1 -0
  181. package/esm/runtime/index.js +1 -0
  182. package/esm/runtime/index.js.map +1 -1
  183. package/esm/runtime/layout.js.map +1 -1
  184. package/esm/runtime/mark.d.ts +3 -3
  185. package/esm/runtime/mark.js +34 -90
  186. package/esm/runtime/mark.js.map +1 -1
  187. package/esm/runtime/plot.js +19 -13
  188. package/esm/runtime/plot.js.map +1 -1
  189. package/esm/runtime/render.js +4 -15
  190. package/esm/runtime/render.js.map +1 -1
  191. package/esm/runtime/scale.js +14 -5
  192. package/esm/runtime/scale.js.map +1 -1
  193. package/esm/runtime/transform.d.ts +9 -0
  194. package/esm/runtime/transform.js +144 -0
  195. package/esm/runtime/transform.js.map +1 -0
  196. package/esm/runtime/types/common.d.ts +5 -3
  197. package/esm/runtime/types/component.d.ts +5 -2
  198. package/esm/runtime/types/data.d.ts +7 -0
  199. package/esm/runtime/types/data.js +2 -0
  200. package/esm/runtime/types/data.js.map +1 -0
  201. package/esm/runtime/types/encode.d.ts +4 -2
  202. package/esm/runtime/types/options.d.ts +6 -3
  203. package/esm/runtime/types/transform.d.ts +6 -12
  204. package/esm/shape/interval/colorRect.js +4 -22
  205. package/esm/shape/interval/colorRect.js.map +1 -1
  206. package/esm/shape/label/label.js +81 -10
  207. package/esm/shape/label/label.js.map +1 -1
  208. package/esm/shape/utils.d.ts +7 -0
  209. package/esm/shape/utils.js +23 -0
  210. package/esm/shape/utils.js.map +1 -1
  211. package/esm/spec/composition.d.ts +8 -5
  212. package/esm/spec/coordinate.d.ts +46 -2
  213. package/esm/spec/data.d.ts +54 -0
  214. package/esm/spec/data.js +2 -0
  215. package/esm/spec/data.js.map +1 -0
  216. package/esm/spec/geometry.d.ts +2 -1
  217. package/esm/spec/index.d.ts +2 -1
  218. package/esm/spec/index.js +2 -1
  219. package/esm/spec/index.js.map +1 -1
  220. package/esm/spec/labelLayout.d.ts +4 -0
  221. package/esm/spec/labelLayout.js +2 -0
  222. package/esm/spec/labelLayout.js.map +1 -0
  223. package/esm/spec/transform.d.ts +58 -166
  224. package/esm/spec/transform.js +133 -0
  225. package/esm/spec/transform.js.map +1 -1
  226. package/esm/stdlib/index.js +28 -17
  227. package/esm/stdlib/index.js.map +1 -1
  228. package/esm/theme/light.js +1 -0
  229. package/esm/theme/light.js.map +1 -1
  230. package/esm/transform/{statistic/Select.d.ts → Select.d.ts} +2 -2
  231. package/esm/transform/{statistic/Select.js → Select.js} +9 -14
  232. package/esm/transform/Select.js.map +1 -0
  233. package/esm/transform/{statistic/SelectX.d.ts → SelectX.d.ts} +2 -2
  234. package/esm/transform/{statistic/SelectX.js → SelectX.js} +1 -3
  235. package/esm/transform/SelectX.js.map +1 -0
  236. package/esm/transform/{statistic/SelectY.d.ts → SelectY.d.ts} +2 -2
  237. package/esm/transform/{statistic/SelectY.js → SelectY.js} +1 -3
  238. package/esm/transform/SelectY.js.map +1 -0
  239. package/esm/transform/{statistic/dodgeX.d.ts → dodgeX.d.ts} +2 -2
  240. package/esm/transform/{statistic/dodgeX.js → dodgeX.js} +19 -19
  241. package/esm/transform/dodgeX.js.map +1 -0
  242. package/{lib/transform/statistic → esm/transform}/groupX.d.ts +3 -2
  243. package/esm/transform/{statistic/groupX.js → groupX.js} +23 -19
  244. package/esm/transform/groupX.js.map +1 -0
  245. package/esm/transform/index.d.ts +21 -36
  246. package/esm/transform/index.js +21 -39
  247. package/esm/transform/index.js.map +1 -1
  248. package/esm/transform/{statistic/jitter.d.ts → jitter.d.ts} +3 -3
  249. package/esm/transform/{statistic/jitter.js → jitter.js} +14 -18
  250. package/esm/transform/jitter.js.map +1 -0
  251. package/{lib/transform/statistic → esm/transform}/jitterY.d.ts +2 -2
  252. package/esm/transform/jitterY.js +21 -0
  253. package/esm/transform/jitterY.js.map +1 -0
  254. package/esm/transform/maybeKey.d.ts +6 -0
  255. package/esm/transform/{inference/maybeKey.js → maybeKey.js} +11 -12
  256. package/esm/transform/maybeKey.js.map +1 -0
  257. package/esm/transform/maybeSeries.d.ts +6 -0
  258. package/esm/transform/maybeSeries.js +17 -0
  259. package/esm/transform/maybeSeries.js.map +1 -0
  260. package/esm/transform/maybeSize.d.ts +7 -0
  261. package/esm/transform/maybeSize.js +20 -0
  262. package/esm/transform/maybeSize.js.map +1 -0
  263. package/{lib/transform/inference → esm/transform}/maybeStackY.d.ts +1 -1
  264. package/esm/transform/{inference/maybeStackY.js → maybeStackY.js} +11 -13
  265. package/esm/transform/maybeStackY.js.map +1 -0
  266. package/esm/transform/maybeTitleX.d.ts +6 -0
  267. package/esm/transform/maybeTitleX.js +17 -0
  268. package/esm/transform/maybeTitleX.js.map +1 -0
  269. package/esm/transform/maybeTooltip.d.ts +8 -0
  270. package/esm/transform/maybeTooltip.js +29 -0
  271. package/esm/transform/maybeTooltip.js.map +1 -0
  272. package/esm/transform/{inference/maybeTooltipPosition.d.ts → maybeTooltipPosition.d.ts} +3 -3
  273. package/esm/transform/maybeTooltipPosition.js +10 -0
  274. package/esm/transform/maybeTooltipPosition.js.map +1 -0
  275. package/esm/transform/maybeTooltipY.d.ts +6 -0
  276. package/esm/transform/maybeTooltipY.js +9 -0
  277. package/esm/transform/maybeTooltipY.js.map +1 -0
  278. package/{lib/transform/inference → esm/transform}/maybeZeroX.d.ts +1 -1
  279. package/esm/transform/maybeZeroX.js +22 -0
  280. package/esm/transform/maybeZeroX.js.map +1 -0
  281. package/esm/transform/maybeZeroY.d.ts +6 -0
  282. package/esm/transform/maybeZeroY.js +21 -0
  283. package/esm/transform/maybeZeroY.js.map +1 -0
  284. package/esm/transform/maybeZeroY1.d.ts +6 -0
  285. package/esm/transform/maybeZeroY1.js +21 -0
  286. package/esm/transform/maybeZeroY1.js.map +1 -0
  287. package/esm/transform/{statistic/normalizeY.d.ts → normalizeY.d.ts} +2 -2
  288. package/esm/transform/{statistic/normalizeY.js → normalizeY.js} +16 -17
  289. package/esm/transform/normalizeY.js.map +1 -0
  290. package/esm/transform/{statistic/stackEnter.d.ts → stackEnter.d.ts} +2 -2
  291. package/esm/transform/{statistic/stackEnter.js → stackEnter.js} +22 -19
  292. package/esm/transform/stackEnter.js.map +1 -0
  293. package/esm/transform/{statistic/stackY.d.ts → stackY.d.ts} +2 -2
  294. package/esm/transform/{statistic/stackY.js → stackY.js} +20 -19
  295. package/esm/transform/stackY.js.map +1 -0
  296. package/esm/transform/{statistic/symmetryY.d.ts → symmetryY.d.ts} +2 -2
  297. package/esm/transform/{statistic/symmetryY.js → symmetryY.js} +16 -17
  298. package/esm/transform/symmetryY.js.map +1 -0
  299. package/esm/transform/utils/helper.d.ts +11 -10
  300. package/esm/transform/utils/helper.js +27 -33
  301. package/esm/transform/utils/helper.js.map +1 -1
  302. package/esm/transform/{statistic/utils.d.ts → utils/order.d.ts} +4 -4
  303. package/esm/transform/{statistic/utils.js → utils/order.js} +7 -5
  304. package/esm/transform/utils/order.js.map +1 -0
  305. package/esm/utils/coordinate.d.ts +1 -0
  306. package/esm/utils/coordinate.js +4 -0
  307. package/esm/utils/coordinate.js.map +1 -1
  308. package/lib/animation/fadeIn.js +4 -6
  309. package/lib/animation/fadeIn.js.map +1 -1
  310. package/lib/animation/fadeOut.js +4 -4
  311. package/lib/animation/fadeOut.js.map +1 -1
  312. package/lib/animation/morphing.js +4 -5
  313. package/lib/animation/morphing.js.map +1 -1
  314. package/lib/animation/scaleInX.js +4 -5
  315. package/lib/animation/scaleInX.js.map +1 -1
  316. package/lib/animation/scaleInY.js +4 -5
  317. package/lib/animation/scaleInY.js.map +1 -1
  318. package/lib/animation/scaleOutX.js +4 -5
  319. package/lib/animation/scaleOutX.js.map +1 -1
  320. package/lib/animation/scaleOutY.js +4 -5
  321. package/lib/animation/scaleOutY.js.map +1 -1
  322. package/lib/api/chart.d.ts +4 -1
  323. package/lib/api/chart.js +12 -4
  324. package/lib/api/chart.js.map +1 -1
  325. package/lib/api/composition/circle.js.map +1 -1
  326. package/lib/api/composition/flex.js.map +1 -1
  327. package/lib/api/composition/keyframe.js.map +1 -1
  328. package/lib/api/composition/layer.js.map +1 -1
  329. package/lib/api/composition/matrix.js.map +1 -1
  330. package/lib/api/composition/rect.js.map +1 -1
  331. package/lib/api/composition/view.js.map +1 -1
  332. package/lib/api/index.d.ts +1 -0
  333. package/lib/api/index.js +3 -1
  334. package/lib/api/index.js.map +1 -1
  335. package/lib/api/library.d.ts +3 -0
  336. package/lib/api/library.js +11 -0
  337. package/lib/api/library.js.map +1 -0
  338. package/lib/api/mark/mark.js.map +1 -1
  339. package/lib/composition/circle.js +1 -1
  340. package/lib/composition/circle.js.map +1 -1
  341. package/lib/composition/flex.js +4 -2
  342. package/lib/composition/flex.js.map +1 -1
  343. package/lib/composition/layer.js +3 -3
  344. package/lib/composition/layer.js.map +1 -1
  345. package/lib/composition/mark.js +2 -1
  346. package/lib/composition/mark.js.map +1 -1
  347. package/lib/composition/rect.js +29 -30
  348. package/lib/composition/rect.js.map +1 -1
  349. package/lib/composition/utils.d.ts +6 -0
  350. package/lib/composition/utils.js +21 -1
  351. package/lib/composition/utils.js.map +1 -1
  352. package/lib/composition/view.js +3 -2
  353. package/lib/composition/view.js.map +1 -1
  354. package/lib/coordinate/fisheye.d.ts +1 -1
  355. package/lib/coordinate/fisheye.js +1 -1
  356. package/lib/coordinate/fisheye.js.map +1 -1
  357. package/lib/coordinate/fisheyeX.d.ts +7 -0
  358. package/lib/coordinate/fisheyeX.js +10 -0
  359. package/lib/coordinate/fisheyeX.js.map +1 -0
  360. package/lib/coordinate/fisheyeY.d.ts +7 -0
  361. package/lib/coordinate/fisheyeY.js +10 -0
  362. package/lib/coordinate/fisheyeY.js.map +1 -0
  363. package/lib/coordinate/helix.d.ts +7 -0
  364. package/lib/coordinate/helix.js +15 -0
  365. package/lib/coordinate/helix.js.map +1 -0
  366. package/lib/coordinate/index.d.ts +7 -0
  367. package/lib/coordinate/index.js +15 -1
  368. package/lib/coordinate/index.js.map +1 -1
  369. package/lib/coordinate/reflect.d.ts +7 -0
  370. package/lib/coordinate/reflect.js +14 -0
  371. package/lib/coordinate/reflect.js.map +1 -0
  372. package/lib/coordinate/reflectX.d.ts +7 -0
  373. package/lib/coordinate/reflectX.js +14 -0
  374. package/lib/coordinate/reflectX.js.map +1 -0
  375. package/lib/coordinate/reflectY.d.ts +7 -0
  376. package/lib/coordinate/reflectY.js +14 -0
  377. package/lib/coordinate/reflectY.js.map +1 -0
  378. package/lib/coordinate/theta.d.ts +7 -0
  379. package/lib/coordinate/theta.js +15 -0
  380. package/lib/coordinate/theta.js.map +1 -0
  381. package/lib/data/arc.d.ts +0 -0
  382. package/lib/data/arc.js +19 -0
  383. package/lib/data/arc.js.map +1 -0
  384. package/lib/data/cluster.d.ts +0 -0
  385. package/lib/data/cluster.js +47 -0
  386. package/lib/data/cluster.js.map +1 -0
  387. package/lib/data/connector.d.ts +7 -0
  388. package/lib/data/connector.js +13 -0
  389. package/lib/data/connector.js.map +1 -0
  390. package/lib/data/fetch.d.ts +4 -0
  391. package/lib/{transform/preprocessor → data}/fetch.js +10 -19
  392. package/lib/data/fetch.js.map +1 -0
  393. package/lib/{transform/preprocessor → data}/filterBy.d.ts +3 -3
  394. package/lib/{transform/preprocessor → data}/filterBy.js +2 -7
  395. package/lib/data/filterBy.js.map +1 -0
  396. package/lib/data/fold.d.ts +10 -0
  397. package/lib/data/fold.js +29 -0
  398. package/lib/data/fold.js.map +1 -0
  399. package/lib/data/index.d.ts +9 -0
  400. package/lib/data/index.js +22 -0
  401. package/lib/data/index.js.map +1 -0
  402. package/lib/data/inline.d.ts +4 -0
  403. package/lib/data/inline.js +10 -0
  404. package/lib/data/inline.js.map +1 -0
  405. package/lib/data/pick.d.ts +7 -0
  406. package/lib/{transform/preprocessor → data}/pick.js +1 -3
  407. package/lib/data/pick.js.map +1 -0
  408. package/lib/{transform/preprocessor → data}/rename.d.ts +3 -3
  409. package/lib/{transform/preprocessor → data}/rename.js +4 -7
  410. package/lib/data/rename.js.map +1 -0
  411. package/lib/data/sankey.d.ts +0 -0
  412. package/lib/data/sankey.js +96 -0
  413. package/lib/data/sankey.js.map +1 -0
  414. package/lib/data/sortBy.d.ts +7 -0
  415. package/lib/{transform/preprocessor → data}/sortBy.js +4 -9
  416. package/lib/data/sortBy.js.map +1 -0
  417. package/lib/data/subset.d.ts +7 -0
  418. package/lib/{transform/preprocessor → data}/subset.js +5 -10
  419. package/lib/data/subset.js.map +1 -0
  420. package/lib/data/tree.d.ts +0 -0
  421. package/lib/data/tree.js +10 -0
  422. package/lib/data/tree.js.map +1 -0
  423. package/lib/{transform → data}/utils/arc/arc.d.ts +0 -0
  424. package/lib/{transform → data}/utils/arc/arc.js +0 -0
  425. package/lib/data/utils/arc/arc.js.map +1 -0
  426. package/lib/{transform → data}/utils/arc/index.d.ts +0 -0
  427. package/lib/{transform → data}/utils/arc/index.js +0 -0
  428. package/lib/data/utils/arc/index.js.map +1 -0
  429. package/lib/{transform → data}/utils/arc/sort.d.ts +0 -0
  430. package/lib/{transform → data}/utils/arc/sort.js +0 -0
  431. package/lib/data/utils/arc/sort.js.map +1 -0
  432. package/lib/{transform → data}/utils/arc/types.d.ts +0 -0
  433. package/lib/{transform → data}/utils/arc/types.js +0 -0
  434. package/lib/data/utils/arc/types.js.map +1 -0
  435. package/lib/{transform → data}/utils/d3-cloud/index.d.ts +0 -0
  436. package/lib/{transform → data}/utils/d3-cloud/index.js +0 -0
  437. package/lib/data/utils/d3-cloud/index.js.map +1 -0
  438. package/lib/{transform → data}/utils/d3-sankey/align.d.ts +0 -0
  439. package/lib/{transform → data}/utils/d3-sankey/align.js +0 -0
  440. package/lib/data/utils/d3-sankey/align.js.map +1 -0
  441. package/lib/{transform → data}/utils/d3-sankey/constant.d.ts +0 -0
  442. package/lib/{transform → data}/utils/d3-sankey/constant.js +0 -0
  443. package/lib/data/utils/d3-sankey/constant.js.map +1 -0
  444. package/lib/{transform → data}/utils/d3-sankey/index.d.ts +0 -0
  445. package/lib/{transform → data}/utils/d3-sankey/index.js +0 -0
  446. package/lib/data/utils/d3-sankey/index.js.map +1 -0
  447. package/lib/{transform → data}/utils/d3-sankey/sankey.d.ts +0 -0
  448. package/lib/{transform → data}/utils/d3-sankey/sankey.js +0 -0
  449. package/lib/data/utils/d3-sankey/sankey.js.map +1 -0
  450. package/lib/{transform → data}/utils/flow.d.ts +0 -0
  451. package/lib/{transform → data}/utils/flow.js +0 -0
  452. package/lib/data/utils/flow.js.map +1 -0
  453. package/lib/{transform → data}/utils/memo.d.ts +0 -0
  454. package/lib/{transform → data}/utils/memo.js +0 -0
  455. package/lib/data/utils/memo.js.map +1 -0
  456. package/lib/data/voronoi.d.ts +0 -0
  457. package/lib/data/voronoi.js +27 -0
  458. package/lib/data/voronoi.js.map +1 -0
  459. package/lib/data/wordCloud.d.ts +0 -0
  460. package/lib/data/wordCloud.js +100 -0
  461. package/lib/data/wordCloud.js.map +1 -0
  462. package/lib/index.d.ts +1 -1
  463. package/lib/index.js +2 -1
  464. package/lib/index.js.map +1 -1
  465. package/lib/interaction/action/service/fisheyeFocus.js +7 -3
  466. package/lib/interaction/action/service/fisheyeFocus.js.map +1 -1
  467. package/lib/interaction/action/transformer/filter.js +9 -3
  468. package/lib/interaction/action/transformer/filter.js.map +1 -1
  469. package/lib/interaction/builtin/fisheye.d.ts +2 -0
  470. package/lib/labelLayout/hideOverlap.d.ts +2 -0
  471. package/lib/labelLayout/hideOverlap.js +42 -0
  472. package/lib/labelLayout/hideOverlap.js.map +1 -0
  473. package/lib/labelLayout/index.d.ts +1 -0
  474. package/lib/labelLayout/index.js +6 -0
  475. package/lib/labelLayout/index.js.map +1 -0
  476. package/lib/mark/utils.d.ts +1 -3
  477. package/lib/mark/utils.js +1 -1
  478. package/lib/mark/utils.js.map +1 -1
  479. package/lib/runtime/component.js +10 -2
  480. package/lib/runtime/component.js.map +1 -1
  481. package/lib/runtime/coordinate.d.ts +4 -0
  482. package/lib/runtime/coordinate.js +21 -1
  483. package/lib/runtime/coordinate.js.map +1 -1
  484. package/lib/runtime/index.d.ts +1 -0
  485. package/lib/runtime/index.js +1 -0
  486. package/lib/runtime/index.js.map +1 -1
  487. package/lib/runtime/layout.js.map +1 -1
  488. package/lib/runtime/mark.d.ts +3 -3
  489. package/lib/runtime/mark.js +34 -90
  490. package/lib/runtime/mark.js.map +1 -1
  491. package/lib/runtime/plot.js +17 -11
  492. package/lib/runtime/plot.js.map +1 -1
  493. package/lib/runtime/render.js +4 -15
  494. package/lib/runtime/render.js.map +1 -1
  495. package/lib/runtime/scale.js +13 -4
  496. package/lib/runtime/scale.js.map +1 -1
  497. package/lib/runtime/transform.d.ts +9 -0
  498. package/lib/runtime/transform.js +154 -0
  499. package/lib/runtime/transform.js.map +1 -0
  500. package/lib/runtime/types/common.d.ts +5 -3
  501. package/lib/runtime/types/component.d.ts +5 -2
  502. package/lib/runtime/types/data.d.ts +7 -0
  503. package/lib/{spec/statistic.js → runtime/types/data.js} +1 -1
  504. package/lib/runtime/types/data.js.map +1 -0
  505. package/lib/runtime/types/encode.d.ts +4 -2
  506. package/lib/runtime/types/options.d.ts +6 -3
  507. package/lib/runtime/types/transform.d.ts +6 -12
  508. package/lib/shape/interval/colorRect.js +2 -20
  509. package/lib/shape/interval/colorRect.js.map +1 -1
  510. package/lib/shape/label/label.js +80 -9
  511. package/lib/shape/label/label.js.map +1 -1
  512. package/lib/shape/utils.d.ts +7 -0
  513. package/lib/shape/utils.js +25 -1
  514. package/lib/shape/utils.js.map +1 -1
  515. package/lib/spec/composition.d.ts +8 -5
  516. package/lib/spec/coordinate.d.ts +46 -2
  517. package/lib/spec/data.d.ts +54 -0
  518. package/lib/spec/data.js +3 -0
  519. package/lib/spec/data.js.map +1 -0
  520. package/lib/spec/geometry.d.ts +2 -1
  521. package/lib/spec/index.d.ts +2 -1
  522. package/lib/spec/index.js +2 -1
  523. package/lib/spec/index.js.map +1 -1
  524. package/lib/spec/labelLayout.d.ts +4 -0
  525. package/lib/spec/labelLayout.js +3 -0
  526. package/lib/spec/labelLayout.js.map +1 -0
  527. package/lib/spec/transform.d.ts +58 -166
  528. package/lib/spec/transform.js +133 -0
  529. package/lib/spec/transform.js.map +1 -1
  530. package/lib/stdlib/index.js +26 -15
  531. package/lib/stdlib/index.js.map +1 -1
  532. package/lib/theme/light.js +1 -0
  533. package/lib/theme/light.js.map +1 -1
  534. package/lib/transform/{statistic/Select.d.ts → Select.d.ts} +2 -2
  535. package/lib/transform/{statistic/Select.js → Select.js} +9 -14
  536. package/lib/transform/Select.js.map +1 -0
  537. package/lib/transform/{statistic/SelectX.d.ts → SelectX.d.ts} +2 -2
  538. package/lib/transform/{statistic/SelectX.js → SelectX.js} +1 -3
  539. package/lib/transform/SelectX.js.map +1 -0
  540. package/lib/transform/{statistic/SelectY.d.ts → SelectY.d.ts} +2 -2
  541. package/lib/transform/{statistic/SelectY.js → SelectY.js} +1 -3
  542. package/lib/transform/SelectY.js.map +1 -0
  543. package/lib/transform/{statistic/dodgeX.d.ts → dodgeX.d.ts} +2 -2
  544. package/lib/transform/{statistic/dodgeX.js → dodgeX.js} +22 -22
  545. package/lib/transform/dodgeX.js.map +1 -0
  546. package/{esm/transform/statistic → lib/transform}/groupX.d.ts +3 -2
  547. package/lib/transform/{statistic/groupX.js → groupX.js} +23 -19
  548. package/lib/transform/groupX.js.map +1 -0
  549. package/lib/transform/index.d.ts +21 -36
  550. package/lib/transform/index.js +22 -55
  551. package/lib/transform/index.js.map +1 -1
  552. package/lib/transform/{statistic/jitter.d.ts → jitter.d.ts} +3 -3
  553. package/lib/transform/{statistic/jitter.js → jitter.js} +16 -20
  554. package/lib/transform/jitter.js.map +1 -0
  555. package/{esm/transform/statistic → lib/transform}/jitterY.d.ts +2 -2
  556. package/lib/transform/{statistic/jitterY.js → jitterY.js} +9 -15
  557. package/lib/transform/jitterY.js.map +1 -0
  558. package/lib/transform/maybeKey.d.ts +6 -0
  559. package/lib/transform/{inference/maybeKey.js → maybeKey.js} +11 -12
  560. package/lib/transform/maybeKey.js.map +1 -0
  561. package/lib/transform/maybeSeries.d.ts +6 -0
  562. package/lib/transform/maybeSeries.js +21 -0
  563. package/lib/transform/maybeSeries.js.map +1 -0
  564. package/lib/transform/maybeSize.d.ts +7 -0
  565. package/lib/transform/maybeSize.js +24 -0
  566. package/lib/transform/maybeSize.js.map +1 -0
  567. package/{esm/transform/inference → lib/transform}/maybeStackY.d.ts +1 -1
  568. package/lib/transform/{inference/maybeStackY.js → maybeStackY.js} +11 -13
  569. package/lib/transform/maybeStackY.js.map +1 -0
  570. package/lib/transform/maybeTitleX.d.ts +6 -0
  571. package/lib/transform/maybeTitleX.js +21 -0
  572. package/lib/transform/maybeTitleX.js.map +1 -0
  573. package/lib/transform/maybeTooltip.d.ts +8 -0
  574. package/lib/transform/{inference/maybeTooltip.js → maybeTooltip.js} +13 -14
  575. package/lib/transform/maybeTooltip.js.map +1 -0
  576. package/lib/transform/{inference/maybeTooltipPosition.d.ts → maybeTooltipPosition.d.ts} +3 -3
  577. package/lib/transform/{inference/maybeTooltipPosition.js → maybeTooltipPosition.js} +3 -5
  578. package/lib/transform/maybeTooltipPosition.js.map +1 -0
  579. package/lib/transform/maybeTooltipY.d.ts +6 -0
  580. package/lib/transform/{inference/maybeTooltipY.js → maybeTooltipY.js} +2 -5
  581. package/lib/transform/maybeTooltipY.js.map +1 -0
  582. package/{esm/transform/inference → lib/transform}/maybeZeroX.d.ts +1 -1
  583. package/lib/transform/maybeZeroX.js +26 -0
  584. package/lib/transform/maybeZeroX.js.map +1 -0
  585. package/lib/transform/maybeZeroY.d.ts +6 -0
  586. package/lib/transform/maybeZeroY.js +25 -0
  587. package/lib/transform/maybeZeroY.js.map +1 -0
  588. package/lib/transform/maybeZeroY1.d.ts +6 -0
  589. package/lib/transform/maybeZeroY1.js +25 -0
  590. package/lib/transform/maybeZeroY1.js.map +1 -0
  591. package/lib/transform/{statistic/normalizeY.d.ts → normalizeY.d.ts} +2 -2
  592. package/lib/transform/{statistic/normalizeY.js → normalizeY.js} +16 -17
  593. package/lib/transform/normalizeY.js.map +1 -0
  594. package/lib/transform/{statistic/stackEnter.d.ts → stackEnter.d.ts} +2 -2
  595. package/lib/transform/{statistic/stackEnter.js → stackEnter.js} +22 -19
  596. package/lib/transform/stackEnter.js.map +1 -0
  597. package/lib/transform/{statistic/stackY.d.ts → stackY.d.ts} +2 -2
  598. package/lib/transform/{statistic/stackY.js → stackY.js} +22 -21
  599. package/lib/transform/stackY.js.map +1 -0
  600. package/lib/transform/{statistic/symmetryY.d.ts → symmetryY.d.ts} +2 -2
  601. package/lib/transform/{statistic/symmetryY.js → symmetryY.js} +16 -17
  602. package/lib/transform/symmetryY.js.map +1 -0
  603. package/lib/transform/utils/helper.d.ts +11 -10
  604. package/lib/transform/utils/helper.js +32 -38
  605. package/lib/transform/utils/helper.js.map +1 -1
  606. package/lib/transform/{statistic/utils.d.ts → utils/order.d.ts} +4 -4
  607. package/lib/transform/{statistic/utils.js → utils/order.js} +7 -5
  608. package/lib/transform/utils/order.js.map +1 -0
  609. package/lib/utils/coordinate.d.ts +1 -0
  610. package/lib/utils/coordinate.js +6 -1
  611. package/lib/utils/coordinate.js.map +1 -1
  612. package/package.json +6 -5
  613. package/src/animation/fadeIn.ts +4 -6
  614. package/src/animation/fadeOut.ts +4 -4
  615. package/src/animation/morphing.ts +4 -5
  616. package/src/animation/scaleInX.ts +9 -5
  617. package/src/animation/scaleInY.ts +9 -5
  618. package/src/animation/scaleOutX.ts +9 -5
  619. package/src/animation/scaleOutY.ts +9 -5
  620. package/src/api/chart.ts +19 -8
  621. package/src/api/index.ts +1 -0
  622. package/src/api/library.ts +12 -0
  623. package/src/composition/circle.ts +1 -1
  624. package/src/composition/flex.ts +4 -2
  625. package/src/composition/layer.ts +3 -2
  626. package/src/composition/mark.ts +3 -0
  627. package/src/composition/rect.ts +27 -28
  628. package/src/composition/utils.ts +10 -0
  629. package/src/composition/view.ts +3 -2
  630. package/src/coordinate/fisheye.ts +3 -2
  631. package/src/coordinate/fisheyeX.ts +15 -0
  632. package/src/coordinate/fisheyeY.ts +15 -0
  633. package/src/coordinate/helix.ts +21 -0
  634. package/src/coordinate/index.ts +7 -0
  635. package/src/coordinate/reflect.ts +15 -0
  636. package/src/coordinate/reflectX.ts +15 -0
  637. package/src/coordinate/reflectY.ts +15 -0
  638. package/src/coordinate/theta.ts +21 -0
  639. package/src/data/arc.ts +21 -0
  640. package/src/data/cluster.ts +56 -0
  641. package/src/data/connector.ts +14 -0
  642. package/src/data/fetch.ts +23 -0
  643. package/src/data/filterBy.ts +19 -0
  644. package/src/data/fold.ts +29 -0
  645. package/src/data/index.ts +9 -0
  646. package/src/data/inline.ts +11 -0
  647. package/src/{transform/preprocessor → data}/pick.ts +4 -6
  648. package/src/{transform/preprocessor → data}/rename.ts +7 -10
  649. package/src/data/sankey.ts +105 -0
  650. package/src/{transform/preprocessor → data}/sortBy.ts +7 -12
  651. package/src/{transform/preprocessor → data}/subset.ts +8 -13
  652. package/src/data/tree.ts +12 -0
  653. package/src/{transform → data}/utils/arc/arc.ts +0 -0
  654. package/src/{transform → data}/utils/arc/index.ts +0 -0
  655. package/src/{transform → data}/utils/arc/sort.ts +0 -0
  656. package/src/{transform → data}/utils/arc/types.ts +0 -0
  657. package/src/{transform → data}/utils/d3-cloud/index.ts +0 -0
  658. package/src/{transform → data}/utils/d3-sankey/align.ts +0 -0
  659. package/src/{transform → data}/utils/d3-sankey/constant.ts +0 -0
  660. package/src/{transform → data}/utils/d3-sankey/index.ts +0 -0
  661. package/src/{transform → data}/utils/d3-sankey/sankey.ts +0 -0
  662. package/src/{transform → data}/utils/flow.ts +0 -0
  663. package/src/{transform → data}/utils/memo.ts +1 -0
  664. package/src/data/voronoi.ts +30 -0
  665. package/src/data/wordCloud.ts +115 -0
  666. package/src/index.ts +1 -1
  667. package/src/interaction/action/service/fisheyeFocus.ts +16 -3
  668. package/src/interaction/action/transformer/filter.ts +8 -4
  669. package/src/labelLayout/hideOverlap.ts +47 -0
  670. package/src/labelLayout/index.ts +1 -0
  671. package/src/mark/utils.ts +1 -1
  672. package/src/runtime/component.ts +23 -3
  673. package/src/runtime/coordinate.ts +20 -0
  674. package/src/runtime/index.ts +1 -0
  675. package/src/runtime/layout.ts +1 -1
  676. package/src/runtime/mark.ts +56 -135
  677. package/src/runtime/plot.ts +29 -22
  678. package/src/runtime/render.ts +4 -5
  679. package/src/runtime/scale.ts +15 -5
  680. package/src/runtime/transform.ts +159 -0
  681. package/src/runtime/types/common.ts +5 -2
  682. package/src/runtime/types/component.ts +13 -3
  683. package/src/runtime/types/data.ts +10 -0
  684. package/src/runtime/types/encode.ts +6 -2
  685. package/src/runtime/types/options.ts +7 -2
  686. package/src/runtime/types/transform.ts +8 -13
  687. package/src/shape/interval/colorRect.ts +4 -23
  688. package/src/shape/label/label.ts +94 -11
  689. package/src/shape/utils.ts +31 -0
  690. package/src/spec/composition.ts +8 -5
  691. package/src/spec/coordinate.ts +67 -3
  692. package/src/spec/data.ts +81 -0
  693. package/src/spec/geometry.ts +2 -1
  694. package/src/spec/index.ts +2 -1
  695. package/src/spec/labelLayout.ts +5 -0
  696. package/src/spec/transform.ts +245 -194
  697. package/src/stdlib/index.ts +50 -31
  698. package/src/theme/light.ts +1 -0
  699. package/src/transform/{statistic/dodgeX.ts → dodgeX.ts} +24 -21
  700. package/src/transform/{statistic/groupX.ts → groupX.ts} +25 -24
  701. package/src/transform/index.ts +21 -44
  702. package/src/transform/{statistic/jitter.ts → jitter.ts} +17 -21
  703. package/src/transform/{statistic/jitterY.ts → jitterY.ts} +11 -17
  704. package/src/transform/maybeKey.ts +26 -0
  705. package/src/transform/maybeSeries.ts +20 -0
  706. package/src/transform/maybeSize.ts +23 -0
  707. package/src/transform/{inference/maybeStackY.ts → maybeStackY.ts} +12 -13
  708. package/src/transform/maybeTitleX.ts +20 -0
  709. package/src/transform/maybeTooltip.ts +34 -0
  710. package/src/transform/{inference/maybeTooltipPosition.ts → maybeTooltipPosition.ts} +4 -6
  711. package/src/transform/{inference/maybeTooltipY.ts → maybeTooltipY.ts} +3 -6
  712. package/src/transform/maybeZeroX.ts +25 -0
  713. package/src/transform/maybeZeroY.ts +24 -0
  714. package/src/transform/maybeZeroY1.ts +24 -0
  715. package/src/transform/{statistic/normalizeY.ts → normalizeY.ts} +20 -19
  716. package/src/transform/{statistic/select.ts → select.ts} +11 -16
  717. package/src/transform/{statistic/selectX.ts → selectX.ts} +3 -5
  718. package/src/transform/{statistic/selectY.ts → selectY.ts} +3 -5
  719. package/src/transform/{statistic/stackEnter.ts → stackEnter.ts} +29 -21
  720. package/src/transform/{statistic/stackY.ts → stackY.ts} +22 -21
  721. package/src/transform/{statistic/symmetryY.ts → symmetryY.ts} +20 -19
  722. package/src/transform/utils/helper.ts +27 -44
  723. package/src/transform/{statistic/utils.ts → utils/order.ts} +20 -17
  724. package/src/utils/coordinate.ts +5 -0
  725. package/esm/spec/statistic.d.ts +0 -69
  726. package/esm/spec/statistic.js +0 -2
  727. package/esm/spec/statistic.js.map +0 -1
  728. package/esm/transform/inference/maybeArrayField.d.ts +0 -8
  729. package/esm/transform/inference/maybeArrayField.js +0 -47
  730. package/esm/transform/inference/maybeArrayField.js.map +0 -1
  731. package/esm/transform/inference/maybeKey.d.ts +0 -9
  732. package/esm/transform/inference/maybeKey.js.map +0 -1
  733. package/esm/transform/inference/maybeSeries.d.ts +0 -7
  734. package/esm/transform/inference/maybeSeries.js +0 -23
  735. package/esm/transform/inference/maybeSeries.js.map +0 -1
  736. package/esm/transform/inference/maybeSize.d.ts +0 -7
  737. package/esm/transform/inference/maybeSize.js +0 -14
  738. package/esm/transform/inference/maybeSize.js.map +0 -1
  739. package/esm/transform/inference/maybeStackY.js.map +0 -1
  740. package/esm/transform/inference/maybeTitleX.d.ts +0 -7
  741. package/esm/transform/inference/maybeTitleX.js +0 -23
  742. package/esm/transform/inference/maybeTitleX.js.map +0 -1
  743. package/esm/transform/inference/maybeTooltip.d.ts +0 -9
  744. package/esm/transform/inference/maybeTooltip.js +0 -30
  745. package/esm/transform/inference/maybeTooltip.js.map +0 -1
  746. package/esm/transform/inference/maybeTooltipPosition.js +0 -12
  747. package/esm/transform/inference/maybeTooltipPosition.js.map +0 -1
  748. package/esm/transform/inference/maybeTooltipY.d.ts +0 -7
  749. package/esm/transform/inference/maybeTooltipY.js +0 -12
  750. package/esm/transform/inference/maybeTooltipY.js.map +0 -1
  751. package/esm/transform/inference/maybeZeroX.js +0 -14
  752. package/esm/transform/inference/maybeZeroX.js.map +0 -1
  753. package/esm/transform/inference/maybeZeroY.d.ts +0 -7
  754. package/esm/transform/inference/maybeZeroY.js +0 -14
  755. package/esm/transform/inference/maybeZeroY.js.map +0 -1
  756. package/esm/transform/inference/maybeZeroY1.d.ts +0 -7
  757. package/esm/transform/inference/maybeZeroY1.js +0 -14
  758. package/esm/transform/inference/maybeZeroY1.js.map +0 -1
  759. package/esm/transform/preprocessor/arc.d.ts +0 -7
  760. package/esm/transform/preprocessor/arc.js +0 -16
  761. package/esm/transform/preprocessor/arc.js.map +0 -1
  762. package/esm/transform/preprocessor/cluster.d.ts +0 -5
  763. package/esm/transform/preprocessor/cluster.js +0 -40
  764. package/esm/transform/preprocessor/cluster.js.map +0 -1
  765. package/esm/transform/preprocessor/connector.d.ts +0 -7
  766. package/esm/transform/preprocessor/connector.js +0 -16
  767. package/esm/transform/preprocessor/connector.js.map +0 -1
  768. package/esm/transform/preprocessor/fetch.d.ts +0 -8
  769. package/esm/transform/preprocessor/fetch.js.map +0 -1
  770. package/esm/transform/preprocessor/filterBy.js.map +0 -1
  771. package/esm/transform/preprocessor/fold.d.ts +0 -8
  772. package/esm/transform/preprocessor/fold.js +0 -27
  773. package/esm/transform/preprocessor/fold.js.map +0 -1
  774. package/esm/transform/preprocessor/pick.d.ts +0 -7
  775. package/esm/transform/preprocessor/pick.js.map +0 -1
  776. package/esm/transform/preprocessor/rename.js.map +0 -1
  777. package/esm/transform/preprocessor/sankey.d.ts +0 -8
  778. package/esm/transform/preprocessor/sankey.js +0 -80
  779. package/esm/transform/preprocessor/sankey.js.map +0 -1
  780. package/esm/transform/preprocessor/sortBy.d.ts +0 -7
  781. package/esm/transform/preprocessor/sortBy.js.map +0 -1
  782. package/esm/transform/preprocessor/subset.d.ts +0 -7
  783. package/esm/transform/preprocessor/subset.js.map +0 -1
  784. package/esm/transform/preprocessor/tree.d.ts +0 -4
  785. package/esm/transform/preprocessor/tree.js +0 -7
  786. package/esm/transform/preprocessor/tree.js.map +0 -1
  787. package/esm/transform/preprocessor/voronoi.d.ts +0 -4
  788. package/esm/transform/preprocessor/voronoi.js +0 -20
  789. package/esm/transform/preprocessor/voronoi.js.map +0 -1
  790. package/esm/transform/preprocessor/wordCloud.d.ts +0 -6
  791. package/esm/transform/preprocessor/wordCloud.js +0 -106
  792. package/esm/transform/preprocessor/wordCloud.js.map +0 -1
  793. package/esm/transform/statistic/Select.js.map +0 -1
  794. package/esm/transform/statistic/SelectX.js.map +0 -1
  795. package/esm/transform/statistic/SelectY.js.map +0 -1
  796. package/esm/transform/statistic/dodgeX.js.map +0 -1
  797. package/esm/transform/statistic/groupX.js.map +0 -1
  798. package/esm/transform/statistic/jitter.js.map +0 -1
  799. package/esm/transform/statistic/jitterY.js +0 -27
  800. package/esm/transform/statistic/jitterY.js.map +0 -1
  801. package/esm/transform/statistic/normalizeY.js.map +0 -1
  802. package/esm/transform/statistic/stackEnter.js.map +0 -1
  803. package/esm/transform/statistic/stackY.js.map +0 -1
  804. package/esm/transform/statistic/symmetryY.js.map +0 -1
  805. package/esm/transform/statistic/utils.js.map +0 -1
  806. package/esm/transform/utils/arc/arc.js.map +0 -1
  807. package/esm/transform/utils/arc/index.js.map +0 -1
  808. package/esm/transform/utils/arc/sort.js.map +0 -1
  809. package/esm/transform/utils/arc/types.js.map +0 -1
  810. package/esm/transform/utils/d3-cloud/index.js.map +0 -1
  811. package/esm/transform/utils/d3-sankey/align.js.map +0 -1
  812. package/esm/transform/utils/d3-sankey/constant.js.map +0 -1
  813. package/esm/transform/utils/d3-sankey/index.js.map +0 -1
  814. package/esm/transform/utils/d3-sankey/sankey.js.map +0 -1
  815. package/esm/transform/utils/flow.js.map +0 -1
  816. package/esm/transform/utils/memo.js.map +0 -1
  817. package/lib/spec/statistic.d.ts +0 -69
  818. package/lib/spec/statistic.js.map +0 -1
  819. package/lib/transform/inference/maybeArrayField.d.ts +0 -8
  820. package/lib/transform/inference/maybeArrayField.js +0 -51
  821. package/lib/transform/inference/maybeArrayField.js.map +0 -1
  822. package/lib/transform/inference/maybeKey.d.ts +0 -9
  823. package/lib/transform/inference/maybeKey.js.map +0 -1
  824. package/lib/transform/inference/maybeSeries.d.ts +0 -7
  825. package/lib/transform/inference/maybeSeries.js +0 -27
  826. package/lib/transform/inference/maybeSeries.js.map +0 -1
  827. package/lib/transform/inference/maybeSize.d.ts +0 -7
  828. package/lib/transform/inference/maybeSize.js +0 -18
  829. package/lib/transform/inference/maybeSize.js.map +0 -1
  830. package/lib/transform/inference/maybeStackY.js.map +0 -1
  831. package/lib/transform/inference/maybeTitleX.d.ts +0 -7
  832. package/lib/transform/inference/maybeTitleX.js +0 -27
  833. package/lib/transform/inference/maybeTitleX.js.map +0 -1
  834. package/lib/transform/inference/maybeTooltip.d.ts +0 -9
  835. package/lib/transform/inference/maybeTooltip.js.map +0 -1
  836. package/lib/transform/inference/maybeTooltipPosition.js.map +0 -1
  837. package/lib/transform/inference/maybeTooltipY.d.ts +0 -7
  838. package/lib/transform/inference/maybeTooltipY.js.map +0 -1
  839. package/lib/transform/inference/maybeZeroX.js +0 -18
  840. package/lib/transform/inference/maybeZeroX.js.map +0 -1
  841. package/lib/transform/inference/maybeZeroY.d.ts +0 -7
  842. package/lib/transform/inference/maybeZeroY.js +0 -18
  843. package/lib/transform/inference/maybeZeroY.js.map +0 -1
  844. package/lib/transform/inference/maybeZeroY1.d.ts +0 -7
  845. package/lib/transform/inference/maybeZeroY1.js +0 -18
  846. package/lib/transform/inference/maybeZeroY1.js.map +0 -1
  847. package/lib/transform/preprocessor/arc.d.ts +0 -7
  848. package/lib/transform/preprocessor/arc.js +0 -20
  849. package/lib/transform/preprocessor/arc.js.map +0 -1
  850. package/lib/transform/preprocessor/cluster.d.ts +0 -5
  851. package/lib/transform/preprocessor/cluster.js +0 -44
  852. package/lib/transform/preprocessor/cluster.js.map +0 -1
  853. package/lib/transform/preprocessor/connector.d.ts +0 -7
  854. package/lib/transform/preprocessor/connector.js +0 -20
  855. package/lib/transform/preprocessor/connector.js.map +0 -1
  856. package/lib/transform/preprocessor/fetch.d.ts +0 -8
  857. package/lib/transform/preprocessor/fetch.js.map +0 -1
  858. package/lib/transform/preprocessor/filterBy.js.map +0 -1
  859. package/lib/transform/preprocessor/fold.d.ts +0 -8
  860. package/lib/transform/preprocessor/fold.js +0 -32
  861. package/lib/transform/preprocessor/fold.js.map +0 -1
  862. package/lib/transform/preprocessor/pick.d.ts +0 -7
  863. package/lib/transform/preprocessor/pick.js.map +0 -1
  864. package/lib/transform/preprocessor/rename.js.map +0 -1
  865. package/lib/transform/preprocessor/sankey.d.ts +0 -8
  866. package/lib/transform/preprocessor/sankey.js +0 -84
  867. package/lib/transform/preprocessor/sankey.js.map +0 -1
  868. package/lib/transform/preprocessor/sortBy.d.ts +0 -7
  869. package/lib/transform/preprocessor/sortBy.js.map +0 -1
  870. package/lib/transform/preprocessor/subset.d.ts +0 -7
  871. package/lib/transform/preprocessor/subset.js.map +0 -1
  872. package/lib/transform/preprocessor/tree.d.ts +0 -4
  873. package/lib/transform/preprocessor/tree.js +0 -10
  874. package/lib/transform/preprocessor/tree.js.map +0 -1
  875. package/lib/transform/preprocessor/voronoi.d.ts +0 -4
  876. package/lib/transform/preprocessor/voronoi.js +0 -24
  877. package/lib/transform/preprocessor/voronoi.js.map +0 -1
  878. package/lib/transform/preprocessor/wordCloud.d.ts +0 -6
  879. package/lib/transform/preprocessor/wordCloud.js +0 -112
  880. package/lib/transform/preprocessor/wordCloud.js.map +0 -1
  881. package/lib/transform/statistic/Select.js.map +0 -1
  882. package/lib/transform/statistic/SelectX.js.map +0 -1
  883. package/lib/transform/statistic/SelectY.js.map +0 -1
  884. package/lib/transform/statistic/dodgeX.js.map +0 -1
  885. package/lib/transform/statistic/groupX.js.map +0 -1
  886. package/lib/transform/statistic/jitter.js.map +0 -1
  887. package/lib/transform/statistic/jitterY.js.map +0 -1
  888. package/lib/transform/statistic/normalizeY.js.map +0 -1
  889. package/lib/transform/statistic/stackEnter.js.map +0 -1
  890. package/lib/transform/statistic/stackY.js.map +0 -1
  891. package/lib/transform/statistic/symmetryY.js.map +0 -1
  892. package/lib/transform/statistic/utils.js.map +0 -1
  893. package/lib/transform/utils/arc/arc.js.map +0 -1
  894. package/lib/transform/utils/arc/index.js.map +0 -1
  895. package/lib/transform/utils/arc/sort.js.map +0 -1
  896. package/lib/transform/utils/arc/types.js.map +0 -1
  897. package/lib/transform/utils/d3-cloud/index.js.map +0 -1
  898. package/lib/transform/utils/d3-sankey/align.js.map +0 -1
  899. package/lib/transform/utils/d3-sankey/constant.js.map +0 -1
  900. package/lib/transform/utils/d3-sankey/index.js.map +0 -1
  901. package/lib/transform/utils/d3-sankey/sankey.js.map +0 -1
  902. package/lib/transform/utils/flow.js.map +0 -1
  903. package/lib/transform/utils/memo.js.map +0 -1
  904. package/src/spec/statistic.ts +0 -135
  905. package/src/transform/inference/maybeArrayField.ts +0 -55
  906. package/src/transform/inference/maybeKey.ts +0 -29
  907. package/src/transform/inference/maybeSeries.ts +0 -26
  908. package/src/transform/inference/maybeSize.ts +0 -18
  909. package/src/transform/inference/maybeTitleX.ts +0 -26
  910. package/src/transform/inference/maybeTooltip.ts +0 -35
  911. package/src/transform/inference/maybeZeroX.ts +0 -18
  912. package/src/transform/inference/maybeZeroY.ts +0 -18
  913. package/src/transform/inference/maybeZeroY1.ts +0 -18
  914. package/src/transform/preprocessor/arc.ts +0 -21
  915. package/src/transform/preprocessor/cluster.ts +0 -56
  916. package/src/transform/preprocessor/connector.ts +0 -22
  917. package/src/transform/preprocessor/fetch.ts +0 -32
  918. package/src/transform/preprocessor/filterBy.ts +0 -24
  919. package/src/transform/preprocessor/fold.ts +0 -32
  920. package/src/transform/preprocessor/sankey.ts +0 -105
  921. package/src/transform/preprocessor/tree.ts +0 -12
  922. package/src/transform/preprocessor/voronoi.ts +0 -30
  923. package/src/transform/preprocessor/wordCloud.ts +0 -115
@@ -2,7 +2,6 @@ import { Canvas, DisplayObject, Animation as GAnimation } from '@antv/g';
2
2
  import { Transformation, Coordinate } from '@antv/coord';
3
3
  import {
4
4
  IndexedValue,
5
- Primitive,
6
5
  G2Theme,
7
6
  Vector2,
8
7
  GuideComponentPosition,
@@ -13,6 +12,7 @@ import { G2ViewTree } from './options';
13
12
  import { EncodeComponent, Encode } from './encode';
14
13
  import { MarkComponent, Mark } from './mark';
15
14
  import { TransformComponent, Transform } from './transform';
15
+ import { Data, DataComponent } from './data';
16
16
 
17
17
  export type G2ComponentNamespaces =
18
18
  | 'renderer'
@@ -32,7 +32,9 @@ export type G2ComponentNamespaces =
32
32
  | 'interaction'
33
33
  | 'interactor'
34
34
  | 'composition'
35
- | 'adjust';
35
+ | 'adjust'
36
+ | 'data'
37
+ | 'labelLayout';
36
38
 
37
39
  export type G2Component =
38
40
  | RendererComponent
@@ -50,7 +52,9 @@ export type G2Component =
50
52
  | InteractionComponent
51
53
  | CompositionComponent
52
54
  | AdjustComponent
53
- | TransformComponent;
55
+ | TransformComponent
56
+ | DataComponent
57
+ | LabelLayoutComponent;
54
58
 
55
59
  export type G2ComponentValue =
56
60
  | Renderer
@@ -211,3 +215,9 @@ export type AdjustComponent<O = Record<string, unknown>> = G2BaseComponent<
211
215
  Adjust,
212
216
  O
213
217
  >;
218
+
219
+ export type LabelLayout = (labels: DisplayObject[]) => DisplayObject[];
220
+ export type LabelLayoutComponent<O = Record<string, unknown>> = G2BaseComponent<
221
+ LabelLayout,
222
+ O
223
+ >;
@@ -0,0 +1,10 @@
1
+ export type DataOptions = Record<string, any>;
2
+
3
+ export type DataProps = Record<string, never>;
4
+
5
+ export type DataComponent<O extends DataOptions = DataOptions> = {
6
+ (options?: O): Data;
7
+ props: DataProps;
8
+ };
9
+
10
+ export type Data = (data: any) => any | Promise<any>;
@@ -11,7 +11,7 @@ export type EncodeComponent<O extends EncodeOptions = EncodeOptions> = {
11
11
  props: EncodeProps;
12
12
  };
13
13
 
14
- export type Encode = (data: TabularData) => ColumnValue;
14
+ export type Encode = (data: TabularData) => Primitive[];
15
15
 
16
16
  export type EncodeSpec = NormalizedEncodeSpec | PrimitiveEncodeSpec;
17
17
 
@@ -29,4 +29,8 @@ export type FunctionEncodeSpec = (
29
29
 
30
30
  export type PrimitiveEncodeSpec = Primitive | FunctionEncodeSpec;
31
31
 
32
- export type ColumnValue = Primitive[] & { field?: string };
32
+ export type ColumnValue = {
33
+ type: 'column';
34
+ value: Primitive[];
35
+ field?: string;
36
+ };
@@ -16,11 +16,13 @@ import {
16
16
  CompositionComponent,
17
17
  AdjustComponent,
18
18
  Scale,
19
+ LabelLayoutComponent,
19
20
  } from './component';
20
21
 
21
22
  import { TransformComponent } from './transform';
22
23
  import { EncodeComponent } from './encode';
23
24
  import { MarkComponent } from './mark';
25
+ import { DataComponent } from './data';
24
26
 
25
27
  export type G2ViewTree = {
26
28
  width?: number;
@@ -62,6 +64,7 @@ export type G2View = {
62
64
  marks?: G2Mark[];
63
65
  frame?: boolean;
64
66
  adjust?: { type?: string; [key: string]: any };
67
+ labelLayout?: G2LabelLayoutOptions[];
65
68
  };
66
69
 
67
70
  export type G2Mark = {
@@ -73,7 +76,6 @@ export type G2Mark = {
73
76
  paddingBottom?: number;
74
77
  data?: any;
75
78
  transform?: G2TransformOptions[];
76
- statistic?: G2StatisticOptions[];
77
79
  scale?: Record<string, G2ScaleOptions>;
78
80
  encode?: Record<string, any | G2EncodeOptions>;
79
81
  type?: string | MarkComponent;
@@ -114,7 +116,8 @@ export type G2ComponentOptions =
114
116
  | G2AnimationOptions
115
117
  | G2InteractionOptions
116
118
  | G2CompositionOptions
117
- | G2AdjustOptions;
119
+ | G2AdjustOptions
120
+ | G2LabelLayoutOptions;
118
121
 
119
122
  export type G2TransformOptions = G2BaseComponentOptions<TransformComponent>;
120
123
  export type G2StatisticOptions = G2BaseComponentOptions<StatisticComponent>;
@@ -152,8 +155,10 @@ export type G2AnimationOptions = G2BaseComponentOptions<AnimationComponent>;
152
155
  export type G2InteractionOptions = G2BaseComponentOptions<InteractionComponent>;
153
156
  export type G2CompositionOptions = G2BaseComponentOptions<CompositionComponent>;
154
157
  export type G2AdjustOptions = G2BaseComponentOptions<AdjustComponent>;
158
+ export type G2LabelLayoutOptions = G2BaseComponentOptions<LabelLayoutComponent>;
155
159
  export type G2TitleOptions = G2Title & {
156
160
  position?: GuideComponentPosition;
157
161
  size?: number;
158
162
  zIndex?: number;
159
163
  };
164
+ export type G2DataOptions = G2BaseComponent<DataComponent>;
@@ -1,20 +1,13 @@
1
- import { ColumnValue, EncodeSpec } from './encode';
1
+ import { ColumnValue, NormalizedEncodeSpec } from './encode';
2
+ import { G2Library, G2Mark } from './options';
2
3
 
3
4
  export type TransformContext = {
4
- data?: any;
5
- I?: number[];
6
- encode?: Record<string, EncodeSpec>;
7
- columnOf?: ColumnOf;
8
- transform?: TransformSpec[];
9
- // @todo Replace with ScaleSpec
10
- scale?: Record<string, any>;
5
+ library: G2Library;
11
6
  };
12
7
 
13
8
  export type TransformOptions = Record<string, any>;
14
9
 
15
- export type TransformProps = {
16
- category: 'inference' | 'preprocessor' | 'statistic';
17
- };
10
+ export type TransformProps = Record<string, never>;
18
11
 
19
12
  export type TransformComponent<O extends TransformOptions = TransformOptions> =
20
13
  {
@@ -23,12 +16,14 @@ export type TransformComponent<O extends TransformOptions = TransformOptions> =
23
16
  };
24
17
 
25
18
  export type Transform = (
19
+ I: number[],
20
+ mark: G2Mark,
26
21
  context: TransformContext,
27
- ) => TransformContext | Promise<TransformContext>;
22
+ ) => [number[], G2Mark] | Promise<[number[], G2Mark]>;
28
23
 
29
24
  export type TransformSpec = {
30
25
  type?: string | TransformComponent;
31
26
  [key: string]: any;
32
27
  };
33
28
 
34
- export type ColumnOf = (data: any, encode: EncodeSpec) => ColumnValue;
29
+ export type ColumnOf = (data: any, encode: NormalizedEncodeSpec) => ColumnValue;
@@ -1,16 +1,10 @@
1
1
  import { Path } from '@antv/g';
2
2
  import { arc } from 'd3-shape';
3
3
  import { path as d3path } from 'd3-path';
4
- import { angle, sub, dist } from '../../utils/vector';
5
4
  import { Vector2, ShapeComponent as SC } from '../../runtime';
6
- import { isTranspose, isPolar } from '../../utils/coordinate';
5
+ import { isPolar, isHelix } from '../../utils/coordinate';
7
6
  import { select } from '../../utils/selection';
8
- import { applyStyle, appendPolygon } from '../utils';
9
-
10
- function reorder(points: Vector2[]): Vector2[] {
11
- const [p0, p1, p2, p3] = points;
12
- return [p3, p0, p1, p2];
13
- }
7
+ import { applyStyle, appendPolygon, getArcObject } from '../utils';
14
8
 
15
9
  export type ColorRectOptions = {
16
10
  colorAttribute: 'fill' | 'stroke';
@@ -34,10 +28,9 @@ export const ColorRect: SC<ColorRectOptions> = (options) => {
34
28
  const { radius = 0 } = style;
35
29
  const { defaultColor } = theme;
36
30
  const { color = defaultColor } = value;
37
- const [p0, p1, p2, p3] = isTranspose(coordinate) ? reorder(points) : points;
38
31
 
39
32
  // Render rect in non-polar coordinate.
40
- if (!isPolar(coordinate)) {
33
+ if (!isPolar(coordinate) && !isHelix(coordinate)) {
41
34
  return select(new Path())
42
35
  .style('lineWidth', lineWidth)
43
36
  .style('d', appendPolygon(d3path(), points).toString())
@@ -50,19 +43,7 @@ export const ColorRect: SC<ColorRectOptions> = (options) => {
50
43
  // Render path in polar coordinate.
51
44
  const { y, y1 } = value;
52
45
  const center = coordinate.getCenter() as Vector2;
53
- const a1 = angle(sub(p0, center));
54
- const a2 = angle(sub(p1, center));
55
- // There are two situations that a2 === a1:
56
- // 1. a1 - a2 = 0
57
- // 2. |a1 - a2| = Math.PI * 2
58
- // Distinguish them by y and y1:
59
- const a3 = a2 === a1 && y !== y1 ? a2 + Math.PI * 2 : a2;
60
- const arcObject = {
61
- startAngle: a1,
62
- endAngle: a3 - a1 >= 0 ? a3 : Math.PI * 2 + a3,
63
- innerRadius: dist(p3, center),
64
- outerRadius: dist(p0, center),
65
- };
46
+ const arcObject = getArcObject(coordinate, points, [y, y1]);
66
47
  const path = arc().cornerRadius(radius as number);
67
48
 
68
49
  return select(new Path({}))
@@ -1,10 +1,92 @@
1
+ import { Coordinate } from '@antv/coord';
1
2
  import { DisplayObject, Text } from '@antv/g';
2
3
  import { select } from '../../utils/selection';
3
- import { ShapeComponent as SC } from '../../runtime';
4
- import { applyStyle } from '../../shape/utils';
4
+ import { ShapeComponent as SC, Vector2 } from '../../runtime';
5
+ import { applyStyle, getArcObject } from '../../shape/utils';
6
+ import { isHelix, isPolar } from '../../utils/coordinate';
7
+
8
+ type LabelPosition = 'top' | 'left' | 'right' | 'bottom' | 'inside' | 'outside';
5
9
 
6
10
  export type LabelOptions = Record<string, any>;
7
11
 
12
+ /**
13
+ * Avoid getting error bounds caused by element animations.
14
+ * @todo Remove this temporary handle method, if runtime supports correct process: drawElement, do label layout and then do transitions together.
15
+ */
16
+ function getLocalBounds(element: DisplayObject) {
17
+ const cloneElement = element.cloneNode();
18
+ const animations = element.getAnimations();
19
+ cloneElement.style.visibility = 'hidden';
20
+ animations.forEach((animation) => {
21
+ const keyframes = animation.effect.getKeyframes();
22
+ cloneElement.attr(keyframes[keyframes.length - 1]);
23
+ });
24
+ element.parentNode.appendChild(cloneElement);
25
+ const bounds = cloneElement.getLocalBounds();
26
+ cloneElement.destroy();
27
+
28
+ return bounds;
29
+ }
30
+
31
+ function inferPosition(
32
+ points: Vector2[],
33
+ value,
34
+ coordinate: Coordinate,
35
+ position: LabelPosition,
36
+ ) {
37
+ const element: DisplayObject = value.element;
38
+ const { min, halfExtents } = getLocalBounds(element);
39
+ const [x0, y0] = min;
40
+ // Infer the label position in non-polar coordinate.
41
+ if (!isPolar(coordinate) && !isHelix(coordinate)) {
42
+ const w = halfExtents[0] * 2;
43
+ const h = halfExtents[1] * 2;
44
+
45
+ if (position === 'left') return { x: 0, y: h / 2 };
46
+ if (position === 'right') return { x: w, y: h / 2 };
47
+ if (position === 'bottom') return { x: w / 2, y: h };
48
+ if (position === 'inside') return { x: w / 2, y: h / 2 };
49
+
50
+ return { x: w / 2, y: 0 };
51
+ }
52
+
53
+ // Infer the label position in polar coordinate.
54
+ const { y, y1 } = value;
55
+ const arcObject = getArcObject(coordinate, points, [y, y1]);
56
+
57
+ const { startAngle, endAngle, innerRadius, outerRadius } = arcObject;
58
+ const midAngle = (startAngle + endAngle) / 2;
59
+
60
+ const center = coordinate.getCenter() as Vector2;
61
+
62
+ // @todo Support config by label.offset
63
+ const offset = position === 'inside' ? 0 : 12;
64
+ const radius =
65
+ (position === 'inside' ? (innerRadius + outerRadius) / 2 : outerRadius) +
66
+ offset;
67
+
68
+ return {
69
+ x: center[0] + Math.sin(midAngle) * radius - x0,
70
+ y: center[1] - Math.cos(midAngle) * radius - y0,
71
+ };
72
+ }
73
+
74
+ function inferDefaultStyle(position: LabelPosition): {
75
+ dy?: string;
76
+ textBaseline?: string;
77
+ } {
78
+ if (
79
+ position === 'left' ||
80
+ position === 'right' ||
81
+ position === 'inside' ||
82
+ position === 'outside'
83
+ ) {
84
+ return { textBaseline: 'middle' };
85
+ }
86
+
87
+ return { dy: '-2px' };
88
+ }
89
+
8
90
  /**
9
91
  * Render normal label for each mark.
10
92
  * @todo Support position option: middle...
@@ -12,20 +94,21 @@ export type LabelOptions = Record<string, any>;
12
94
  export const Label: SC<LabelOptions> = (options) => {
13
95
  const { label: style = {} } = options;
14
96
  return (points, value, coordinate, theme) => {
15
- const element: DisplayObject = value.element;
16
- const { min, max } = element.getRenderBounds();
17
- const [x0] = min;
18
- const [x1] = max;
19
- const w = x1 - x0;
97
+ const { position, ...restStyle } = style;
98
+ const { labelFill: fill } = theme;
99
+
100
+ const { x, y } = inferPosition(points, value, coordinate, position);
20
101
  const { label } = value;
102
+ const defaultStyle = inferDefaultStyle(position);
21
103
  return select(new Text())
22
- .style('x', w / 2)
23
- .style('y', 0)
104
+ .style('x', x)
105
+ .style('y', y)
24
106
  .style('text', `${label}`)
25
107
  .style('fontSize', 12)
26
- .style('dy', '-2px')
27
108
  .style('textAlign', 'center')
28
- .call(applyStyle, style)
109
+ .style('fill', fill)
110
+ .call(applyStyle, defaultStyle)
111
+ .call(applyStyle, restStyle)
29
112
  .node();
30
113
  };
31
114
  };
@@ -1,6 +1,8 @@
1
1
  import { Path as D3Path } from 'd3-path';
2
+ import { Coordinate } from '@antv/coord';
2
3
  import { Linear } from '@antv/scale';
3
4
  import { Primitive, Vector2 } from '../runtime';
5
+ import { isTranspose } from '../utils/coordinate';
4
6
  import { angle, dist, sub } from '../utils/vector';
5
7
  import { Selection } from '../utils/selection';
6
8
 
@@ -127,3 +129,32 @@ export function computeGradient(C: string[], X: number[]): string {
127
129
  const gradient = C.map((c, i) => `${c} ${color.map(X[i])}%`).join(',');
128
130
  return `linear-gradient(${gradient})`;
129
131
  }
132
+
133
+ function reorder(points: Vector2[]): Vector2[] {
134
+ const [p0, p1, p2, p3] = points;
135
+ return [p3, p0, p1, p2];
136
+ }
137
+
138
+ export function getArcObject(
139
+ coordinate: Coordinate,
140
+ points: Vector2[],
141
+ Y: [number, number],
142
+ ) {
143
+ const [p0, p1, , p3] = isTranspose(coordinate) ? reorder(points) : points;
144
+
145
+ const [y, y1] = Y;
146
+ const center = coordinate.getCenter() as Vector2;
147
+ const a1 = angle(sub(p0, center));
148
+ const a2 = angle(sub(p1, center));
149
+ // There are two situations that a2 === a1:
150
+ // 1. a1 - a2 = 0
151
+ // 2. |a1 - a2| = Math.PI * 2
152
+ // Distinguish them by y and y1:
153
+ const a3 = a2 === a1 && y !== y1 ? a2 + Math.PI * 2 : a2;
154
+ return {
155
+ startAngle: a1,
156
+ endAngle: a3 - a1 >= 0 ? a3 : Math.PI * 2 + a3,
157
+ innerRadius: dist(p3, center),
158
+ outerRadius: dist(p0, center),
159
+ };
160
+ }
@@ -5,6 +5,8 @@ import { Interaction } from './interaction';
5
5
  import { Transform } from './transform';
6
6
  import { Scale } from './scale';
7
7
  import { Title } from './title';
8
+ import { Data } from './data';
9
+ import { LabelLayout } from './labelLayout';
8
10
 
9
11
  export type Node =
10
12
  | MarkComposition
@@ -22,7 +24,7 @@ export type MarkComposition = Geometry & {
22
24
 
23
25
  export type ViewComposition = {
24
26
  type?: 'view';
25
- data?: any;
27
+ data?: Data;
26
28
  key?: string;
27
29
  class?: string;
28
30
  paddingLeft?: number;
@@ -36,6 +38,7 @@ export type ViewComposition = {
36
38
  theme?: Theme;
37
39
  children?: MarkComposition[];
38
40
  adjust?: Adjust;
41
+ labelLayout?: LabelLayout[];
39
42
  };
40
43
 
41
44
  export type LayerComposition = {
@@ -48,7 +51,7 @@ export type LayerComposition = {
48
51
  export type FlexComposition = {
49
52
  type?: 'flex';
50
53
  key?: string;
51
- data?: any;
54
+ data?: Data;
52
55
  direction?: 'col' | 'row';
53
56
  ratio?: number[];
54
57
  padding?: number;
@@ -68,7 +71,7 @@ export type FacetContext = {
68
71
 
69
72
  export type RectComposition = {
70
73
  transform?: Transform;
71
- data?: any;
74
+ data?: Data;
72
75
  paddingLeft?: number;
73
76
  paddingRight?: number;
74
77
  paddingTop?: number;
@@ -97,7 +100,7 @@ export type MatrixComposition = {
97
100
  paddingBottom?: number;
98
101
  transform?: Transform;
99
102
  title?: Title;
100
- data?: any;
103
+ data?: Data;
101
104
  key?: string;
102
105
  encode?: {
103
106
  x?: string[];
@@ -119,7 +122,7 @@ export type CircleComposition = {
119
122
  paddingBottom?: number;
120
123
  transform?: Transform;
121
124
  title?: Title;
122
- data?: any;
125
+ data?: Data;
123
126
  key?: string;
124
127
  encode?: {
125
128
  position?: string;
@@ -2,18 +2,34 @@ import { CoordinateComponent } from '../runtime';
2
2
 
3
3
  export type Coordinate =
4
4
  | PolarCoordinate
5
+ | HelixCoordinate
5
6
  | TransposeCoordinate
7
+ | ThetaCoordinate
8
+ | ReflectCoordinate
9
+ | ReflectXCoordinate
10
+ | ReflectYCoordinate
6
11
  | CustomCoordinate
7
12
  | CartesianCoordinate
8
13
  | ParallelCoordinate
9
- | FisheyeCoordinate;
14
+ | FisheyeCoordinate
15
+ | FisheyeXCoordinate
16
+ | FisheyeYCoordinate
17
+ | FisheyeCircularCoordinate;
10
18
 
11
19
  export type CoordinateTypes =
12
20
  | 'polar'
21
+ | 'helix'
13
22
  | 'transpose'
23
+ | 'theta'
24
+ | 'reflect'
25
+ | 'reflectX'
26
+ | 'reflectY'
14
27
  | 'cartesian'
15
28
  | 'parallel'
16
- | 'fisheye';
29
+ | 'fisheye'
30
+ | 'fisheyeX'
31
+ | 'fisheyeY'
32
+ | 'fisheyeCircular';
17
33
 
18
34
  export type PolarCoordinate = {
19
35
  type?: 'polar';
@@ -23,10 +39,38 @@ export type PolarCoordinate = {
23
39
  outerRadius?: number;
24
40
  };
25
41
 
42
+ export type HelixCoordinate = {
43
+ type?: 'helix';
44
+ startAngle?: number;
45
+ endAngle?: number;
46
+ innerRadius?: number;
47
+ outerRadius?: number;
48
+ };
49
+
50
+ export type ReflectCoordinate = {
51
+ type?: 'reflect';
52
+ };
53
+
54
+ export type ReflectXCoordinate = {
55
+ type?: 'reflect.x';
56
+ };
57
+
58
+ export type ReflectYCoordinate = {
59
+ type?: 'reflect.y';
60
+ };
61
+
26
62
  export type TransposeCoordinate = {
27
63
  type?: 'transpose';
28
64
  };
29
65
 
66
+ export type ThetaCoordinate = {
67
+ type?: 'theta';
68
+ startAngle?: number;
69
+ endAngle?: number;
70
+ innerRadius?: number;
71
+ outerRadius?: number;
72
+ };
73
+
30
74
  export type CartesianCoordinate = {
31
75
  type?: 'cartesian';
32
76
  };
@@ -41,8 +85,28 @@ export type FisheyeCoordinate = {
41
85
  focusY?: number;
42
86
  distortionX?: number;
43
87
  distortionY?: number;
88
+ isVisual?: boolean;
89
+ };
90
+ export type FisheyeXCoordinate = {
91
+ type?: 'fisheye.x';
92
+ focusX?: number;
93
+ distortionX?: number;
94
+ isVisual?: boolean;
95
+ };
96
+ export type FisheyeYCoordinate = {
97
+ type?: 'fisheye.y';
98
+ focusY?: number;
99
+ distortionY?: number;
100
+ isVisual?: boolean;
101
+ };
102
+ export type FisheyeCircularCoordinate = {
103
+ type?: 'fisheye.circular';
104
+ focusX?: number;
105
+ focusY?: number;
106
+ radius?: number;
107
+ distortion?: number;
108
+ isVisual?: boolean;
44
109
  };
45
-
46
110
  export type CustomCoordinate = {
47
111
  type: CoordinateComponent;
48
112
  [key: string]: any;
@@ -0,0 +1,81 @@
1
+ import { DataComponent } from '../runtime';
2
+ export type Data = FetchConnector | InlineConnector | any;
3
+
4
+ export type FetchConnector = {
5
+ type?: 'fetch';
6
+ value?: string;
7
+ format?: 'json' | 'csv';
8
+ callback?: (d: any) => any;
9
+ // Useful when format is 'csv'.
10
+ delimiter?: string;
11
+ transform?: DataTransform[];
12
+ };
13
+
14
+ export type InlineConnector = {
15
+ type?: 'inline';
16
+ value?: any;
17
+ transform?: DataTransform[];
18
+ };
19
+
20
+ export type DataTransform =
21
+ | SortByTransform
22
+ | PickTransform
23
+ | RenameTransform
24
+ | SubsetTransform
25
+ | FoldTransform
26
+ | FilterByTransform
27
+ | CustomTransform;
28
+
29
+ export type DataTransformTypes =
30
+ | 'sortBy'
31
+ | 'fetch'
32
+ | 'filterBy'
33
+ | 'pick'
34
+ | 'fold'
35
+ | 'connector'
36
+ | DataComponent;
37
+
38
+ export type SortByTransform = {
39
+ type?: 'sortBy';
40
+ fields?: string[];
41
+ order?: 'DESC' | 'ASC';
42
+ };
43
+
44
+ export type PickTransform = {
45
+ type?: 'pick';
46
+ fields?: string[];
47
+ };
48
+
49
+ export type RenameTransform = {
50
+ type?: 'rename';
51
+ map?: Record<string, string>;
52
+ };
53
+
54
+ export type SubsetTransform = {
55
+ type?: 'subset';
56
+ start?: number;
57
+ end?: number;
58
+ fields?: string[];
59
+ };
60
+
61
+ export type FilterByTransform = {
62
+ type?: 'filterBy';
63
+ fields?: string[];
64
+ callback?: (d: any) => boolean;
65
+ };
66
+
67
+ export type FoldTransform = {
68
+ type?: 'fold';
69
+ fields?: string[];
70
+ as?: string[];
71
+ };
72
+
73
+ export type ConnectorTransform = {
74
+ type?: 'connector';
75
+ callback?: (d: any) => any;
76
+ };
77
+
78
+ export type CustomTransform = {
79
+ type?: DataComponent;
80
+ [key: string]: any;
81
+ };
@@ -6,6 +6,7 @@ import { Coordinate } from './coordinate';
6
6
  import { Animation } from './animate';
7
7
  import { Interaction } from './interaction';
8
8
  import { Theme } from './theme';
9
+ import { Data } from './data';
9
10
 
10
11
  export type Geometry =
11
12
  | IntervalGeometry
@@ -74,7 +75,7 @@ export type BaseGeometry<
74
75
  paddingRight?: number;
75
76
  paddingBottom?: number;
76
77
  paddingTop?: number;
77
- data?: any;
78
+ data?: Data;
78
79
  transform?: Transform[];
79
80
  encode?: Partial<Record<C, Encode | Encode[]>>;
80
81
  scale?: Partial<Record<C, Scale>>;
package/src/spec/index.ts CHANGED
@@ -7,7 +7,7 @@ export type G2Spec = Node & {
7
7
 
8
8
  export * from './transform';
9
9
  export * from './encode';
10
- export * from './statistic';
10
+ export * from './data';
11
11
  export * from './scale';
12
12
  export * from './palette';
13
13
  export * from './coordinate';
@@ -16,3 +16,4 @@ export * from './animate';
16
16
  export * from './interaction';
17
17
  export * from './action';
18
18
  export * from './composition';
19
+ export * from './labelLayout';
@@ -0,0 +1,5 @@
1
+ export type LabelLayout = HideOverlap;
2
+
3
+ export type HideOverlap = {
4
+ type?: 'hideOverlap';
5
+ };