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

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 (477) hide show
  1. package/dist/g2-lite.min.js +10 -0
  2. package/dist/g2.min.js +3 -3
  3. package/esm/adjust/index.d.ts +2 -1
  4. package/esm/adjust/index.js.map +1 -1
  5. package/esm/animation/index.d.ts +14 -7
  6. package/esm/animation/index.js.map +1 -1
  7. package/esm/animation/scaleInX.js +3 -0
  8. package/esm/animation/scaleInX.js.map +1 -1
  9. package/esm/animation/scaleInY.js +3 -0
  10. package/esm/animation/scaleInY.js.map +1 -1
  11. package/esm/api/chart.d.ts +4 -0
  12. package/esm/api/chart.js +20 -3
  13. package/esm/api/chart.js.map +1 -1
  14. package/esm/api/mark/index.d.ts +3 -3
  15. package/esm/api/mark/index.js +2 -2
  16. package/esm/api/mark/index.js.map +1 -1
  17. package/esm/api/mark/mark.d.ts +4 -4
  18. package/esm/api/mark/mark.js +6 -5
  19. package/esm/api/mark/mark.js.map +1 -1
  20. package/esm/api/mark/types.d.ts +1 -0
  21. package/esm/api/node.d.ts +4 -5
  22. package/esm/api/node.js +5 -7
  23. package/esm/api/node.js.map +1 -1
  24. package/esm/api/props.d.ts +1 -0
  25. package/esm/api/props.js +10 -10
  26. package/esm/api/props.js.map +1 -1
  27. package/esm/component/axis.d.ts +1 -1
  28. package/esm/component/axis.js +11 -4
  29. package/esm/component/axis.js.map +1 -1
  30. package/esm/component/index.d.ts +10 -5
  31. package/esm/component/index.js.map +1 -1
  32. package/esm/composition/index.d.ts +16 -8
  33. package/esm/composition/index.js.map +1 -1
  34. package/esm/composition/rect.js +1 -1
  35. package/esm/composition/rect.js.map +1 -1
  36. package/esm/coordinate/index.d.ts +24 -12
  37. package/esm/coordinate/index.js.map +1 -1
  38. package/esm/data/arc.d.ts +7 -0
  39. package/esm/data/arc.js +10 -18
  40. package/esm/data/arc.js.map +1 -1
  41. package/esm/data/cluster.d.ts +8 -0
  42. package/esm/data/cluster.js +36 -46
  43. package/esm/data/cluster.js.map +1 -1
  44. package/esm/data/custom.d.ts +7 -0
  45. package/esm/data/custom.js +10 -0
  46. package/esm/data/custom.js.map +1 -0
  47. package/esm/data/fetch.js +7 -6
  48. package/esm/data/fetch.js.map +1 -1
  49. package/esm/data/filterBy.js +6 -2
  50. package/esm/data/filterBy.js.map +1 -1
  51. package/esm/data/index.d.ts +28 -9
  52. package/esm/data/index.js +6 -1
  53. package/esm/data/index.js.map +1 -1
  54. package/esm/data/map.d.ts +7 -0
  55. package/esm/data/map.js +10 -0
  56. package/esm/data/map.js.map +1 -0
  57. package/esm/data/sankey.d.ts +8 -0
  58. package/esm/data/sankey.js +76 -95
  59. package/esm/data/sankey.js.map +1 -1
  60. package/esm/data/sortBy.js +14 -4
  61. package/esm/data/sortBy.js.map +1 -1
  62. package/esm/data/tree.d.ts +4 -0
  63. package/esm/data/tree.js +6 -9
  64. package/esm/data/tree.js.map +1 -1
  65. package/esm/data/utils/arc/index.d.ts +1 -1
  66. package/esm/data/utils/fields.d.ts +6 -0
  67. package/esm/data/utils/fields.js +15 -0
  68. package/esm/data/utils/fields.js.map +1 -0
  69. package/esm/data/voronoi.d.ts +1 -0
  70. package/esm/data/voronoi.js +1 -22
  71. package/esm/data/voronoi.js.map +1 -1
  72. package/esm/data/wordCloud.d.ts +1 -0
  73. package/esm/data/wordCloud.js +1 -93
  74. package/esm/data/wordCloud.js.map +1 -1
  75. package/esm/encode/index.d.ts +8 -4
  76. package/esm/encode/index.js.map +1 -1
  77. package/esm/interaction/action/index.d.ts +42 -21
  78. package/esm/interaction/action/index.js +8 -8
  79. package/esm/interaction/action/index.js.map +1 -1
  80. package/esm/interaction/index.d.ts +1 -1
  81. package/esm/interaction/index.js +0 -1
  82. package/esm/interaction/index.js.map +1 -1
  83. package/esm/interaction/interactor/index.d.ts +4 -2
  84. package/esm/interaction/interactor/index.js.map +1 -1
  85. package/esm/mark/annotation/index.d.ts +14 -7
  86. package/esm/mark/annotation/index.js +6 -6
  87. package/esm/mark/annotation/index.js.map +1 -1
  88. package/esm/mark/geometry/{schema.d.ts → box.d.ts} +4 -4
  89. package/esm/mark/geometry/{schema.js → box.js} +4 -4
  90. package/esm/mark/geometry/box.js.map +1 -0
  91. package/esm/mark/geometry/image.js +5 -4
  92. package/esm/mark/geometry/image.js.map +1 -1
  93. package/esm/mark/geometry/index.d.ts +22 -13
  94. package/esm/mark/geometry/index.js +1 -3
  95. package/esm/mark/geometry/index.js.map +1 -1
  96. package/esm/mark/geometry/interval.js +0 -1
  97. package/esm/mark/geometry/interval.js.map +1 -1
  98. package/esm/mark/geometry/line.js +5 -1
  99. package/esm/mark/geometry/line.js.map +1 -1
  100. package/esm/mark/geometry/link.js +1 -1
  101. package/esm/mark/geometry/link.js.map +1 -1
  102. package/esm/mark/geometry/point.js +6 -2
  103. package/esm/mark/geometry/point.js.map +1 -1
  104. package/esm/mark/geometry/polygon.js +1 -1
  105. package/esm/mark/geometry/polygon.js.map +1 -1
  106. package/esm/palette/index.d.ts +4 -2
  107. package/esm/palette/index.js.map +1 -1
  108. package/esm/runtime/component.d.ts +1 -1
  109. package/esm/runtime/component.js +8 -3
  110. package/esm/runtime/component.js.map +1 -1
  111. package/esm/runtime/mark.js +4 -3
  112. package/esm/runtime/mark.js.map +1 -1
  113. package/esm/runtime/plot.js +47 -28
  114. package/esm/runtime/plot.js.map +1 -1
  115. package/esm/runtime/render.js +15 -6
  116. package/esm/runtime/render.js.map +1 -1
  117. package/esm/runtime/scale.js +1 -1
  118. package/esm/runtime/scale.js.map +1 -1
  119. package/esm/runtime/types/component.d.ts +4 -6
  120. package/esm/runtime/types/options.d.ts +1 -0
  121. package/esm/scale/index.d.ts +22 -11
  122. package/esm/scale/index.js.map +1 -1
  123. package/esm/shape/annotation/text.js +16 -4
  124. package/esm/shape/annotation/text.js.map +1 -1
  125. package/esm/shape/{schema → box}/box.d.ts +0 -0
  126. package/esm/shape/{schema → box}/box.js +2 -2
  127. package/esm/shape/box/box.js.map +1 -0
  128. package/esm/shape/index.d.ts +86 -48
  129. package/esm/shape/index.js +9 -12
  130. package/esm/shape/index.js.map +1 -1
  131. package/esm/shape/label/label.js +62 -38
  132. package/esm/shape/label/label.js.map +1 -1
  133. package/esm/shape/{edge → link}/arc.d.ts +0 -0
  134. package/esm/shape/{edge → link}/arc.js +0 -0
  135. package/esm/shape/{edge → link}/arc.js.map +1 -1
  136. package/esm/shape/{edge → link}/smoothEdge.d.ts +0 -0
  137. package/esm/shape/{edge → link}/smoothEdge.js +0 -0
  138. package/esm/shape/{edge → link}/smoothEdge.js.map +1 -1
  139. package/esm/shape/{edge → link}/vhv.d.ts +0 -0
  140. package/esm/shape/{edge → link}/vhv.js +0 -0
  141. package/esm/shape/{edge → link}/vhv.js.map +1 -1
  142. package/esm/shape/{edge → polygon}/ribbon.d.ts +0 -0
  143. package/esm/shape/{edge → polygon}/ribbon.js +0 -0
  144. package/esm/shape/polygon/ribbon.js.map +1 -0
  145. package/esm/spec/data.d.ts +145 -8
  146. package/esm/spec/geometry.d.ts +5 -3
  147. package/esm/spec/transform.d.ts +18 -8
  148. package/esm/spec/transform.js +0 -133
  149. package/esm/spec/transform.js.map +1 -1
  150. package/esm/stdlib/index.js +13 -17
  151. package/esm/stdlib/index.js.map +1 -1
  152. package/esm/transform/dodgeX.js +7 -3
  153. package/esm/transform/dodgeX.js.map +1 -1
  154. package/esm/transform/flexX.d.ts +7 -0
  155. package/esm/transform/flexX.js +31 -0
  156. package/esm/transform/flexX.js.map +1 -0
  157. package/esm/transform/groupX.js +17 -19
  158. package/esm/transform/groupX.js.map +1 -1
  159. package/esm/transform/index.d.ts +46 -21
  160. package/esm/transform/index.js +3 -1
  161. package/esm/transform/index.js.map +1 -1
  162. package/esm/transform/normalizeY.js +1 -2
  163. package/esm/transform/normalizeY.js.map +1 -1
  164. package/esm/transform/sortX.d.ts +8 -0
  165. package/esm/transform/sortX.js +60 -0
  166. package/esm/transform/sortX.js.map +1 -0
  167. package/esm/transform/stackY.d.ts +1 -1
  168. package/esm/transform/stackY.js +26 -9
  169. package/esm/transform/stackY.js.map +1 -1
  170. package/esm/utils/coordinate.d.ts +1 -0
  171. package/esm/utils/coordinate.js +3 -0
  172. package/esm/utils/coordinate.js.map +1 -1
  173. package/lib/adjust/index.d.ts +2 -1
  174. package/lib/adjust/index.js.map +1 -1
  175. package/lib/animation/index.d.ts +14 -7
  176. package/lib/animation/index.js.map +1 -1
  177. package/lib/animation/scaleInX.js +3 -0
  178. package/lib/animation/scaleInX.js.map +1 -1
  179. package/lib/animation/scaleInY.js +3 -0
  180. package/lib/animation/scaleInY.js.map +1 -1
  181. package/lib/api/chart.d.ts +4 -0
  182. package/lib/api/chart.js +20 -3
  183. package/lib/api/chart.js.map +1 -1
  184. package/lib/api/mark/index.d.ts +3 -3
  185. package/lib/api/mark/index.js +1 -1
  186. package/lib/api/mark/index.js.map +1 -1
  187. package/lib/api/mark/mark.d.ts +4 -4
  188. package/lib/api/mark/mark.js +7 -6
  189. package/lib/api/mark/mark.js.map +1 -1
  190. package/lib/api/mark/types.d.ts +1 -0
  191. package/lib/api/node.d.ts +4 -5
  192. package/lib/api/node.js +5 -7
  193. package/lib/api/node.js.map +1 -1
  194. package/lib/api/props.d.ts +1 -0
  195. package/lib/api/props.js +10 -10
  196. package/lib/api/props.js.map +1 -1
  197. package/lib/component/axis.d.ts +1 -1
  198. package/lib/component/axis.js +11 -4
  199. package/lib/component/axis.js.map +1 -1
  200. package/lib/component/index.d.ts +10 -5
  201. package/lib/component/index.js.map +1 -1
  202. package/lib/composition/index.d.ts +16 -8
  203. package/lib/composition/index.js.map +1 -1
  204. package/lib/composition/rect.js +1 -1
  205. package/lib/composition/rect.js.map +1 -1
  206. package/lib/coordinate/index.d.ts +24 -12
  207. package/lib/coordinate/index.js.map +1 -1
  208. package/lib/data/arc.d.ts +7 -0
  209. package/lib/data/arc.js +14 -18
  210. package/lib/data/arc.js.map +1 -1
  211. package/lib/data/cluster.d.ts +8 -0
  212. package/lib/data/cluster.js +41 -46
  213. package/lib/data/cluster.js.map +1 -1
  214. package/lib/data/custom.d.ts +7 -0
  215. package/lib/data/custom.js +14 -0
  216. package/lib/data/custom.js.map +1 -0
  217. package/lib/data/fetch.js +6 -5
  218. package/lib/data/fetch.js.map +1 -1
  219. package/lib/data/filterBy.js +6 -2
  220. package/lib/data/filterBy.js.map +1 -1
  221. package/lib/data/index.d.ts +28 -9
  222. package/lib/data/index.js +13 -3
  223. package/lib/data/index.js.map +1 -1
  224. package/lib/data/map.d.ts +7 -0
  225. package/lib/data/map.js +14 -0
  226. package/lib/data/map.js.map +1 -0
  227. package/lib/data/sankey.d.ts +8 -0
  228. package/lib/data/sankey.js +80 -95
  229. package/lib/data/sankey.js.map +1 -1
  230. package/lib/data/sortBy.js +14 -4
  231. package/lib/data/sortBy.js.map +1 -1
  232. package/lib/data/tree.d.ts +4 -0
  233. package/lib/data/tree.js +10 -9
  234. package/lib/data/tree.js.map +1 -1
  235. package/lib/data/utils/arc/index.d.ts +1 -1
  236. package/lib/data/utils/fields.d.ts +6 -0
  237. package/lib/data/utils/fields.js +19 -0
  238. package/lib/data/utils/fields.js.map +1 -0
  239. package/lib/data/voronoi.d.ts +1 -0
  240. package/lib/data/voronoi.js +2 -22
  241. package/lib/data/voronoi.js.map +1 -1
  242. package/lib/data/wordCloud.d.ts +1 -0
  243. package/lib/data/wordCloud.js +2 -93
  244. package/lib/data/wordCloud.js.map +1 -1
  245. package/lib/encode/index.d.ts +8 -4
  246. package/lib/encode/index.js.map +1 -1
  247. package/lib/interaction/action/index.d.ts +42 -21
  248. package/lib/interaction/action/index.js.map +1 -1
  249. package/lib/interaction/index.d.ts +1 -1
  250. package/lib/interaction/index.js +0 -15
  251. package/lib/interaction/index.js.map +1 -1
  252. package/lib/interaction/interactor/index.d.ts +4 -2
  253. package/lib/interaction/interactor/index.js.map +1 -1
  254. package/lib/mark/annotation/index.d.ts +14 -7
  255. package/lib/mark/annotation/index.js.map +1 -1
  256. package/lib/mark/geometry/{schema.d.ts → box.d.ts} +4 -4
  257. package/lib/mark/geometry/{schema.js → box.js} +6 -6
  258. package/lib/mark/geometry/box.js.map +1 -0
  259. package/lib/mark/geometry/image.js +5 -4
  260. package/lib/mark/geometry/image.js.map +1 -1
  261. package/lib/mark/geometry/index.d.ts +22 -13
  262. package/lib/mark/geometry/index.js +3 -7
  263. package/lib/mark/geometry/index.js.map +1 -1
  264. package/lib/mark/geometry/interval.js +0 -1
  265. package/lib/mark/geometry/interval.js.map +1 -1
  266. package/lib/mark/geometry/line.js +5 -1
  267. package/lib/mark/geometry/line.js.map +1 -1
  268. package/lib/mark/geometry/link.js +1 -1
  269. package/lib/mark/geometry/link.js.map +1 -1
  270. package/lib/mark/geometry/point.js +6 -2
  271. package/lib/mark/geometry/point.js.map +1 -1
  272. package/lib/mark/geometry/polygon.js +1 -1
  273. package/lib/mark/geometry/polygon.js.map +1 -1
  274. package/lib/palette/index.d.ts +4 -2
  275. package/lib/palette/index.js.map +1 -1
  276. package/lib/runtime/component.d.ts +1 -1
  277. package/lib/runtime/component.js +8 -3
  278. package/lib/runtime/component.js.map +1 -1
  279. package/lib/runtime/mark.js +4 -3
  280. package/lib/runtime/mark.js.map +1 -1
  281. package/lib/runtime/plot.js +47 -28
  282. package/lib/runtime/plot.js.map +1 -1
  283. package/lib/runtime/render.js +15 -6
  284. package/lib/runtime/render.js.map +1 -1
  285. package/lib/runtime/scale.js +1 -1
  286. package/lib/runtime/scale.js.map +1 -1
  287. package/lib/runtime/types/component.d.ts +4 -6
  288. package/lib/runtime/types/options.d.ts +1 -0
  289. package/lib/scale/index.d.ts +22 -11
  290. package/lib/scale/index.js.map +1 -1
  291. package/lib/shape/annotation/text.js +16 -4
  292. package/lib/shape/annotation/text.js.map +1 -1
  293. package/lib/shape/{schema → box}/box.d.ts +0 -0
  294. package/lib/shape/{schema → box}/box.js +2 -2
  295. package/lib/shape/box/box.js.map +1 -0
  296. package/lib/shape/index.d.ts +86 -48
  297. package/lib/shape/index.js +10 -16
  298. package/lib/shape/index.js.map +1 -1
  299. package/lib/shape/label/label.js +61 -37
  300. package/lib/shape/label/label.js.map +1 -1
  301. package/lib/shape/{edge → link}/arc.d.ts +0 -0
  302. package/lib/shape/{edge → link}/arc.js +0 -0
  303. package/lib/shape/{edge → link}/arc.js.map +1 -1
  304. package/lib/shape/{edge → link}/smoothEdge.d.ts +0 -0
  305. package/lib/shape/{edge → link}/smoothEdge.js +0 -0
  306. package/lib/shape/{edge → link}/smoothEdge.js.map +1 -1
  307. package/lib/shape/{edge → link}/vhv.d.ts +0 -0
  308. package/lib/shape/{edge → link}/vhv.js +0 -0
  309. package/lib/shape/{edge → link}/vhv.js.map +1 -1
  310. package/lib/shape/{edge → polygon}/ribbon.d.ts +0 -0
  311. package/lib/shape/{edge → polygon}/ribbon.js +0 -0
  312. package/lib/shape/polygon/ribbon.js.map +1 -0
  313. package/lib/spec/data.d.ts +145 -8
  314. package/lib/spec/geometry.d.ts +5 -3
  315. package/lib/spec/transform.d.ts +18 -8
  316. package/lib/spec/transform.js +0 -133
  317. package/lib/spec/transform.js.map +1 -1
  318. package/lib/stdlib/index.js +9 -13
  319. package/lib/stdlib/index.js.map +1 -1
  320. package/lib/transform/dodgeX.js +7 -3
  321. package/lib/transform/dodgeX.js.map +1 -1
  322. package/lib/transform/flexX.d.ts +7 -0
  323. package/lib/transform/flexX.js +35 -0
  324. package/lib/transform/flexX.js.map +1 -0
  325. package/lib/transform/groupX.js +16 -18
  326. package/lib/transform/groupX.js.map +1 -1
  327. package/lib/transform/index.d.ts +46 -21
  328. package/lib/transform/index.js +5 -1
  329. package/lib/transform/index.js.map +1 -1
  330. package/lib/transform/normalizeY.js +0 -1
  331. package/lib/transform/normalizeY.js.map +1 -1
  332. package/lib/transform/sortX.d.ts +8 -0
  333. package/lib/transform/sortX.js +64 -0
  334. package/lib/transform/sortX.js.map +1 -0
  335. package/lib/transform/stackY.d.ts +1 -1
  336. package/lib/transform/stackY.js +26 -9
  337. package/lib/transform/stackY.js.map +1 -1
  338. package/lib/utils/coordinate.d.ts +1 -0
  339. package/lib/utils/coordinate.js +5 -1
  340. package/lib/utils/coordinate.js.map +1 -1
  341. package/package.json +19 -4
  342. package/src/.DS_Store +0 -0
  343. package/src/adjust/index.ts +2 -1
  344. package/src/animation/index.ts +15 -7
  345. package/src/animation/morphing.ts +1 -1
  346. package/src/animation/scaleInX.ts +3 -0
  347. package/src/animation/scaleInY.ts +3 -0
  348. package/src/api/chart.ts +40 -3
  349. package/src/api/mark/index.ts +3 -3
  350. package/src/api/mark/mark.ts +6 -5
  351. package/src/api/mark/types.ts +1 -0
  352. package/src/api/node.ts +5 -6
  353. package/src/api/props.ts +14 -10
  354. package/src/component/axis.ts +13 -5
  355. package/src/component/index.ts +11 -5
  356. package/src/composition/index.ts +17 -8
  357. package/src/composition/rect.ts +1 -1
  358. package/src/coordinate/index.ts +25 -12
  359. package/src/data/arc.ts +13 -18
  360. package/src/data/cluster.ts +53 -56
  361. package/src/data/custom.ts +15 -0
  362. package/src/data/fetch.ts +12 -7
  363. package/src/data/filterBy.ts +11 -2
  364. package/src/data/index.ts +29 -9
  365. package/src/data/map.ts +15 -0
  366. package/src/data/sankey.ts +92 -95
  367. package/src/data/sortBy.ts +18 -8
  368. package/src/data/tree.ts +9 -9
  369. package/src/data/utils/arc/index.ts +1 -1
  370. package/src/data/utils/fields.ts +17 -0
  371. package/src/data/voronoi.ts +2 -0
  372. package/src/data/wordCloud.ts +2 -0
  373. package/src/encode/index.ts +9 -4
  374. package/src/interaction/action/index.ts +43 -45
  375. package/src/interaction/index.ts +17 -1
  376. package/src/interaction/interactor/index.ts +5 -2
  377. package/src/interaction/types.ts +1 -1
  378. package/src/mark/annotation/index.ts +15 -25
  379. package/src/mark/geometry/{schema.ts → box.ts} +5 -5
  380. package/src/mark/geometry/image.ts +4 -3
  381. package/src/mark/geometry/index.ts +23 -13
  382. package/src/mark/geometry/interval.ts +0 -1
  383. package/src/mark/geometry/line.ts +6 -1
  384. package/src/mark/geometry/link.ts +1 -1
  385. package/src/mark/geometry/point.ts +5 -2
  386. package/src/mark/geometry/polygon.ts +1 -1
  387. package/src/palette/index.ts +5 -2
  388. package/src/runtime/component.ts +10 -3
  389. package/src/runtime/mark.ts +4 -3
  390. package/src/runtime/plot.ts +66 -41
  391. package/src/runtime/render.ts +16 -10
  392. package/src/runtime/scale.ts +1 -1
  393. package/src/runtime/types/component.ts +1 -10
  394. package/src/runtime/types/options.ts +1 -0
  395. package/src/scale/index.ts +23 -11
  396. package/src/shape/annotation/text.ts +16 -4
  397. package/src/shape/{schema → box}/box.ts +2 -2
  398. package/src/shape/index.ts +92 -60
  399. package/src/shape/label/label.ts +81 -47
  400. package/src/shape/{edge → link}/arc.ts +0 -0
  401. package/src/shape/{edge → link}/smoothEdge.ts +0 -0
  402. package/src/shape/{edge → link}/vhv.ts +0 -0
  403. package/src/shape/{edge → polygon}/ribbon.ts +0 -0
  404. package/src/spec/data.ts +157 -8
  405. package/src/spec/geometry.ts +5 -3
  406. package/src/spec/transform.ts +37 -154
  407. package/src/stdlib/index.ts +18 -20
  408. package/src/transform/dodgeX.ts +5 -4
  409. package/src/transform/flexX.ts +38 -0
  410. package/src/transform/groupX.ts +25 -8
  411. package/src/transform/index.ts +47 -24
  412. package/src/transform/normalizeY.ts +0 -1
  413. package/src/transform/sortX.ts +48 -0
  414. package/src/transform/stackY.ts +34 -9
  415. package/src/utils/coordinate.ts +4 -0
  416. package/esm/data/connector.d.ts +0 -7
  417. package/esm/data/connector.js +0 -9
  418. package/esm/data/connector.js.map +0 -1
  419. package/esm/mark/geometry/edge.d.ts +0 -13
  420. package/esm/mark/geometry/edge.js +0 -31
  421. package/esm/mark/geometry/edge.js.map +0 -1
  422. package/esm/mark/geometry/node.d.ts +0 -8
  423. package/esm/mark/geometry/node.js +0 -27
  424. package/esm/mark/geometry/node.js.map +0 -1
  425. package/esm/mark/geometry/schema.js.map +0 -1
  426. package/esm/renderer/canvas.d.ts +0 -10
  427. package/esm/renderer/canvas.js +0 -18
  428. package/esm/renderer/canvas.js.map +0 -1
  429. package/esm/renderer/index.d.ts +0 -1
  430. package/esm/renderer/index.js +0 -2
  431. package/esm/renderer/index.js.map +0 -1
  432. package/esm/shape/edge/edge.d.ts +0 -6
  433. package/esm/shape/edge/edge.js +0 -11
  434. package/esm/shape/edge/edge.js.map +0 -1
  435. package/esm/shape/edge/ribbon.js.map +0 -1
  436. package/esm/shape/node/point.d.ts +0 -6
  437. package/esm/shape/node/point.js +0 -27
  438. package/esm/shape/node/point.js.map +0 -1
  439. package/esm/shape/node/polygon.d.ts +0 -3
  440. package/esm/shape/node/polygon.js +0 -8
  441. package/esm/shape/node/polygon.js.map +0 -1
  442. package/esm/shape/schema/box.js.map +0 -1
  443. package/lib/data/connector.d.ts +0 -7
  444. package/lib/data/connector.js +0 -13
  445. package/lib/data/connector.js.map +0 -1
  446. package/lib/mark/geometry/edge.d.ts +0 -13
  447. package/lib/mark/geometry/edge.js +0 -35
  448. package/lib/mark/geometry/edge.js.map +0 -1
  449. package/lib/mark/geometry/node.d.ts +0 -8
  450. package/lib/mark/geometry/node.js +0 -31
  451. package/lib/mark/geometry/node.js.map +0 -1
  452. package/lib/mark/geometry/schema.js.map +0 -1
  453. package/lib/renderer/canvas.d.ts +0 -10
  454. package/lib/renderer/canvas.js +0 -22
  455. package/lib/renderer/canvas.js.map +0 -1
  456. package/lib/renderer/index.d.ts +0 -1
  457. package/lib/renderer/index.js +0 -6
  458. package/lib/renderer/index.js.map +0 -1
  459. package/lib/shape/edge/edge.d.ts +0 -6
  460. package/lib/shape/edge/edge.js +0 -15
  461. package/lib/shape/edge/edge.js.map +0 -1
  462. package/lib/shape/edge/ribbon.js.map +0 -1
  463. package/lib/shape/node/point.d.ts +0 -6
  464. package/lib/shape/node/point.js +0 -31
  465. package/lib/shape/node/point.js.map +0 -1
  466. package/lib/shape/node/polygon.d.ts +0 -3
  467. package/lib/shape/node/polygon.js +0 -12
  468. package/lib/shape/node/polygon.js.map +0 -1
  469. package/lib/shape/schema/box.js.map +0 -1
  470. package/src/data/connector.ts +0 -14
  471. package/src/mark/geometry/edge.ts +0 -40
  472. package/src/mark/geometry/node.ts +0 -36
  473. package/src/renderer/canvas.ts +0 -27
  474. package/src/renderer/index.ts +0 -1
  475. package/src/shape/edge/edge.ts +0 -15
  476. package/src/shape/node/point.ts +0 -32
  477. package/src/shape/node/polygon.ts +0 -12
@@ -1,9 +1,14 @@
1
- import { Coordinate } from '@antv/coord';
1
+ import { Coordinate, Vector } from '@antv/coord';
2
2
  import { DisplayObject, Text } from '@antv/g';
3
3
  import { select } from '../../utils/selection';
4
4
  import { ShapeComponent as SC, Vector2 } from '../../runtime';
5
5
  import { applyStyle, getArcObject } from '../../shape/utils';
6
- import { isHelix, isPolar } from '../../utils/coordinate';
6
+ import {
7
+ isHelix,
8
+ isPolar,
9
+ isTranspose,
10
+ isCircular,
11
+ } from '../../utils/coordinate';
7
12
 
8
13
  type LabelPosition = 'top' | 'left' | 'right' | 'bottom' | 'inside' | 'outside';
9
14
 
@@ -11,7 +16,9 @@ export type LabelOptions = Record<string, any>;
11
16
 
12
17
  /**
13
18
  * 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.
19
+ * @todo Remove this temporary handle method, if runtime supports
20
+ * correct process: drawElement, do label layout and then do
21
+ * transitions together.
15
22
  */
16
23
  function getLocalBounds(element: DisplayObject) {
17
24
  const cloneElement = element.cloneNode();
@@ -24,31 +31,70 @@ function getLocalBounds(element: DisplayObject) {
24
31
  element.parentNode.appendChild(cloneElement);
25
32
  const bounds = cloneElement.getLocalBounds();
26
33
  cloneElement.destroy();
27
-
28
34
  return bounds;
29
35
  }
30
36
 
31
- function inferPosition(
37
+ function inferPosition(position: LabelPosition, coordinate: Coordinate) {
38
+ if (position !== undefined) return position;
39
+ if (isTranspose(coordinate)) return 'right';
40
+ if (isPolar(coordinate) || isHelix(coordinate)) return 'inside';
41
+ return 'top';
42
+ }
43
+
44
+ function maybePercentage(x: number | string, size: number) {
45
+ if (x === undefined) return null;
46
+ if (typeof x === 'number') return x;
47
+ const px = +x.replace('%', '');
48
+ return Number.isNaN(px) ? null : (px / 100) * size;
49
+ }
50
+
51
+ function inferNonCircularStyle(
52
+ position: LabelPosition,
32
53
  points: Vector2[],
33
- value,
54
+ value: Record<string, any>,
34
55
  coordinate: Coordinate,
56
+ ) {
57
+ const element: DisplayObject = value.element;
58
+ const { halfExtents } = getLocalBounds(element);
59
+ const w = halfExtents[0] * 2;
60
+ const h = halfExtents[1] * 2;
61
+ const xy = (options) => {
62
+ const { x, y } = value;
63
+ const px = maybePercentage(x, w);
64
+ const py = maybePercentage(y, h);
65
+ return {
66
+ ...options,
67
+ ...(px !== null && { x }),
68
+ ...(py !== null && { y }),
69
+ };
70
+ };
71
+ if (position === 'left')
72
+ return xy({ x: 0, y: h / 2, textAnchor: 'start', textBaseline: 'middle' });
73
+ if (position === 'right')
74
+ return xy({ x: w, y: h / 2, textAnchor: 'end', textBaseline: 'middle' });
75
+ if (position === 'bottom')
76
+ return xy({ x: w / 2, y: h, textAnchor: 'center', textBaseline: 'bottom' });
77
+ if (position === 'inside')
78
+ return xy({
79
+ x: w / 2,
80
+ y: h / 2,
81
+ textAnchor: 'center',
82
+ textBaseline: 'middle',
83
+ });
84
+ if (position === 'top')
85
+ return xy({ x: w / 2, y: 0, textAnchor: 'center', textBaseline: 'bottom' });
86
+ return xy({});
87
+ }
88
+
89
+ function inferCircularStyle(
35
90
  position: LabelPosition,
91
+ points: Vector2[],
92
+ value: Record<string, any>,
93
+ coordinate: Coordinate,
36
94
  ) {
37
95
  const element: DisplayObject = value.element;
38
- const { min, halfExtents } = getLocalBounds(element);
96
+ const { min } = getLocalBounds(element);
39
97
  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
98
 
53
99
  // Infer the label position in polar coordinate.
54
100
  const { y, y1 } = value;
@@ -68,47 +114,35 @@ function inferPosition(
68
114
  return {
69
115
  x: center[0] + Math.sin(midAngle) * radius - x0,
70
116
  y: center[1] - Math.cos(midAngle) * radius - y0,
117
+ textAlign: 'center',
118
+ textBaseline: 'middle',
71
119
  };
72
120
  }
73
121
 
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
-
90
122
  /**
91
123
  * Render normal label for each mark.
92
124
  * @todo Support position option: middle...
93
125
  */
94
126
  export const Label: SC<LabelOptions> = (options) => {
95
- const { label: style = {} } = options;
96
127
  return (points, value, coordinate, theme) => {
97
- const { position, ...restStyle } = style;
128
+ const { position, text, ...overrideStyle } = value;
98
129
  const { labelFill: fill } = theme;
99
-
100
- const { x, y } = inferPosition(points, value, coordinate, position);
101
- const { label } = value;
102
- const defaultStyle = inferDefaultStyle(position);
130
+ const definedPosition = inferPosition(position, coordinate);
131
+ const inferDefaultStyle = isCircular(coordinate)
132
+ ? inferCircularStyle
133
+ : inferNonCircularStyle;
134
+ const defaultStyle = inferDefaultStyle(
135
+ definedPosition,
136
+ points,
137
+ value,
138
+ coordinate,
139
+ );
103
140
  return select(new Text())
104
- .style('x', x)
105
- .style('y', y)
106
- .style('text', `${label}`)
141
+ .call(applyStyle, defaultStyle)
142
+ .style('text', `${text}`)
107
143
  .style('fontSize', 12)
108
- .style('textAlign', 'center')
109
144
  .style('fill', fill)
110
- .call(applyStyle, defaultStyle)
111
- .call(applyStyle, restStyle)
145
+ .call(applyStyle, overrideStyle)
112
146
  .node();
113
147
  };
114
148
  };
File without changes
File without changes
File without changes
File without changes
package/src/spec/data.ts CHANGED
@@ -1,13 +1,14 @@
1
- import { DataComponent } from '../runtime';
1
+ import { DataComponent, Vector2 } from '../runtime';
2
2
  export type Data = FetchConnector | InlineConnector | any;
3
3
 
4
4
  export type FetchConnector = {
5
5
  type?: 'fetch';
6
6
  value?: string;
7
7
  format?: 'json' | 'csv';
8
- callback?: (d: any) => any;
9
8
  // Useful when format is 'csv'.
10
9
  delimiter?: string;
10
+ /** Automatically infer the data to Javascript type */
11
+ autoType?: boolean;
11
12
  transform?: DataTransform[];
12
13
  };
13
14
 
@@ -37,8 +38,8 @@ export type DataTransformTypes =
37
38
 
38
39
  export type SortByTransform = {
39
40
  type?: 'sortBy';
40
- fields?: string[];
41
- order?: 'DESC' | 'ASC';
41
+ /** type: [field, order]; order: true => ascend, false => descend */
42
+ fields?: (string | [string, boolean?])[];
42
43
  };
43
44
 
44
45
  export type PickTransform = {
@@ -60,8 +61,11 @@ export type SubsetTransform = {
60
61
 
61
62
  export type FilterByTransform = {
62
63
  type?: 'filterBy';
63
- fields?: string[];
64
- callback?: (d: any) => boolean;
64
+ /**
65
+ * way1: [[field1, callback1], [field2, callback2], ...]
66
+ * way2: [field1, field2, field3, callback] All field filtered by the last callback.
67
+ */
68
+ fields?: ([string, ((d: any) => boolean)?] | string)[];
65
69
  };
66
70
 
67
71
  export type FoldTransform = {
@@ -70,8 +74,8 @@ export type FoldTransform = {
70
74
  as?: string[];
71
75
  };
72
76
 
73
- export type ConnectorTransform = {
74
- type?: 'connector';
77
+ export type CustomDataTransform = {
78
+ type?: 'custom';
75
79
  callback?: (d: any) => any;
76
80
  };
77
81
 
@@ -79,3 +83,148 @@ export type CustomTransform = {
79
83
  type?: DataComponent;
80
84
  [key: string]: any;
81
85
  };
86
+
87
+ // Transforms for graph.
88
+ export type SankeyTransform = {
89
+ type?: 'sankey';
90
+ nodeId?: (node: any) => string;
91
+ nodes?: (graph: any) => any;
92
+ links?: (graph: any) => any;
93
+ /**
94
+ * sankey.nodeSort(undefined) is the default and resorts by ascending breadth during each iteration.
95
+ * sankey.nodeSort(null) specifies the input order of nodes and never sorts.
96
+ * sankey.nodeSort(function) specifies the given order as a comparator function and sorts once on initialization.
97
+ */
98
+ nodeSort?: null | undefined | ((a: any, b: any) => number);
99
+ /**
100
+ * sankey.linkSort(undefined) is the default, indicating that vertical order of links within each node will be determined automatically by the layout. If
101
+ * sankey.linkSort(null) will resort by the input.
102
+ * sankey.linkSort(function) specifies the given order as a comparator function and sorts once on initialization.
103
+ */
104
+ linkSort?: null | undefined | ((a: any, b: any) => number);
105
+ nodeAlign?:
106
+ | 'left'
107
+ | 'center'
108
+ | 'right'
109
+ | 'justify'
110
+ | ((node: any, n: number) => number);
111
+ nodeWidth?: number;
112
+ nodePadding?: number;
113
+ iterations?: number;
114
+ // support config the depth of node
115
+ nodeDepth?: (datum: any, maxDepth: number) => number;
116
+ };
117
+
118
+ export type WordCloudTransform = {
119
+ type?: 'wordCloud';
120
+ /**
121
+ * @description If specified, sets the rectangular [width, height] of the layout
122
+ * @default [1, 1]
123
+ */
124
+ size?: [number, number];
125
+ font?: string | ((word: any) => string);
126
+ fontStyle?: string | ((word: any) => string);
127
+ fontWeight?: any | ((word: any) => any);
128
+ fontSize?: number | [number, number] | ((word: any) => number);
129
+ padding?: number | ((word: any) => number);
130
+ /**
131
+ * @description sets the text accessor function, which indicates the text for each word
132
+ * @default (d) => d.text
133
+ */
134
+ text?: (word: any) => number;
135
+ rotate?: number | ((word: any) => number);
136
+ timeInterval?: number;
137
+ random?: number | (() => number);
138
+ /**
139
+ * @description sets the current type of spiral used for positioning words. This can either be one of the two built-in spirals, "archimedean" and "rectangular"
140
+ * @default "archimedean"
141
+ */
142
+ spiral?:
143
+ | 'archimedean'
144
+ | 'rectangular'
145
+ | ((size: [number, number]) => (t: number) => number[]);
146
+ imageMask?: HTMLImageElement | string;
147
+ on?:
148
+ | ((type: 'end', details?: { cloud; words; bounds }) => void)
149
+ | ((type: 'word', details?: { cloud; word }) => void);
150
+ };
151
+
152
+ export type VoronoiTransform = {
153
+ type?: 'voronoi';
154
+ /**
155
+ * @description Sets the input fields from the data.
156
+ */
157
+ fields: [string, string];
158
+ /**
159
+ * @description Sets the output fields into data.
160
+ */
161
+ as: [string, string];
162
+ /**
163
+ * @description Sets region of canvas.
164
+ */
165
+ extend: Vector2[];
166
+ };
167
+
168
+ /**
169
+ * For arc diagram(edge with weight) or chord diagram(with weight)
170
+ */
171
+ export type ArcTransform = {
172
+ type?: 'arc';
173
+ /** Layout y position, default: 0 */
174
+ y?: number;
175
+ /** margin between nodes, [0, 1), default: 0.1 */
176
+ marginRatio?: number;
177
+ /** Thickness of node, default: 0.05 */
178
+ thickness?: number;
179
+ /** Whether calculate weight, default: false */
180
+ weight?: boolean;
181
+ /** Key of node, default: node.id */
182
+ id?: (node: any) => any;
183
+ /** Source key of edge, default: edge.source */
184
+ source?: (edge: any) => any;
185
+ /** Target key of edge, default: edge.target */
186
+ target?: (edge: any) => any;
187
+ /** Weight of source, default: edge.value || 1 */
188
+ sourceWeight?: (edge: any) => number;
189
+ /** Weight of target, default: edge.value || 1 */
190
+ targetWeight?: (edge: any) => number;
191
+ /** Sort method, default: null */
192
+ sortBy?: 'id' | 'weight' | 'frequency' | null | ((a: any, b: any) => number);
193
+ };
194
+
195
+ /**
196
+ * Cluster layout options.
197
+ */
198
+ export type ClusterTransform = {
199
+ type?: 'cluster';
200
+ /**
201
+ * Layout field. Default: 'value'.
202
+ */
203
+ field?: string;
204
+ /**
205
+ * Sets this cluster layout’s node size to the specified two-element array of numbers [width, height] and returns this cluster layout.
206
+ * Default: null.
207
+ */
208
+ nodeSize?: any;
209
+ /**
210
+ * The separation accessor is used to separate neighboring leaves. Default: (a, b) => a.parent == b.parent ? 1 : 2;
211
+ */
212
+ separation?: (a, b) => number;
213
+ /**
214
+ * Sort function by compare 2 nodes.
215
+ */
216
+ sortBy?: (a, b) => number;
217
+ /**
218
+ * Layout infomation saved into fields. Default: ['x', 'y'].
219
+ */
220
+ as?: [string, string];
221
+ };
222
+
223
+ export type TreeTransform = Omit<ClusterTransform, 'type'> & {
224
+ type?: 'tree';
225
+ };
226
+
227
+ export type MapTransform = {
228
+ type?: 'map';
229
+ callback?: (d: any) => any;
230
+ };
@@ -19,7 +19,7 @@ export type Geometry =
19
19
  | EdgeGeometry
20
20
  | ImageGeometry
21
21
  | PolygonGeometry
22
- | SchemaGeometry
22
+ | BoxGeometry
23
23
  | VectorGeometry
24
24
  | AnnotationText
25
25
  | CustomComponent;
@@ -36,7 +36,7 @@ export type GeometryTypes =
36
36
  | 'link'
37
37
  | 'image'
38
38
  | 'polygon'
39
- | 'schema'
39
+ | 'box'
40
40
  | 'vector'
41
41
  | 'annotation.text'
42
42
  | 'annotation.lineX'
@@ -86,6 +86,8 @@ export type BaseGeometry<
86
86
  adjust?: Adjust;
87
87
  facet?: boolean;
88
88
  frame?: boolean;
89
+ labels?: Record<string, any>[];
90
+ stack?: boolean;
89
91
  animate?: {
90
92
  enter?: Animation;
91
93
  exit?: Animation;
@@ -158,7 +160,7 @@ export type ImageGeometry = BaseGeometry<'image', ChannelTypes | 'src'>;
158
160
 
159
161
  export type PolygonGeometry = BaseGeometry<'polygon'>;
160
162
 
161
- export type SchemaGeometry = BaseGeometry<'schema'>;
163
+ export type BoxGeometry = BaseGeometry<'box'>;
162
164
 
163
165
  export type VectorGeometry = BaseGeometry<
164
166
  'vector',
@@ -12,15 +12,9 @@ export type Transform =
12
12
  | SelectTransform
13
13
  | SelectXTransform
14
14
  | SelectYTransform
15
- | GroupXTransform;
16
-
17
- export type TransformOrder =
18
- | 'value'
19
- | 'sum'
20
- | 'series'
21
- | 'maxIndex'
22
- | string[]
23
- | ((data: Record<string, Primitive>) => Primitive);
15
+ | GroupXTransform
16
+ | SortXTransform
17
+ | FlexXTransform;
24
18
 
25
19
  export type TransformTypes =
26
20
  | 'dodgeX'
@@ -34,15 +28,24 @@ export type TransformTypes =
34
28
  | 'selectY'
35
29
  | 'selectX'
36
30
  | 'groupX'
31
+ | 'sortX'
32
+ | 'flexX'
37
33
  | TransformComponent;
38
34
 
35
+ export type TransformOrder =
36
+ | 'value'
37
+ | 'sum'
38
+ | 'series'
39
+ | 'maxIndex'
40
+ | string[]
41
+ | null
42
+ | ((data: Record<string, Primitive>) => Primitive);
43
+
39
44
  export type DodgeXTransform = {
40
45
  type?: 'dodgeX';
41
46
  groupBy?: string | string[];
42
47
  reverse?: boolean;
43
48
  orderBy?: TransformOrder;
44
- paddingInner?: number;
45
- paddingOuter?: number;
46
49
  padding?: number;
47
50
  };
48
51
 
@@ -52,6 +55,7 @@ export type StackYTransform = {
52
55
  reverse?: boolean;
53
56
  orderBy?: TransformOrder;
54
57
  y?: 'y' | 'y1';
58
+ series?: boolean;
55
59
  };
56
60
 
57
61
  export type NormalizeYTransform = {
@@ -66,8 +70,7 @@ export type NormalizeYTransform = {
66
70
  | 'mean'
67
71
  | 'median'
68
72
  | 'min'
69
- | 'sum'
70
- | 'extent';
73
+ | 'sum';
71
74
  };
72
75
 
73
76
  export type JitterTransform = {
@@ -117,6 +120,27 @@ export type SelectYTransform = {
117
120
  selector?: Selector;
118
121
  };
119
122
 
123
+ export type SortXTransform = {
124
+ type?: 'sortX';
125
+ reverse?: boolean;
126
+ channel?: string;
127
+ slice?: number | [number, number];
128
+ reducer?:
129
+ | 'max'
130
+ | 'min'
131
+ | 'sum'
132
+ | 'first'
133
+ | 'last'
134
+ | ((I: number[], V: Primitive[]) => Primitive);
135
+ };
136
+
137
+ export type FlexXTransform = {
138
+ type?: 'flexX';
139
+ field?: string | ((d: any) => Primitive[]);
140
+ channel?: string;
141
+ reducer?: 'sum' | ((I: number[], V: Primitive[]) => Primitive);
142
+ };
143
+
120
144
  export type Reducer =
121
145
  | 'mean'
122
146
  | 'max'
@@ -130,145 +154,4 @@ export type Reducer =
130
154
 
131
155
  export type GroupXTransform = {
132
156
  type?: 'groupX';
133
- orderBy?: ChannelTypes;
134
- reverse?: boolean;
135
157
  } & { [key in ChannelTypes]?: Reducer };
136
-
137
- // export type SankeyTransform = {
138
- // type?: 'sankey';
139
- // nodeId?: (node: any) => string;
140
- // nodes?: (graph: any) => any;
141
- // links?: (graph: any) => any;
142
- // /**
143
- // * sankey.nodeSort(undefined) is the default and resorts by ascending breadth during each iteration.
144
- // * sankey.nodeSort(null) specifies the input order of nodes and never sorts.
145
- // * sankey.nodeSort(function) specifies the given order as a comparator function and sorts once on initialization.
146
- // */
147
- // nodeSort?: null | undefined | ((a: any, b: any) => number);
148
- // /**
149
- // * sankey.linkSort(undefined) is the default, indicating that vertical order of links within each node will be determined automatically by the layout. If
150
- // * sankey.linkSort(null) will resort by the input.
151
- // * sankey.linkSort(function) specifies the given order as a comparator function and sorts once on initialization.
152
- // */
153
- // linkSort?: null | undefined | ((a: any, b: any) => number);
154
- // nodeAlign?:
155
- // | 'left'
156
- // | 'center'
157
- // | 'right'
158
- // | 'justify'
159
- // | ((node: any, n: number) => number);
160
- // nodeWidth?: number;
161
- // nodePadding?: number;
162
- // iterations?: number;
163
- // // support config the depth of node
164
- // nodeDepth?: (datum: any, maxDepth: number) => number;
165
- // };
166
-
167
- // export type WordCloudTransform = {
168
- // type?: 'wordCloud';
169
- // /**
170
- // * @description If specified, sets the rectangular [width, height] of the layout
171
- // * @default [1, 1]
172
- // */
173
- // size?: [number, number];
174
- // font?: string | ((word: any) => string);
175
- // fontStyle?: string | ((word: any) => string);
176
- // fontWeight?: any | ((word: any) => any);
177
- // fontSize?: number | [number, number] | ((word: any) => number);
178
- // padding?: number | ((word: any) => number);
179
- // /**
180
- // * @description sets the text accessor function, which indicates the text for each word
181
- // * @default (d) => d.text
182
- // */
183
- // text?: (word: any) => number;
184
- // rotate?: number | ((word: any) => number);
185
- // timeInterval?: number;
186
- // random?: number | (() => number);
187
- // /**
188
- // * @description sets the current type of spiral used for positioning words. This can either be one of the two built-in spirals, "archimedean" and "rectangular"
189
- // * @default "archimedean"
190
- // */
191
- // spiral?:
192
- // | 'archimedean'
193
- // | 'rectangular'
194
- // | ((size: [number, number]) => (t: number) => number[]);
195
- // imageMask?: HTMLImageElement | string;
196
- // on?:
197
- // | ((type: 'end', details?: { cloud; words; bounds }) => void)
198
- // | ((type: 'word', details?: { cloud; word }) => void);
199
- // };
200
-
201
- // export type VoronoiTransform = {
202
- // type?: 'voronoi';
203
- // /**
204
- // * @description Sets the input fields from the data.
205
- // */
206
- // fields: [string, string];
207
- // /**
208
- // * @description Sets the output fields into data.
209
- // */
210
- // as: [string, string];
211
- // /**
212
- // * @description Sets region of canvas.
213
- // */
214
- // extend: Vector2[];
215
- // };
216
-
217
- // /**
218
- // * For arc diagram(edge with weight) or chord diagram(with weight)
219
- // */
220
- // export type ArcTransform = {
221
- // type?: 'arc';
222
- // /** Layout y position, default: 0 */
223
- // y?: number;
224
- // /** margin between nodes, [0, 1), default: 0.1 */
225
- // marginRatio?: number;
226
- // /** Thickness of node, default: 0.05 */
227
- // thickness?: number;
228
- // /** Whether calculate weight, default: false */
229
- // weight?: boolean;
230
- // /** Key of node, default: node.id */
231
- // id?: (node: any) => any;
232
- // /** Source key of edge, default: edge.source */
233
- // source?: (edge: any) => any;
234
- // /** Target key of edge, default: edge.target */
235
- // target?: (edge: any) => any;
236
- // /** Weight of source, default: edge.value || 1 */
237
- // sourceWeight?: (edge: any) => number;
238
- // /** Weight of target, default: edge.value || 1 */
239
- // targetWeight?: (edge: any) => number;
240
- // /** Sort method, default: null */
241
- // sortBy?: 'id' | 'weight' | 'frequency' | null | ((a: any, b: any) => number);
242
- // };
243
-
244
- // /**
245
- // * Cluster layout options.
246
- // */
247
- // export type ClusterTransform = {
248
- // type?: 'cluster';
249
- // /**
250
- // * Layout field. Default: 'value'.
251
- // */
252
- // field?: string;
253
- // /**
254
- // * Sets this cluster layout’s node size to the specified two-element array of numbers [width, height] and returns this cluster layout.
255
- // * Default: null.
256
- // */
257
- // nodeSize?: any;
258
- // /**
259
- // * The separation accessor is used to separate neighboring leaves. Default: (a, b) => a.parent == b.parent ? 1 : 2;
260
- // */
261
- // separation?: (a, b) => number;
262
- // /**
263
- // * Sort function by compare 2 nodes.
264
- // */
265
- // sortBy?: (a, b) => number;
266
- // /**
267
- // * Layout infomation saved into fields. Default: ['x', 'y'].
268
- // */
269
- // as?: [string, string];
270
- // };
271
-
272
- // export type TreeTransform = Omit<ClusterTransform, 'type'> & {
273
- // type?: 'tree';
274
- // };