@antv/g2 5.0.17 → 5.0.19

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 (529) hide show
  1. package/dist/g2-lite.min.js +3 -3
  2. package/dist/g2.min.js +3 -3
  3. package/esm/api/chart.d.ts +1017 -85
  4. package/esm/api/chart.js +3 -259
  5. package/esm/api/chart.js.map +1 -1
  6. package/esm/api/composition.d.ts +37 -0
  7. package/esm/api/{composition/base.js → composition.js} +17 -5
  8. package/esm/api/composition.js.map +1 -0
  9. package/esm/api/define.d.ts +14 -0
  10. package/esm/api/define.js +92 -0
  11. package/esm/api/define.js.map +1 -0
  12. package/esm/api/extend.d.ts +9 -0
  13. package/esm/api/extend.js +9 -0
  14. package/esm/api/extend.js.map +1 -0
  15. package/esm/api/index.d.ts +2 -0
  16. package/esm/api/index.js +2 -0
  17. package/esm/api/index.js.map +1 -1
  18. package/esm/api/library.d.ts +170 -1
  19. package/esm/api/library.js +2 -2
  20. package/esm/api/library.js.map +1 -1
  21. package/esm/api/mark.d.ts +29 -0
  22. package/esm/api/{mark/base.js → mark.js} +16 -4
  23. package/esm/api/mark.js.map +1 -0
  24. package/esm/api/node.d.ts +2 -2
  25. package/esm/api/node.js.map +1 -1
  26. package/esm/api/props.d.ts +170 -12
  27. package/esm/api/props.js +21 -102
  28. package/esm/api/props.js.map +1 -1
  29. package/esm/api/runtime.d.ts +66 -0
  30. package/esm/api/runtime.js +294 -0
  31. package/esm/api/runtime.js.map +1 -0
  32. package/esm/api/types.d.ts +60 -5
  33. package/esm/api/utils.d.ts +1 -1
  34. package/esm/api/utils.js +11 -13
  35. package/esm/api/utils.js.map +1 -1
  36. package/esm/component/axis.js +7 -4
  37. package/esm/component/axis.js.map +1 -1
  38. package/esm/component/legendCategory.js +4 -5
  39. package/esm/component/legendCategory.js.map +1 -1
  40. package/esm/component/legendContinuous.js +6 -5
  41. package/esm/component/legendContinuous.js.map +1 -1
  42. package/esm/composition/d3Projection.js.map +1 -0
  43. package/esm/composition/geoPath.js.map +1 -0
  44. package/esm/{geo → composition}/geoView.js +1 -1
  45. package/esm/composition/geoView.js.map +1 -0
  46. package/esm/composition/index.d.ts +2 -0
  47. package/esm/composition/index.js +2 -0
  48. package/esm/composition/index.js.map +1 -1
  49. package/esm/index.d.ts +4 -3
  50. package/esm/index.js +3 -2
  51. package/esm/index.js.map +1 -1
  52. package/esm/interaction/legendFilter.d.ts +2 -0
  53. package/esm/interaction/legendFilter.js +66 -37
  54. package/esm/interaction/legendFilter.js.map +1 -1
  55. package/esm/label-transform/overlapDodgeY.js.map +1 -1
  56. package/esm/lib/core.d.ts +158 -0
  57. package/esm/lib/core.js +174 -0
  58. package/esm/lib/core.js.map +1 -0
  59. package/esm/lib/geo.d.ts +4 -0
  60. package/esm/lib/geo.js +9 -0
  61. package/esm/lib/geo.js.map +1 -0
  62. package/esm/lib/graph.d.ts +4 -0
  63. package/esm/lib/graph.js +8 -0
  64. package/esm/lib/graph.js.map +1 -0
  65. package/esm/lib/index.d.ts +6 -0
  66. package/esm/lib/index.js +7 -0
  67. package/esm/lib/index.js.map +1 -0
  68. package/esm/lib/lite.d.ts +64 -0
  69. package/esm/lib/lite.js +78 -0
  70. package/esm/lib/lite.js.map +1 -0
  71. package/esm/lib/plot.d.ts +11 -0
  72. package/esm/lib/plot.js +16 -0
  73. package/esm/lib/plot.js.map +1 -0
  74. package/esm/lib/std.d.ts +170 -0
  75. package/esm/lib/std.js +8 -0
  76. package/esm/lib/std.js.map +1 -0
  77. package/esm/mark/area.js +14 -5
  78. package/esm/mark/area.js.map +1 -1
  79. package/esm/mark/box.js +9 -2
  80. package/esm/mark/box.js.map +1 -1
  81. package/esm/mark/cell.js +11 -5
  82. package/esm/mark/cell.js.map +1 -1
  83. package/esm/mark/connector.js +6 -2
  84. package/esm/mark/connector.js.map +1 -1
  85. package/esm/mark/density.js +10 -7
  86. package/esm/mark/density.js.map +1 -1
  87. package/esm/mark/forceGraph.js +0 -3
  88. package/esm/mark/forceGraph.js.map +1 -1
  89. package/esm/mark/heatmap.js +9 -4
  90. package/esm/mark/heatmap.js.map +1 -1
  91. package/esm/mark/image.js +9 -4
  92. package/esm/mark/image.js.map +1 -1
  93. package/esm/mark/interval.js +13 -7
  94. package/esm/mark/interval.js.map +1 -1
  95. package/esm/mark/line.js +15 -4
  96. package/esm/mark/line.js.map +1 -1
  97. package/esm/mark/lineX.js +13 -6
  98. package/esm/mark/lineX.js.map +1 -1
  99. package/esm/mark/lineY.js +13 -6
  100. package/esm/mark/lineY.js.map +1 -1
  101. package/esm/mark/link.js +12 -4
  102. package/esm/mark/link.js.map +1 -1
  103. package/esm/mark/path.js +7 -2
  104. package/esm/mark/path.js.map +1 -1
  105. package/esm/mark/point.js +28 -29
  106. package/esm/mark/point.js.map +1 -1
  107. package/esm/mark/polygon.js +7 -2
  108. package/esm/mark/polygon.js.map +1 -1
  109. package/esm/mark/range.js +4 -2
  110. package/esm/mark/range.js.map +1 -1
  111. package/esm/mark/rangeX.js +6 -2
  112. package/esm/mark/rangeX.js.map +1 -1
  113. package/esm/mark/rangeY.js +6 -2
  114. package/esm/mark/rangeY.js.map +1 -1
  115. package/esm/mark/rect.js +9 -3
  116. package/esm/mark/rect.js.map +1 -1
  117. package/esm/mark/shape.js +9 -3
  118. package/esm/mark/shape.js.map +1 -1
  119. package/esm/mark/text.js +10 -4
  120. package/esm/mark/text.js.map +1 -1
  121. package/esm/mark/treemap.js.map +1 -1
  122. package/esm/mark/utils.d.ts +11 -8
  123. package/esm/mark/utils.js +8 -7
  124. package/esm/mark/utils.js.map +1 -1
  125. package/esm/mark/vector.js +6 -2
  126. package/esm/mark/vector.js.map +1 -1
  127. package/esm/runtime/index.d.ts +1 -1
  128. package/esm/runtime/index.js +1 -1
  129. package/esm/runtime/index.js.map +1 -1
  130. package/esm/runtime/plot.js +14 -10
  131. package/esm/runtime/plot.js.map +1 -1
  132. package/esm/runtime/render.js +3 -6
  133. package/esm/runtime/render.js.map +1 -1
  134. package/esm/runtime/types/component.d.ts +1 -1
  135. package/esm/runtime/types/mark.d.ts +4 -0
  136. package/esm/runtime/types/options.d.ts +4 -1
  137. package/esm/runtime/types/theme.d.ts +1 -0
  138. package/esm/shape/index.d.ts +106 -101
  139. package/esm/shape/index.js +58 -53
  140. package/esm/shape/index.js.map +1 -1
  141. package/esm/shape/label/label.d.ts +7 -1
  142. package/esm/shape/label/label.js +11 -2
  143. package/esm/shape/label/label.js.map +1 -1
  144. package/esm/shape/text/advance.js +24 -11
  145. package/esm/shape/text/advance.js.map +1 -1
  146. package/esm/spec/composition.d.ts +7 -0
  147. package/esm/spec/index.d.ts +1 -0
  148. package/esm/spec/index.js.map +1 -1
  149. package/esm/spec/interaction.d.ts +2 -0
  150. package/esm/theme/academy.js +12 -6
  151. package/esm/theme/academy.js.map +1 -1
  152. package/esm/theme/classic.js +12 -7
  153. package/esm/theme/classic.js.map +1 -1
  154. package/esm/theme/classicDark.js +12 -6
  155. package/esm/theme/classicDark.js.map +1 -1
  156. package/esm/transform/filter.js +19 -6
  157. package/esm/transform/filter.js.map +1 -1
  158. package/esm/utils/coordinate.d.ts +2 -2
  159. package/esm/utils/scale.d.ts +1 -1
  160. package/esm/utils/scale.js +1 -1
  161. package/esm/utils/scale.js.map +1 -1
  162. package/esm/utils/selection.d.ts +1 -1
  163. package/esm/utils/selection.js +3 -1
  164. package/esm/utils/selection.js.map +1 -1
  165. package/lib/api/chart.d.ts +1017 -85
  166. package/lib/api/chart.js +4 -263
  167. package/lib/api/chart.js.map +1 -1
  168. package/lib/api/composition.d.ts +37 -0
  169. package/lib/api/{composition/base.js → composition.js} +16 -5
  170. package/lib/api/composition.js.map +1 -0
  171. package/lib/api/define.d.ts +14 -0
  172. package/lib/api/define.js +97 -0
  173. package/lib/api/define.js.map +1 -0
  174. package/lib/api/extend.d.ts +9 -0
  175. package/lib/api/extend.js +13 -0
  176. package/lib/api/extend.js.map +1 -0
  177. package/lib/api/index.d.ts +2 -0
  178. package/lib/api/index.js +5 -1
  179. package/lib/api/index.js.map +1 -1
  180. package/lib/api/library.d.ts +170 -1
  181. package/lib/api/library.js +2 -2
  182. package/lib/api/library.js.map +1 -1
  183. package/lib/api/mark.d.ts +29 -0
  184. package/lib/api/{mark/base.js → mark.js} +15 -4
  185. package/lib/api/mark.js.map +1 -0
  186. package/lib/api/node.d.ts +2 -2
  187. package/lib/api/node.js.map +1 -1
  188. package/lib/api/props.d.ts +170 -12
  189. package/lib/api/props.js +22 -106
  190. package/lib/api/props.js.map +1 -1
  191. package/lib/api/runtime.d.ts +66 -0
  192. package/lib/api/runtime.js +301 -0
  193. package/lib/api/runtime.js.map +1 -0
  194. package/lib/api/types.d.ts +60 -5
  195. package/lib/api/utils.d.ts +1 -1
  196. package/lib/api/utils.js +14 -16
  197. package/lib/api/utils.js.map +1 -1
  198. package/lib/component/axis.js +7 -4
  199. package/lib/component/axis.js.map +1 -1
  200. package/lib/component/legendCategory.js +4 -5
  201. package/lib/component/legendCategory.js.map +1 -1
  202. package/lib/component/legendContinuous.js +5 -4
  203. package/lib/component/legendContinuous.js.map +1 -1
  204. package/lib/composition/d3Projection.js.map +1 -0
  205. package/lib/composition/geoPath.js.map +1 -0
  206. package/lib/{geo → composition}/geoView.js +1 -1
  207. package/lib/composition/geoView.js.map +1 -0
  208. package/lib/composition/index.d.ts +2 -0
  209. package/lib/composition/index.js +5 -1
  210. package/lib/composition/index.js.map +1 -1
  211. package/lib/index.d.ts +4 -3
  212. package/lib/index.js +8 -3
  213. package/lib/index.js.map +1 -1
  214. package/lib/interaction/legendFilter.d.ts +2 -0
  215. package/lib/interaction/legendFilter.js +67 -37
  216. package/lib/interaction/legendFilter.js.map +1 -1
  217. package/lib/label-transform/overlapDodgeY.js.map +1 -1
  218. package/lib/lib/core.d.ts +158 -0
  219. package/lib/lib/core.js +178 -0
  220. package/lib/lib/core.js.map +1 -0
  221. package/lib/lib/geo.d.ts +4 -0
  222. package/lib/lib/geo.js +13 -0
  223. package/lib/lib/geo.js.map +1 -0
  224. package/lib/lib/graph.d.ts +4 -0
  225. package/lib/lib/graph.js +12 -0
  226. package/lib/lib/graph.js.map +1 -0
  227. package/lib/lib/index.d.ts +6 -0
  228. package/lib/lib/index.js +16 -0
  229. package/lib/lib/index.js.map +1 -0
  230. package/lib/lib/lite.d.ts +64 -0
  231. package/lib/lib/lite.js +82 -0
  232. package/lib/lib/lite.js.map +1 -0
  233. package/lib/lib/plot.d.ts +11 -0
  234. package/lib/lib/plot.js +20 -0
  235. package/lib/lib/plot.js.map +1 -0
  236. package/lib/lib/std.d.ts +170 -0
  237. package/lib/lib/std.js +12 -0
  238. package/lib/lib/std.js.map +1 -0
  239. package/lib/mark/area.js +14 -5
  240. package/lib/mark/area.js.map +1 -1
  241. package/lib/mark/box.js +9 -2
  242. package/lib/mark/box.js.map +1 -1
  243. package/lib/mark/cell.js +11 -5
  244. package/lib/mark/cell.js.map +1 -1
  245. package/lib/mark/connector.js +6 -2
  246. package/lib/mark/connector.js.map +1 -1
  247. package/lib/mark/density.js +10 -7
  248. package/lib/mark/density.js.map +1 -1
  249. package/lib/mark/forceGraph.js +0 -3
  250. package/lib/mark/forceGraph.js.map +1 -1
  251. package/lib/mark/heatmap.js +9 -4
  252. package/lib/mark/heatmap.js.map +1 -1
  253. package/lib/mark/image.js +9 -4
  254. package/lib/mark/image.js.map +1 -1
  255. package/lib/mark/interval.js +13 -7
  256. package/lib/mark/interval.js.map +1 -1
  257. package/lib/mark/line.js +15 -4
  258. package/lib/mark/line.js.map +1 -1
  259. package/lib/mark/lineX.js +12 -5
  260. package/lib/mark/lineX.js.map +1 -1
  261. package/lib/mark/lineY.js +12 -5
  262. package/lib/mark/lineY.js.map +1 -1
  263. package/lib/mark/link.js +12 -4
  264. package/lib/mark/link.js.map +1 -1
  265. package/lib/mark/path.js +7 -2
  266. package/lib/mark/path.js.map +1 -1
  267. package/lib/mark/point.js +28 -29
  268. package/lib/mark/point.js.map +1 -1
  269. package/lib/mark/polygon.js +7 -2
  270. package/lib/mark/polygon.js.map +1 -1
  271. package/lib/mark/range.js +4 -2
  272. package/lib/mark/range.js.map +1 -1
  273. package/lib/mark/rangeX.js +6 -2
  274. package/lib/mark/rangeX.js.map +1 -1
  275. package/lib/mark/rangeY.js +6 -2
  276. package/lib/mark/rangeY.js.map +1 -1
  277. package/lib/mark/rect.js +9 -3
  278. package/lib/mark/rect.js.map +1 -1
  279. package/lib/mark/shape.js +9 -3
  280. package/lib/mark/shape.js.map +1 -1
  281. package/lib/mark/text.js +10 -4
  282. package/lib/mark/text.js.map +1 -1
  283. package/lib/mark/treemap.js.map +1 -1
  284. package/lib/mark/utils.d.ts +11 -8
  285. package/lib/mark/utils.js +8 -7
  286. package/lib/mark/utils.js.map +1 -1
  287. package/lib/mark/vector.js +6 -2
  288. package/lib/mark/vector.js.map +1 -1
  289. package/lib/runtime/index.d.ts +1 -1
  290. package/lib/runtime/index.js +4 -4
  291. package/lib/runtime/index.js.map +1 -1
  292. package/lib/runtime/plot.js +14 -10
  293. package/lib/runtime/plot.js.map +1 -1
  294. package/lib/runtime/render.js +3 -6
  295. package/lib/runtime/render.js.map +1 -1
  296. package/lib/runtime/types/component.d.ts +1 -1
  297. package/lib/runtime/types/mark.d.ts +4 -0
  298. package/lib/runtime/types/options.d.ts +4 -1
  299. package/lib/runtime/types/theme.d.ts +1 -0
  300. package/lib/shape/index.d.ts +106 -101
  301. package/lib/shape/index.js +71 -61
  302. package/lib/shape/index.js.map +1 -1
  303. package/lib/shape/label/label.d.ts +7 -1
  304. package/lib/shape/label/label.js +11 -2
  305. package/lib/shape/label/label.js.map +1 -1
  306. package/lib/shape/text/advance.js +24 -11
  307. package/lib/shape/text/advance.js.map +1 -1
  308. package/lib/spec/composition.d.ts +7 -0
  309. package/lib/spec/index.d.ts +1 -0
  310. package/lib/spec/index.js.map +1 -1
  311. package/lib/spec/interaction.d.ts +2 -0
  312. package/lib/theme/academy.js +12 -6
  313. package/lib/theme/academy.js.map +1 -1
  314. package/lib/theme/classic.js +12 -7
  315. package/lib/theme/classic.js.map +1 -1
  316. package/lib/theme/classicDark.js +12 -6
  317. package/lib/theme/classicDark.js.map +1 -1
  318. package/lib/transform/filter.js +19 -6
  319. package/lib/transform/filter.js.map +1 -1
  320. package/lib/utils/coordinate.d.ts +2 -2
  321. package/lib/utils/scale.d.ts +1 -1
  322. package/lib/utils/scale.js +1 -1
  323. package/lib/utils/scale.js.map +1 -1
  324. package/lib/utils/selection.d.ts +1 -1
  325. package/lib/utils/selection.js +3 -1
  326. package/lib/utils/selection.js.map +1 -1
  327. package/package.json +11 -10
  328. package/src/api/chart.ts +5 -341
  329. package/src/api/{composition/base.ts → composition.ts} +16 -8
  330. package/src/api/define.ts +128 -0
  331. package/src/api/extend.ts +34 -0
  332. package/src/api/index.ts +2 -0
  333. package/src/api/library.ts +2 -2
  334. package/src/api/{mark/base.ts → mark.ts} +10 -7
  335. package/src/api/node.ts +3 -3
  336. package/src/api/props.ts +30 -114
  337. package/src/api/runtime.ts +366 -0
  338. package/src/api/types.ts +95 -17
  339. package/src/api/utils.ts +28 -11
  340. package/src/component/axis.ts +10 -5
  341. package/src/component/legendCategory.ts +4 -6
  342. package/src/component/legendContinuous.ts +9 -5
  343. package/src/{geo → composition}/geoView.ts +1 -1
  344. package/src/composition/index.ts +2 -0
  345. package/src/index.ts +12 -3
  346. package/src/interaction/legendFilter.ts +96 -49
  347. package/src/label-transform/overlapDodgeY.ts +0 -1
  348. package/src/{stdlib/index.ts → lib/core.ts} +74 -258
  349. package/src/lib/geo.ts +9 -0
  350. package/src/lib/graph.ts +8 -0
  351. package/src/lib/index.ts +6 -0
  352. package/src/lib/lite.ts +127 -0
  353. package/src/lib/plot.ts +16 -0
  354. package/src/lib/std.ts +13 -0
  355. package/src/mark/area.ts +15 -6
  356. package/src/mark/box.ts +10 -2
  357. package/src/mark/cell.ts +12 -6
  358. package/src/mark/connector.ts +7 -3
  359. package/src/mark/density.ts +11 -8
  360. package/src/mark/forceGraph.ts +0 -3
  361. package/src/mark/heatmap.ts +10 -5
  362. package/src/mark/image.ts +10 -5
  363. package/src/mark/interval.ts +22 -10
  364. package/src/mark/line.ts +23 -5
  365. package/src/mark/lineX.ts +20 -9
  366. package/src/mark/lineY.ts +20 -9
  367. package/src/mark/link.ts +13 -5
  368. package/src/mark/path.ts +8 -3
  369. package/src/mark/point.ts +49 -30
  370. package/src/mark/polygon.ts +8 -3
  371. package/src/mark/range.ts +5 -3
  372. package/src/mark/rangeX.ts +7 -3
  373. package/src/mark/rangeY.ts +7 -3
  374. package/src/mark/rect.ts +10 -4
  375. package/src/mark/shape.ts +14 -3
  376. package/src/mark/text.ts +11 -5
  377. package/src/mark/treemap.ts +0 -1
  378. package/src/mark/utils.ts +9 -8
  379. package/src/mark/vector.ts +7 -3
  380. package/src/runtime/index.ts +1 -1
  381. package/src/runtime/plot.ts +26 -12
  382. package/src/runtime/render.ts +3 -6
  383. package/src/runtime/types/component.ts +1 -2
  384. package/src/runtime/types/mark.ts +4 -0
  385. package/src/runtime/types/options.ts +4 -1
  386. package/src/runtime/types/theme.ts +1 -0
  387. package/src/shape/index.ts +106 -110
  388. package/src/shape/label/label.ts +21 -2
  389. package/src/shape/text/advance.ts +38 -14
  390. package/src/spec/composition.ts +7 -0
  391. package/src/spec/index.ts +1 -0
  392. package/src/spec/interaction.ts +2 -0
  393. package/src/theme/academy.ts +12 -6
  394. package/src/theme/classic.ts +12 -7
  395. package/src/theme/classicDark.ts +12 -6
  396. package/src/transform/filter.ts +16 -5
  397. package/src/utils/scale.ts +1 -1
  398. package/src/utils/selection.ts +6 -1
  399. package/CHANGELOG.md +0 -251
  400. package/esm/api/composition/base.d.ts +0 -28
  401. package/esm/api/composition/base.js.map +0 -1
  402. package/esm/api/composition/facetCircle.d.ts +0 -17
  403. package/esm/api/composition/facetCircle.js +0 -27
  404. package/esm/api/composition/facetCircle.js.map +0 -1
  405. package/esm/api/composition/facetRect.d.ts +0 -17
  406. package/esm/api/composition/facetRect.js +0 -27
  407. package/esm/api/composition/facetRect.js.map +0 -1
  408. package/esm/api/composition/geoPath.d.ts +0 -20
  409. package/esm/api/composition/geoPath.js +0 -30
  410. package/esm/api/composition/geoPath.js.map +0 -1
  411. package/esm/api/composition/geoView.d.ts +0 -19
  412. package/esm/api/composition/geoView.js +0 -28
  413. package/esm/api/composition/geoView.js.map +0 -1
  414. package/esm/api/composition/index.d.ts +0 -33
  415. package/esm/api/composition/index.js +0 -32
  416. package/esm/api/composition/index.js.map +0 -1
  417. package/esm/api/composition/repeatMatrix.d.ts +0 -17
  418. package/esm/api/composition/repeatMatrix.js +0 -27
  419. package/esm/api/composition/repeatMatrix.js.map +0 -1
  420. package/esm/api/composition/spaceFlex.d.ts +0 -12
  421. package/esm/api/composition/spaceFlex.js +0 -19
  422. package/esm/api/composition/spaceFlex.js.map +0 -1
  423. package/esm/api/composition/spaceLayer.d.ts +0 -12
  424. package/esm/api/composition/spaceLayer.js +0 -19
  425. package/esm/api/composition/spaceLayer.js.map +0 -1
  426. package/esm/api/composition/timingKeyframe.d.ts +0 -11
  427. package/esm/api/composition/timingKeyframe.js +0 -19
  428. package/esm/api/composition/timingKeyframe.js.map +0 -1
  429. package/esm/api/composition/view.d.ts +0 -19
  430. package/esm/api/composition/view.js +0 -29
  431. package/esm/api/composition/view.js.map +0 -1
  432. package/esm/api/mark/base.d.ts +0 -22
  433. package/esm/api/mark/base.js.map +0 -1
  434. package/esm/api/mark/index.d.ts +0 -75
  435. package/esm/api/mark/index.js +0 -39
  436. package/esm/api/mark/index.js.map +0 -1
  437. package/esm/api/mark/mark.d.ts +0 -212
  438. package/esm/api/mark/mark.js +0 -339
  439. package/esm/api/mark/mark.js.map +0 -1
  440. package/esm/api/mark/types.d.ts +0 -26
  441. package/esm/api/mark/types.js +0 -2
  442. package/esm/api/mark/types.js.map +0 -1
  443. package/esm/geo/d3Projection.js.map +0 -1
  444. package/esm/geo/geoPath.js.map +0 -1
  445. package/esm/geo/geoView.js.map +0 -1
  446. package/esm/geo/index.d.ts +0 -9
  447. package/esm/geo/index.js +0 -8
  448. package/esm/geo/index.js.map +0 -1
  449. package/esm/stdlib/index.d.ts +0 -2
  450. package/esm/stdlib/index.js +0 -21
  451. package/esm/stdlib/index.js.map +0 -1
  452. package/lib/api/composition/base.d.ts +0 -28
  453. package/lib/api/composition/base.js.map +0 -1
  454. package/lib/api/composition/facetCircle.d.ts +0 -17
  455. package/lib/api/composition/facetCircle.js +0 -30
  456. package/lib/api/composition/facetCircle.js.map +0 -1
  457. package/lib/api/composition/facetRect.d.ts +0 -17
  458. package/lib/api/composition/facetRect.js +0 -30
  459. package/lib/api/composition/facetRect.js.map +0 -1
  460. package/lib/api/composition/geoPath.d.ts +0 -20
  461. package/lib/api/composition/geoPath.js +0 -33
  462. package/lib/api/composition/geoPath.js.map +0 -1
  463. package/lib/api/composition/geoView.d.ts +0 -19
  464. package/lib/api/composition/geoView.js +0 -31
  465. package/lib/api/composition/geoView.js.map +0 -1
  466. package/lib/api/composition/index.d.ts +0 -33
  467. package/lib/api/composition/index.js +0 -44
  468. package/lib/api/composition/index.js.map +0 -1
  469. package/lib/api/composition/repeatMatrix.d.ts +0 -17
  470. package/lib/api/composition/repeatMatrix.js +0 -30
  471. package/lib/api/composition/repeatMatrix.js.map +0 -1
  472. package/lib/api/composition/spaceFlex.d.ts +0 -12
  473. package/lib/api/composition/spaceFlex.js +0 -22
  474. package/lib/api/composition/spaceFlex.js.map +0 -1
  475. package/lib/api/composition/spaceLayer.d.ts +0 -12
  476. package/lib/api/composition/spaceLayer.js +0 -22
  477. package/lib/api/composition/spaceLayer.js.map +0 -1
  478. package/lib/api/composition/timingKeyframe.d.ts +0 -11
  479. package/lib/api/composition/timingKeyframe.js +0 -22
  480. package/lib/api/composition/timingKeyframe.js.map +0 -1
  481. package/lib/api/composition/view.d.ts +0 -19
  482. package/lib/api/composition/view.js +0 -32
  483. package/lib/api/composition/view.js.map +0 -1
  484. package/lib/api/mark/base.d.ts +0 -22
  485. package/lib/api/mark/base.js.map +0 -1
  486. package/lib/api/mark/index.d.ts +0 -75
  487. package/lib/api/mark/index.js +0 -43
  488. package/lib/api/mark/index.js.map +0 -1
  489. package/lib/api/mark/mark.d.ts +0 -212
  490. package/lib/api/mark/mark.js +0 -342
  491. package/lib/api/mark/mark.js.map +0 -1
  492. package/lib/api/mark/types.d.ts +0 -26
  493. package/lib/api/mark/types.js +0 -3
  494. package/lib/api/mark/types.js.map +0 -1
  495. package/lib/geo/d3Projection.js.map +0 -1
  496. package/lib/geo/geoPath.js.map +0 -1
  497. package/lib/geo/geoView.js.map +0 -1
  498. package/lib/geo/index.d.ts +0 -9
  499. package/lib/geo/index.js +0 -12
  500. package/lib/geo/index.js.map +0 -1
  501. package/lib/stdlib/index.d.ts +0 -2
  502. package/lib/stdlib/index.js +0 -25
  503. package/lib/stdlib/index.js.map +0 -1
  504. package/src/api/composition/facetCircle.ts +0 -36
  505. package/src/api/composition/facetRect.ts +0 -36
  506. package/src/api/composition/geoPath.ts +0 -37
  507. package/src/api/composition/geoView.ts +0 -39
  508. package/src/api/composition/index.ts +0 -57
  509. package/src/api/composition/repeatMatrix.ts +0 -36
  510. package/src/api/composition/spaceFlex.ts +0 -18
  511. package/src/api/composition/spaceLayer.ts +0 -18
  512. package/src/api/composition/timingKeyframe.ts +0 -16
  513. package/src/api/composition/view.ts +0 -42
  514. package/src/api/mark/index.ts +0 -113
  515. package/src/api/mark/mark.ts +0 -439
  516. package/src/api/mark/types.ts +0 -31
  517. package/src/geo/index.ts +0 -12
  518. /package/esm/{geo → composition}/d3Projection.d.ts +0 -0
  519. /package/esm/{geo → composition}/d3Projection.js +0 -0
  520. /package/esm/{geo → composition}/geoPath.d.ts +0 -0
  521. /package/esm/{geo → composition}/geoPath.js +0 -0
  522. /package/esm/{geo → composition}/geoView.d.ts +0 -0
  523. /package/lib/{geo → composition}/d3Projection.d.ts +0 -0
  524. /package/lib/{geo → composition}/d3Projection.js +0 -0
  525. /package/lib/{geo → composition}/geoPath.d.ts +0 -0
  526. /package/lib/{geo → composition}/geoPath.js +0 -0
  527. /package/lib/{geo → composition}/geoView.d.ts +0 -0
  528. /package/src/{geo → composition}/d3Projection.ts +0 -0
  529. /package/src/{geo → composition}/geoPath.ts +0 -0
@@ -1,112 +1,108 @@
1
- export { Rect } from './interval/rect';
2
- export { Hollow as HollowRect } from './interval/hollow';
3
- export { Funnel } from './interval/funnel';
4
- export { Pyramid } from './interval/pyramid';
5
-
6
- export { Line } from './line/line';
7
- export { Smooth } from './line/smooth';
8
- export { HV } from './line/hv';
9
- export { VH } from './line/vh';
10
- export { HVH } from './line/hvh';
11
- export { Trail } from './line/trail';
12
-
13
- export { Bowtie } from './point/bowtie';
14
- export { Cross } from './point/cross';
15
- export { Diamond } from './point/diamond';
16
- export { Hexagon } from './point/hexagon';
17
- export { HollowBowtie } from './point/hollowBowtie';
18
- export { HollowDiamond } from './point/hollowDiamond';
19
- export { HollowHexagon } from './point/hollowHexagon';
20
- export { HollowPoint } from './point/hollow';
21
- export { HollowSquare } from './point/hollowSquare';
22
- export { HollowTriangle } from './point/hollowTriangle';
23
- export { HollowTriangleDown } from './point/hollowTriangleDown';
24
- export { Hyphen } from './point/hyphen';
25
- export { Line as LinePoint } from './point/line';
26
- export { Plus } from './point/plus';
27
- export { Point } from './point/point';
28
- export { Square } from './point/square';
29
- export { Tick } from './point/tick';
30
- export { Triangle } from './point/triangle';
31
- export { TriangleDown } from './point/triangleDown';
32
- export { Vector } from './vector/vector';
33
- export { Text } from './text/text';
34
- export { Badge } from './text/badge';
35
- export { Area } from './area/area';
36
- export { Smooth as SmoothArea } from './area/smooth';
37
- export { HVH as HVHArea } from './area/hvh';
38
- export { VH as VHArea } from './area/vh';
39
- export { HV as HVArea } from './area/hv';
40
- export { Link } from './link/link';
41
- export { Smooth as SmoothEdge } from './link/smooth';
42
- export { VHV as VHVEdge } from './link/vhv';
43
- export { Arc } from './link/arc';
44
- export { Image } from './image/image';
45
- export { Polygon } from './polygon/polygon';
46
- export { Ribbon } from './polygon/ribbon';
47
- export { Box } from './box/box';
48
- export { Violin } from './box/violin';
1
+ export { Rect as IntervalShape } from './interval/rect';
2
+ export { Hollow as IntervalHollow } from './interval/hollow';
3
+ export { Funnel as IntervalFunnel } from './interval/funnel';
4
+ export { Pyramid as IntervalPyramid } from './interval/pyramid';
5
+ export { Rect as CellShape } from './interval/rect';
6
+ export { Hollow as CellHollow } from './interval/hollow';
7
+ export { Line as LineShape } from './line/line';
8
+ export { Smooth as LineSmooth } from './line/smooth';
9
+ export { HV as LineHV } from './line/hv';
10
+ export { VH as LineVH } from './line/vh';
11
+ export { HVH as LineHVH } from './line/hvh';
12
+ export { Trail as LineTrail } from './line/trail';
13
+ export { HollowBowtie as PointHollowBowtie } from './point/hollowBowtie';
14
+ export { HollowDiamond as PointHollowDiamond } from './point/hollowDiamond';
15
+ export { HollowHexagon as PointHollowHexagon } from './point/hollowHexagon';
16
+ export { HollowPoint as PointHollow } from './point/hollow';
17
+ export { HollowSquare as PointHollowSquare } from './point/hollowSquare';
18
+ export { HollowTriangle as PointHollowTriangle } from './point/hollowTriangle';
19
+ export { HollowTriangleDown as PointHollowTriangleDown } from './point/hollowTriangleDown';
20
+ export { Bowtie as PointBowtie } from './point/bowtie';
21
+ export { Cross as PointCross } from './point/cross';
22
+ export { Diamond as PointDiamond } from './point/diamond';
23
+ export { Hexagon as PointHexagon } from './point/hexagon';
24
+ export { Hyphen as PointHyphen } from './point/hyphen';
25
+ export { Line as PointLine } from './point/line';
26
+ export { Plus as PointPlus } from './point/plus';
27
+ export { Point as PointShape } from './point/point';
28
+ export { Square as PointSquare } from './point/square';
29
+ export { Tick as PointTick } from './point/tick';
30
+ export { Triangle as PointTriangle } from './point/triangle';
31
+ export { TriangleDown as PointTriangleDown } from './point/triangleDown';
32
+ export { Vector as VectorShape } from './vector/vector';
33
+ export { Text as TextShape } from './text/text';
34
+ export { Badge as TextBadge } from './text/badge';
35
+ export { Area as AreaShape } from './area/area';
36
+ export { Smooth as AreaSmooth } from './area/smooth';
37
+ export { HVH as AreaHVH } from './area/hvh';
38
+ export { VH as AreaVH } from './area/vh';
39
+ export { HV as AreaHV } from './area/hv';
40
+ export { Link as LinkShape } from './link/link';
41
+ export { Smooth as LinkSmooth } from './link/smooth';
42
+ export { VHV as LinkVHV } from './link/vhv';
43
+ export { Arc as LinkArc } from './link/arc';
44
+ export { Image as ImageShape } from './image/image';
45
+ export { Polygon as PolygonShape } from './polygon/polygon';
46
+ export { Ribbon as PolygonRibbon } from './polygon/ribbon';
47
+ export { Box as BoxShape } from './box/box';
48
+ export { Violin as BoxViolin } from './box/violin';
49
49
  export { Line as LineXY } from './lineXY/line';
50
- export { Connector } from './connector/connector';
51
- export { Label } from './label/label';
52
- export { Path } from './path/path';
53
- export { Hollow as HollowPath } from './path/hollow';
54
- export { Density } from './density/density';
55
- export { Heatmap } from './heatmap/heatmap';
56
- export { Shape } from './shape/shape';
57
-
58
- export type { RectOptions } from './interval/rect';
59
- export type { Hollow as HollowRectOptions } from './interval/hollow';
60
- export type { FunnelOptions } from './interval/funnel';
61
- export type { PyramidOptions } from './interval/pyramid';
62
- export type { LineOptions } from './line/line';
63
- export type { SmoothOptions } from './line/smooth';
64
- export type { HVOptions } from './line/hv';
65
- export type { VHOptions } from './line/vh';
66
- export type { HVHOptions } from './line/hvh';
67
- export type { TrailOptions } from './line/trail';
68
-
69
- export type { BowtieOptions } from './point/bowtie';
70
- export type { CrossOptions } from './point/cross';
71
- export type { DiamondOptions } from './point/diamond';
72
- export type { HexagonOptions } from './point/hexagon';
73
- export type { HollowBowtieOptions } from './point/hollowBowtie';
74
- export type { HollowDiamondOptions } from './point/hollowDiamond';
75
- export type { HollowHexagonOptions } from './point/hollowHexagon';
76
- export type { HollowPointOptions } from './point/hollow';
77
- export type { HollowSquareOptions } from './point/hollowSquare';
78
- export type { HollowTriangleOptions } from './point/hollowTriangle';
79
- export type { HollowTriangleDownOptions } from './point/hollowTriangleDown';
80
- export type { HyphenOptions } from './point/hyphen';
81
- export type { LineOptions as LinePointOptions } from './point/line';
82
- export type { PlusOptions } from './point/plus';
83
- export type { PointOptions } from './point/point';
84
- export type { SquareOptions } from './point/square';
85
- export type { TickOptions } from './point/tick';
86
- export type { TriangleOptions } from './point/triangle';
87
- export type { TriangleDownOptions } from './point/triangleDown';
88
-
89
- export type { VectorOptions } from './vector/vector';
90
-
91
- export type { TextOptions } from './text/text';
92
- export type { BadgeOptions } from './text/badge';
93
- export type { AreaOptions } from './area/area';
94
- export type { SmoothOptions as SmoothAreaOptions } from './area/smooth';
95
- export type { HVHOptions as HVHAreaOptions } from './area/hvh';
96
- export type { VHOptions as VHAreaOptions } from './area/vh';
97
- export type { HVOptions as HVAreaOptions } from './area/hv';
98
-
99
- export type { LinkOptions } from './link/link';
100
- export type { ImageOptions } from './image/image';
101
- export type { PolygonOptions } from './polygon/polygon';
102
- export type { BoxOptions } from './box/box';
103
- export type { ViolinOptions } from './box/violin';
104
- export type { HeatmapOptions } from './heatmap/heatmap';
105
-
106
- export type { LineOptions as LineXYOptions } from './lineXY/line';
107
- export type { ConnectorOptions } from './connector/connector';
108
-
109
- export type { LabelOptions } from './label/label';
110
- export type { DensityOptions } from './density/density';
50
+ export { Connector as ConnectorShape } from './connector/connector';
51
+ export { Label as LabelShape } from './label/label';
52
+ export { Path as PathShape } from './path/path';
53
+ export { Hollow as PathHollow } from './path/hollow';
54
+ export { Density as DensityShape } from './density/density';
55
+ export { Heatmap as HeatmapShape } from './heatmap/heatmap';
56
+ export { Rect as RangeShape } from './interval/rect';
57
+ export { Rect as RectShape } from './interval/rect';
58
+ export { Hollow as RectHollow } from './interval/hollow';
59
+ export { Shape as ShapeShape } from './shape/shape';
111
60
 
112
- export type { ShapeOptions } from './shape/shape';
61
+ export type { RectOptions as IntervalShapeOptions } from './interval/rect';
62
+ export type { HollowOptions as IntervalHollowOptions } from './interval/hollow';
63
+ export type { FunnelOptions as IntervalFunnelOptions } from './interval/funnel';
64
+ export type { PyramidOptions as IntervalPyramidOptions } from './interval/pyramid';
65
+ export type { LineOptions as LineShapeOptions } from './line/line';
66
+ export type { SmoothOptions as LineSmoothOptions } from './line/smooth';
67
+ export type { HVOptions as LineHVOptions } from './line/hv';
68
+ export type { VHOptions as LineVHOptions } from './line/vh';
69
+ export type { HVHOptions as LineHVHOptions } from './line/hvh';
70
+ export type { TrailOptions as LineTrailOptions } from './line/trail';
71
+ export type { BowtieOptions as PointBowtieOptions } from './point/bowtie';
72
+ export type { CrossOptions as PointCrossOptions } from './point/cross';
73
+ export type { DiamondOptions as PointDiamondOptions } from './point/diamond';
74
+ export type { HexagonOptions as PointHexagonOptions } from './point/hexagon';
75
+ export type { HollowBowtieOptions as PointHollowBowtieOptions } from './point/hollowBowtie';
76
+ export type { HollowDiamondOptions as PointHollowDiamondOptions } from './point/hollowDiamond';
77
+ export type { HollowHexagonOptions as PointHollowHexagonOptions } from './point/hollowHexagon';
78
+ export type { HollowPointOptions as PointHollowPointOptions } from './point/hollow';
79
+ export type { HollowSquareOptions as PointHollowSquareOptions } from './point/hollowSquare';
80
+ export type { HollowTriangleOptions as PointHollowTriangleOptions } from './point/hollowTriangle';
81
+ export type { HollowTriangleDownOptions as PointHollowTriangleDownOptions } from './point/hollowTriangleDown';
82
+ export type { HyphenOptions as PointHyphenOptions } from './point/hyphen';
83
+ export type { LineOptions as PointLineOptions } from './point/line';
84
+ export type { PlusOptions as PointPlusOptions } from './point/plus';
85
+ export type { PointOptions as PointShapeOptions } from './point/point';
86
+ export type { SquareOptions as PointSquareOptions } from './point/square';
87
+ export type { TickOptions as PointTickOptions } from './point/tick';
88
+ export type { TriangleOptions as PointTriangleOptions } from './point/triangle';
89
+ export type { TriangleDownOptions as PointTriangleDownOptions } from './point/triangleDown';
90
+ export type { VectorOptions as VectorShapeOptions } from './vector/vector';
91
+ export type { TextOptions as TextShapeOptions } from './text/text';
92
+ export type { BadgeOptions as TextBadgeOptions } from './text/badge';
93
+ export type { AreaOptions as AreaShapeOptions } from './area/area';
94
+ export type { SmoothOptions as AreaSmoothOptions } from './area/smooth';
95
+ export type { HVHOptions as AreaHVHAreaOptions } from './area/hvh';
96
+ export type { VHOptions as AreaVHAreaOptions } from './area/vh';
97
+ export type { HVOptions as AreaHVAreaOptions } from './area/hv';
98
+ export type { LinkOptions as LinkShapeOptions } from './link/link';
99
+ export type { ImageOptions as ImageShapeOptions } from './image/image';
100
+ export type { PolygonOptions as PolygonShapeOptions } from './polygon/polygon';
101
+ export type { BoxOptions as BoxShapeOptions } from './box/box';
102
+ export type { ViolinOptions as BoxViolinOptions } from './box/violin';
103
+ export type { HeatmapOptions as HeatmapOptions } from './heatmap/heatmap';
104
+ export type { LineOptions as LineLineXYOptions } from './lineXY/line';
105
+ export type { ConnectorOptions as ConnectorShapeOptions } from './connector/connector';
106
+ export type { LabelOptions as LabelShapeOptions } from './label/label';
107
+ export type { DensityOptions as DensityShapeOptions } from './density/density';
108
+ export type { ShapeOptions as ShapeShapeOptions } from './shape/shape';
@@ -8,7 +8,13 @@ import { Advance } from '../text/advance';
8
8
  import { LabelPosition } from './position/default';
9
9
  import * as PositionProcessor from './position';
10
10
 
11
- export type LabelOptions = Record<string, any>;
11
+ export type LabelOptions = {
12
+ /**
13
+ * Customize label with html string or element.
14
+ */
15
+ render: (text: string, datum: any, index: number) => string | HTMLElement;
16
+ [key: string]: any;
17
+ };
12
18
 
13
19
  function inferPosition(position: LabelPosition, coordinate: Coordinate) {
14
20
  if (position !== undefined) return position;
@@ -27,8 +33,14 @@ function getDefaultStyle(
27
33
  // For non-series mark, calc position for label based on
28
34
  // position and the bounds of shape.
29
35
  const { position } = value;
36
+ const { render } = options;
30
37
  const p = inferPosition(position, coordinate);
31
- const t = theme[p === 'inside' ? 'innerLabel' : 'label'];
38
+ const labelType = render
39
+ ? 'htmlLabel'
40
+ : p === 'inside'
41
+ ? 'innerLabel'
42
+ : 'label';
43
+ const t = theme[labelType];
32
44
  const v = Object.assign({}, t, value);
33
45
  const processor = PositionProcessor[camelCase(p)];
34
46
  if (!processor) {
@@ -46,6 +58,7 @@ function getDefaultStyle(
46
58
  */
47
59
  export const Label: SC<LabelOptions> = (options, context) => {
48
60
  const { coordinate, theme } = context;
61
+ const { render } = options;
49
62
  return (points, value) => {
50
63
  const {
51
64
  text,
@@ -53,6 +66,7 @@ export const Label: SC<LabelOptions> = (options, context) => {
53
66
  y,
54
67
  transform: specifiedTS = '',
55
68
  transformOrigin,
69
+ className = '',
56
70
  ...overrideStyle
57
71
  } = value;
58
72
  const {
@@ -64,6 +78,11 @@ export const Label: SC<LabelOptions> = (options, context) => {
64
78
  return select(new Advance())
65
79
  .call(applyStyle, defaultStyle)
66
80
  .style('text', `${text}`)
81
+ .style('className', `${className} g2-label`)
82
+ .style(
83
+ 'innerHTML',
84
+ render ? render(text, value.datum, value.index) : undefined,
85
+ )
67
86
  .style(
68
87
  'labelTransform',
69
88
  `${transform} rotate(${+rotate}) ${specifiedTS}`.trim(),
@@ -34,6 +34,8 @@ type TextShapeStyleProps = Omit<TextStyleProps, 'text'> &
34
34
  BackgroundStyleProps &
35
35
  MarkerStyleProps<'startMarker'> &
36
36
  MarkerStyleProps<'endMarker'> & {
37
+ id: string;
38
+ className?: string;
37
39
  x0?: number; // x0 represents the x position of relative point, default is equal to x
38
40
  y0?: number;
39
41
  coordCenter?: Vector2; // center of coordinate
@@ -44,6 +46,8 @@ type TextShapeStyleProps = Omit<TextStyleProps, 'text'> &
44
46
  labelTransform?: string;
45
47
  labelTransformOrigin?: string;
46
48
  rotate?: number;
49
+ innerHTML?: string | HTMLElement;
50
+ text?: string;
47
51
  };
48
52
 
49
53
  function getConnectorPoint(shape: GText | Rect) {
@@ -126,8 +130,9 @@ function inferConnectorPath(
126
130
 
127
131
  export const Advance = createElement((g) => {
128
132
  const {
133
+ className,
129
134
  // Do not pass className
130
- class: className,
135
+ class: _c,
131
136
  transform,
132
137
  rotate,
133
138
  labelTransform,
@@ -136,11 +141,13 @@ export const Advance = createElement((g) => {
136
141
  y,
137
142
  x0 = x,
138
143
  y0 = y,
144
+ text,
139
145
  background,
140
146
  connector,
141
147
  startMarker,
142
148
  endMarker,
143
149
  coordCenter,
150
+ innerHTML,
144
151
  ...rest
145
152
  } = g.attributes as TextShapeStyleProps;
146
153
 
@@ -157,26 +164,43 @@ export const Advance = createElement((g) => {
157
164
  [+x0, +y0],
158
165
  [+x, +y],
159
166
  ];
160
- const shape1 = select(g)
161
- .maybeAppend('text', 'text')
162
- .style('zIndex', 0)
163
- .call(applyStyle, {
164
- textBaseline: 'middle',
165
- transform: labelTransform,
166
- transformOrigin: labelTransformOrigin,
167
- ...rest,
168
- })
169
- .node();
170
167
 
171
- const shape2 = select(g)
168
+ let textShape;
169
+ // Use html to customize advance text.
170
+ if (innerHTML) {
171
+ textShape = select(g)
172
+ .maybeAppend('html', 'html', className)
173
+ .style('zIndex', 0)
174
+ .style('innerHTML', innerHTML)
175
+ .call(applyStyle, {
176
+ transform: labelTransform,
177
+ transformOrigin: labelTransformOrigin,
178
+ ...rest,
179
+ })
180
+ .node();
181
+ } else {
182
+ textShape = select(g)
183
+ .maybeAppend('text', 'text')
184
+ .style('zIndex', 0)
185
+ .style('text', text)
186
+ .call(applyStyle, {
187
+ textBaseline: 'middle',
188
+ transform: labelTransform,
189
+ transformOrigin: labelTransformOrigin,
190
+ ...rest,
191
+ })
192
+ .node();
193
+ }
194
+
195
+ const rect = select(g)
172
196
  .maybeAppend('background', 'rect')
173
197
  .style('zIndex', -1)
174
- .call(applyStyle, inferBackgroundBounds(shape1, padding))
198
+ .call(applyStyle, inferBackgroundBounds(textShape, padding))
175
199
  .call(applyStyle, background ? backgroundStyle : {})
176
200
  .node();
177
201
 
178
202
  const connectorPath = inferConnectorPath(
179
- shape2,
203
+ rect,
180
204
  endPoints,
181
205
  points,
182
206
  coordCenter,
@@ -93,6 +93,7 @@ export type GeoViewComposition = Omit<ViewComposition, 'type'> & {
93
93
  type?: 'geoView';
94
94
  // @todo
95
95
  coordinate?: Record<string, any>;
96
+ [key: string]: any; // @todo
96
97
  };
97
98
 
98
99
  export type GeoPathComposition = Omit<ViewComposition, 'type'> & {
@@ -107,6 +108,7 @@ export type SpaceLayerComposition = {
107
108
  key?: string;
108
109
  data?: any;
109
110
  children?: Node[];
111
+ [key: string]: any; // @todo
110
112
  };
111
113
 
112
114
  export type SpaceFlexComposition = {
@@ -117,6 +119,7 @@ export type SpaceFlexComposition = {
117
119
  ratio?: number[];
118
120
  padding?: Padding;
119
121
  children?: Node[];
122
+ [key: string]: any; // @todo
120
123
  };
121
124
 
122
125
  export type FacetContext = {
@@ -162,6 +165,7 @@ export type FacetRectComposition = {
162
165
  axis?: Record<string, any> | boolean;
163
166
  // @todo
164
167
  legend?: Record<string, any> | boolean;
168
+ [key: string]: any; // @todo
165
169
  };
166
170
 
167
171
  export type RepeatMatrixComposition = {
@@ -195,6 +199,7 @@ export type RepeatMatrixComposition = {
195
199
  // @todo
196
200
  legend?: Record<string, any> | boolean;
197
201
  children?: Node[] | ((facet: FacetContext) => Node);
202
+ [key: string]: any; // @todo
198
203
  };
199
204
 
200
205
  export type FacetCircleComposition = {
@@ -226,6 +231,7 @@ export type FacetCircleComposition = {
226
231
  axis?: Record<string, any> | boolean;
227
232
  // @todo
228
233
  legend?: Record<string, any> | boolean;
234
+ [key: string]: any; // @todo
229
235
  };
230
236
 
231
237
  export type TimingKeyframeComposition = {
@@ -236,6 +242,7 @@ export type TimingKeyframeComposition = {
236
242
  iterationCount?: 'infinite' | number;
237
243
  direction?: 'normal' | 'reverse' | 'alternate' | 'reverse-alternate';
238
244
  children?: Node[];
245
+ [key: string]: any; // @todo
239
246
  };
240
247
 
241
248
  type Node = Mark | Composition;
package/src/spec/index.ts CHANGED
@@ -5,6 +5,7 @@ import { Mark } from './mark';
5
5
  export type G2Spec = (Mark | Composition | AxisComponent | LegendComponent) & {
6
6
  width?: number;
7
7
  height?: number;
8
+ autoFit?: boolean;
8
9
  };
9
10
 
10
11
  export * from './animate';
@@ -128,6 +128,7 @@ export type ElementHighlightByXInteraction = {
128
128
  link?: boolean;
129
129
  background?: boolean;
130
130
  offset?: number;
131
+ delay?: number;
131
132
  } & Record<`${'link' | 'background'}${any}`, any>;
132
133
 
133
134
  export type ElementHighlightByColorInteraction = {
@@ -136,6 +137,7 @@ export type ElementHighlightByColorInteraction = {
136
137
  background?: boolean;
137
138
  link?: boolean;
138
139
  offset?: number;
140
+ delay?: number;
139
141
  } & Record<`${'link' | 'background'}${any}`, any>;
140
142
 
141
143
  export type PoptipInteraction = {
@@ -245,10 +245,10 @@ export const Academy: TC<AcademyOptions> = (options) => {
245
245
  titleTextBaseline: 'bottom',
246
246
  },
247
247
  axisLeft: {
248
- gridDirection: 'negative',
249
- labelDirection: 'positive',
248
+ gridDirection: 'positive',
249
+ labelDirection: 'negative',
250
250
  labelSpacing: 4,
251
- tickDirection: 'positive',
251
+ tickDirection: 'negative',
252
252
  titlePosition: 'left',
253
253
  titleSpacing: 4,
254
254
  titleTextBaseline: 'middle',
@@ -256,10 +256,10 @@ export const Academy: TC<AcademyOptions> = (options) => {
256
256
  titleTransformOrigin: 'center',
257
257
  },
258
258
  axisRight: {
259
- gridDirection: 'positive',
260
- labelDirection: 'negative',
259
+ gridDirection: 'negative',
260
+ labelDirection: 'positive',
261
261
  labelSpacing: 4,
262
- tickDirection: 'negative',
262
+ tickDirection: 'positive',
263
263
  titlePosition: 'right',
264
264
  titleSpacing: 0,
265
265
  titleTextBaseline: 'top',
@@ -370,6 +370,12 @@ export const Academy: TC<AcademyOptions> = (options) => {
370
370
  stroke: undefined,
371
371
  offset: 0,
372
372
  },
373
+ htmlLabel: {
374
+ fontSize: 12,
375
+ opacity: 0.65,
376
+ color: COLORS.BLACK,
377
+ fontWeight: 'normal',
378
+ },
373
379
  slider: {
374
380
  trackSize: 16,
375
381
  trackFill: COLORS.STROKE,
@@ -245,11 +245,11 @@ export const Classic: TC<ClassicOptions> = (options) => {
245
245
  titleTextBaseline: 'bottom',
246
246
  },
247
247
  axisLeft: {
248
- gridDirection: 'negative',
248
+ gridDirection: 'positive',
249
249
  labelAutoRotate: false,
250
- labelDirection: 'positive',
250
+ labelDirection: 'negative',
251
251
  labelSpacing: 4,
252
- tickDirection: 'positive',
252
+ tickDirection: 'negative',
253
253
  titlePosition: 'left',
254
254
  titleSpacing: 10,
255
255
  titleTextBaseline: 'middle',
@@ -257,11 +257,10 @@ export const Classic: TC<ClassicOptions> = (options) => {
257
257
  titleTransformOrigin: 'center',
258
258
  },
259
259
  axisRight: {
260
- gridDirection: 'positive',
261
- labelDirection: 'negative',
260
+ gridDirection: 'negative',
261
+ labelDirection: 'positive',
262
262
  labelSpacing: 4,
263
- labelAutoRotate: false,
264
- tickDirection: 'negative',
263
+ tickDirection: 'positive',
265
264
  titlePosition: 'right',
266
265
  titleSpacing: 0,
267
266
  titleTextBaseline: 'top',
@@ -377,6 +376,12 @@ export const Classic: TC<ClassicOptions> = (options) => {
377
376
  stroke: undefined,
378
377
  offset: 0,
379
378
  },
379
+ htmlLabel: {
380
+ fontSize: 12,
381
+ opacity: 0.65,
382
+ color: COLORS.BLACK,
383
+ fontWeight: 'normal',
384
+ },
380
385
  slider: {
381
386
  trackSize: 16,
382
387
  trackFill: COLORS.STROKE,
@@ -244,11 +244,11 @@ export const ClassicDark: TC<ClassicDarkOptions> = (options) => {
244
244
  titleTextBaseline: 'bottom',
245
245
  },
246
246
  axisLeft: {
247
- gridDirection: 'negative',
247
+ gridDirection: 'positive',
248
248
  labelAutoRotate: false,
249
- labelDirection: 'positive',
249
+ labelDirection: 'negative',
250
250
  labelSpacing: 4,
251
- tickDirection: 'positive',
251
+ tickDirection: 'negative',
252
252
  titlePosition: 'left',
253
253
  titleSpacing: 10,
254
254
  titleTextBaseline: 'middle',
@@ -256,10 +256,10 @@ export const ClassicDark: TC<ClassicDarkOptions> = (options) => {
256
256
  titleTransformOrigin: 'center',
257
257
  },
258
258
  axisRight: {
259
- gridDirection: 'positive',
260
- labelDirection: 'negative',
259
+ gridDirection: 'negative',
260
+ labelDirection: 'positive',
261
261
  labelSpacing: 4,
262
- tickDirection: 'negative',
262
+ tickDirection: 'positive',
263
263
  titlePosition: 'right',
264
264
  titleSpacing: 0,
265
265
  titleTextBaseline: 'top',
@@ -376,6 +376,12 @@ export const ClassicDark: TC<ClassicDarkOptions> = (options) => {
376
376
  stroke: undefined,
377
377
  offset: 0,
378
378
  },
379
+ htmlLabel: {
380
+ fontSize: 12,
381
+ opacity: 0.65,
382
+ color: COLORS.BLACK,
383
+ fontWeight: 'normal',
384
+ },
379
385
  slider: {
380
386
  trackSize: 16,
381
387
  trackFill: COLORS.STROKE,
@@ -6,6 +6,11 @@ import { columnOf } from './utils/helper';
6
6
 
7
7
  export type FilterOptions = Omit<FilterTransform, 'type'>;
8
8
 
9
+ function normalizeValue(value) {
10
+ if (typeof value === 'object') return [value.value, value.ordinal];
11
+ else return [value, true];
12
+ }
13
+
9
14
  /**
10
15
  * The Filter transform filter channels.
11
16
  */
@@ -13,15 +18,21 @@ export const Filter: TC<FilterOptions> = (options = {}) => {
13
18
  return (I, mark) => {
14
19
  const { encode, data } = mark;
15
20
  const filters = Object.entries(options)
16
- .map(([key, value]) => {
21
+ .map(([key, v]) => {
17
22
  const [V] = columnOf(encode, key);
18
23
  // Skip empty channel.
19
24
  if (!V) return null;
25
+ const [value, ordinal = true] = normalizeValue(v);
20
26
  if (typeof value === 'function') return (i) => value(V[i]);
21
- const expectedValues = Array.isArray(value) ? value : [value];
22
- // Skip empty expected values.
23
- if (expectedValues.length === 0) return null;
24
- return (i) => expectedValues.includes(V[i]);
27
+ if (ordinal) {
28
+ const expectedValues = Array.isArray(value) ? value : [value];
29
+ // Skip empty expected values.
30
+ if (expectedValues.length === 0) return null;
31
+ return (i) => expectedValues.includes(V[i]);
32
+ } else {
33
+ const [start, end] = value;
34
+ return (i) => V[i] >= start && V[i] <= end;
35
+ }
25
36
  })
26
37
  .filter(defined);
27
38
 
@@ -5,7 +5,7 @@ function constrain(x, lo, hi) {
5
5
  }
6
6
 
7
7
  export function isOrdinalScale(scale) {
8
- return scale.getBandWidth;
8
+ return !!scale.getBandWidth;
9
9
  }
10
10
 
11
11
  export function invert(scale, x, start) {
@@ -166,7 +166,11 @@ export class Selection<T = any> {
166
166
  }
167
167
  }
168
168
 
169
- maybeAppend(id: string, node: string | (() => G2Element)) {
169
+ maybeAppend(
170
+ id: string,
171
+ node: string | (() => G2Element),
172
+ className?: string,
173
+ ) {
170
174
  const element = this._elements[0];
171
175
  const child = element.getElementById(id) as G2Element;
172
176
  if (child) {
@@ -175,6 +179,7 @@ export class Selection<T = any> {
175
179
  const newChild =
176
180
  typeof node === 'string' ? this.createElement(node) : node();
177
181
  newChild.id = id;
182
+ if (className) newChild.className = className;
178
183
  element.appendChild(newChild);
179
184
  return new Selection([newChild], null, this._parent, this._document);
180
185
  }