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

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 (359) hide show
  1. package/dist/g2-lite.min.js +4 -4
  2. package/dist/g2.min.js +4 -4
  3. package/esm/api/chart.d.ts +4 -0
  4. package/esm/api/chart.js +26 -4
  5. package/esm/api/chart.js.map +1 -1
  6. package/esm/api/mark/mark.js +1 -0
  7. package/esm/api/mark/mark.js.map +1 -1
  8. package/esm/api/mark/types.d.ts +1 -0
  9. package/esm/component/axis.js +18 -5
  10. package/esm/component/axis.js.map +1 -1
  11. package/esm/component/index.d.ts +2 -0
  12. package/esm/component/index.js +2 -0
  13. package/esm/component/index.js.map +1 -1
  14. package/esm/component/scrollbar.d.ts +9 -0
  15. package/esm/component/scrollbar.js +36 -0
  16. package/esm/component/scrollbar.js.map +1 -0
  17. package/esm/component/scrollbarX.d.ts +7 -0
  18. package/esm/component/scrollbarX.js +9 -0
  19. package/esm/component/scrollbarX.js.map +1 -0
  20. package/esm/component/scrollbarY.d.ts +7 -0
  21. package/esm/component/scrollbarY.js +9 -0
  22. package/esm/component/scrollbarY.js.map +1 -0
  23. package/esm/component/title.js +46 -22
  24. package/esm/component/title.js.map +1 -1
  25. package/esm/data/fold.js +4 -10
  26. package/esm/data/fold.js.map +1 -1
  27. package/esm/data/index.d.ts +2 -2
  28. package/esm/data/index.js +1 -1
  29. package/esm/data/index.js.map +1 -1
  30. package/esm/data/pick.js +10 -2
  31. package/esm/data/pick.js.map +1 -1
  32. package/esm/data/slice.d.ts +8 -0
  33. package/esm/data/slice.js +10 -0
  34. package/esm/data/slice.js.map +1 -0
  35. package/esm/interaction/index.d.ts +5 -0
  36. package/esm/interaction/index.js +4 -30
  37. package/esm/interaction/index.js.map +1 -1
  38. package/esm/interaction/native/brushAxisHighlight.d.ts +26 -0
  39. package/esm/interaction/native/brushAxisHighlight.js +159 -0
  40. package/esm/interaction/native/brushAxisHighlight.js.map +1 -0
  41. package/esm/interaction/native/brushFilter.d.ts +12 -0
  42. package/esm/interaction/native/brushFilter.js +147 -0
  43. package/esm/interaction/native/brushFilter.js.map +1 -0
  44. package/esm/interaction/native/brushHighlight.d.ts +30 -5
  45. package/esm/interaction/native/brushHighlight.js +92 -34
  46. package/esm/interaction/native/brushHighlight.js.map +1 -1
  47. package/esm/interaction/native/brushXFilter.d.ts +1 -0
  48. package/esm/interaction/native/brushXFilter.js +6 -0
  49. package/esm/interaction/native/brushXFilter.js.map +1 -0
  50. package/esm/interaction/native/brushXHighlight.d.ts +6 -1
  51. package/esm/interaction/native/brushXHighlight.js +5 -4
  52. package/esm/interaction/native/brushXHighlight.js.map +1 -1
  53. package/esm/interaction/native/brushYFilter.d.ts +1 -0
  54. package/esm/interaction/native/brushYFilter.js +6 -0
  55. package/esm/interaction/native/brushYFilter.js.map +1 -0
  56. package/esm/interaction/native/brushYHighlight.d.ts +6 -1
  57. package/esm/interaction/native/brushYHighlight.js +5 -4
  58. package/esm/interaction/native/brushYHighlight.js.map +1 -1
  59. package/esm/interaction/native/tooltip.js +6 -5
  60. package/esm/interaction/native/tooltip.js.map +1 -1
  61. package/esm/interaction/native/utils.d.ts +5 -1
  62. package/esm/interaction/native/utils.js +11 -3
  63. package/esm/interaction/native/utils.js.map +1 -1
  64. package/esm/mark/area.js +1 -1
  65. package/esm/mark/area.js.map +1 -1
  66. package/esm/mark/boxplot.js +5 -18
  67. package/esm/mark/boxplot.js.map +1 -1
  68. package/esm/runtime/component.js +33 -38
  69. package/esm/runtime/component.js.map +1 -1
  70. package/esm/runtime/layout.js +7 -7
  71. package/esm/runtime/layout.js.map +1 -1
  72. package/esm/runtime/plot.js +5 -1
  73. package/esm/runtime/plot.js.map +1 -1
  74. package/esm/runtime/render.d.ts +0 -1
  75. package/esm/runtime/render.js +4 -34
  76. package/esm/runtime/render.js.map +1 -1
  77. package/esm/runtime/transform.js +6 -2
  78. package/esm/runtime/transform.js.map +1 -1
  79. package/esm/runtime/types/common.d.ts +26 -9
  80. package/esm/runtime/types/options.d.ts +2 -5
  81. package/esm/runtime/types/theme.d.ts +2 -5
  82. package/esm/shape/area/curve.js +15 -8
  83. package/esm/shape/area/curve.js.map +1 -1
  84. package/esm/shape/box/box.js +1 -1
  85. package/esm/shape/box/box.js.map +1 -1
  86. package/esm/shape/connector/connector.js +2 -2
  87. package/esm/shape/connector/connector.js.map +1 -1
  88. package/esm/shape/image/image.js +2 -2
  89. package/esm/shape/image/image.js.map +1 -1
  90. package/esm/shape/interval/color.js +3 -1
  91. package/esm/shape/interval/color.js.map +1 -1
  92. package/esm/shape/label/position/default.d.ts +5 -7
  93. package/esm/shape/label/position/default.js +14 -40
  94. package/esm/shape/label/position/default.js.map +1 -1
  95. package/esm/shape/label/position/outside.d.ts +18 -1
  96. package/esm/shape/label/position/outside.js +66 -1
  97. package/esm/shape/label/position/outside.js.map +1 -1
  98. package/esm/shape/label/position/spider.d.ts +1 -1
  99. package/esm/shape/label/position/spider.js +12 -18
  100. package/esm/shape/label/position/spider.js.map +1 -1
  101. package/esm/shape/label/position/surround.d.ts +1 -1
  102. package/esm/shape/label/position/surround.js +12 -14
  103. package/esm/shape/label/position/surround.js.map +1 -1
  104. package/esm/shape/line/curve.js +1 -1
  105. package/esm/shape/line/curve.js.map +1 -1
  106. package/esm/shape/lineXY/line.js +2 -2
  107. package/esm/shape/lineXY/line.js.map +1 -1
  108. package/esm/shape/link/arc.js +2 -2
  109. package/esm/shape/link/arc.js.map +1 -1
  110. package/esm/shape/link/link.js +2 -2
  111. package/esm/shape/link/link.js.map +1 -1
  112. package/esm/shape/link/smooth.js +2 -2
  113. package/esm/shape/link/smooth.js.map +1 -1
  114. package/esm/shape/link/vhv.js +2 -2
  115. package/esm/shape/link/vhv.js.map +1 -1
  116. package/esm/shape/point/color.js +1 -1
  117. package/esm/shape/point/color.js.map +1 -1
  118. package/esm/shape/polygon/polygon.js +3 -3
  119. package/esm/shape/polygon/polygon.js.map +1 -1
  120. package/esm/shape/polygon/ribbon.js +3 -3
  121. package/esm/shape/polygon/ribbon.js.map +1 -1
  122. package/esm/shape/text/advance.js +1 -1
  123. package/esm/shape/text/advance.js.map +1 -1
  124. package/esm/shape/text/badge.js +3 -3
  125. package/esm/shape/text/badge.js.map +1 -1
  126. package/esm/shape/text/text.js +1 -1
  127. package/esm/shape/text/text.js.map +1 -1
  128. package/esm/shape/utils.d.ts +4 -0
  129. package/esm/shape/utils.js +6 -1
  130. package/esm/shape/utils.js.map +1 -1
  131. package/esm/shape/vector/vector.js +3 -3
  132. package/esm/shape/vector/vector.js.map +1 -1
  133. package/esm/spec/data.d.ts +24 -9
  134. package/esm/spec/geometry.d.ts +1 -0
  135. package/esm/spec/interaction.d.ts +22 -3
  136. package/esm/stdlib/index.js +5 -5
  137. package/esm/stdlib/index.js.map +1 -1
  138. package/esm/theme/academy.js +11 -15
  139. package/esm/theme/academy.js.map +1 -1
  140. package/esm/theme/dark.js +11 -18
  141. package/esm/theme/dark.js.map +1 -1
  142. package/esm/theme/light.js +25 -19
  143. package/esm/theme/light.js.map +1 -1
  144. package/lib/api/chart.d.ts +4 -0
  145. package/lib/api/chart.js +26 -4
  146. package/lib/api/chart.js.map +1 -1
  147. package/lib/api/mark/mark.js +1 -0
  148. package/lib/api/mark/mark.js.map +1 -1
  149. package/lib/api/mark/types.d.ts +1 -0
  150. package/lib/component/axis.js +18 -5
  151. package/lib/component/axis.js.map +1 -1
  152. package/lib/component/index.d.ts +2 -0
  153. package/lib/component/index.js +5 -1
  154. package/lib/component/index.js.map +1 -1
  155. package/lib/component/scrollbar.d.ts +9 -0
  156. package/lib/component/scrollbar.js +40 -0
  157. package/lib/component/scrollbar.js.map +1 -0
  158. package/lib/component/scrollbarX.d.ts +7 -0
  159. package/lib/component/scrollbarX.js +13 -0
  160. package/lib/component/scrollbarX.js.map +1 -0
  161. package/lib/component/scrollbarY.d.ts +7 -0
  162. package/lib/component/scrollbarY.js +13 -0
  163. package/lib/component/scrollbarY.js.map +1 -0
  164. package/lib/component/title.js +46 -22
  165. package/lib/component/title.js.map +1 -1
  166. package/lib/data/fold.js +4 -10
  167. package/lib/data/fold.js.map +1 -1
  168. package/lib/data/index.d.ts +2 -2
  169. package/lib/data/index.js +3 -3
  170. package/lib/data/index.js.map +1 -1
  171. package/lib/data/pick.js +10 -2
  172. package/lib/data/pick.js.map +1 -1
  173. package/lib/data/slice.d.ts +8 -0
  174. package/lib/data/slice.js +14 -0
  175. package/lib/data/slice.js.map +1 -0
  176. package/lib/interaction/index.d.ts +5 -0
  177. package/lib/interaction/index.js +9 -31
  178. package/lib/interaction/index.js.map +1 -1
  179. package/lib/interaction/native/brushAxisHighlight.d.ts +26 -0
  180. package/lib/interaction/native/brushAxisHighlight.js +164 -0
  181. package/lib/interaction/native/brushAxisHighlight.js.map +1 -0
  182. package/lib/interaction/native/brushFilter.d.ts +12 -0
  183. package/lib/interaction/native/brushFilter.js +152 -0
  184. package/lib/interaction/native/brushFilter.js.map +1 -0
  185. package/lib/interaction/native/brushHighlight.d.ts +30 -5
  186. package/lib/interaction/native/brushHighlight.js +91 -33
  187. package/lib/interaction/native/brushHighlight.js.map +1 -1
  188. package/lib/interaction/native/brushXFilter.d.ts +1 -0
  189. package/lib/interaction/native/brushXFilter.js +10 -0
  190. package/lib/interaction/native/brushXFilter.js.map +1 -0
  191. package/lib/interaction/native/brushXHighlight.d.ts +6 -1
  192. package/lib/interaction/native/brushXHighlight.js +7 -5
  193. package/lib/interaction/native/brushXHighlight.js.map +1 -1
  194. package/lib/interaction/native/brushYFilter.d.ts +1 -0
  195. package/lib/interaction/native/brushYFilter.js +10 -0
  196. package/lib/interaction/native/brushYFilter.js.map +1 -0
  197. package/lib/interaction/native/brushYHighlight.d.ts +6 -1
  198. package/lib/interaction/native/brushYHighlight.js +7 -5
  199. package/lib/interaction/native/brushYHighlight.js.map +1 -1
  200. package/lib/interaction/native/tooltip.js +6 -5
  201. package/lib/interaction/native/tooltip.js.map +1 -1
  202. package/lib/interaction/native/utils.d.ts +5 -1
  203. package/lib/interaction/native/utils.js +14 -5
  204. package/lib/interaction/native/utils.js.map +1 -1
  205. package/lib/mark/area.js +1 -1
  206. package/lib/mark/area.js.map +1 -1
  207. package/lib/mark/boxplot.js +5 -18
  208. package/lib/mark/boxplot.js.map +1 -1
  209. package/lib/runtime/component.js +33 -38
  210. package/lib/runtime/component.js.map +1 -1
  211. package/lib/runtime/layout.js +7 -7
  212. package/lib/runtime/layout.js.map +1 -1
  213. package/lib/runtime/plot.js +5 -1
  214. package/lib/runtime/plot.js.map +1 -1
  215. package/lib/runtime/render.d.ts +0 -1
  216. package/lib/runtime/render.js +4 -35
  217. package/lib/runtime/render.js.map +1 -1
  218. package/lib/runtime/transform.js +6 -2
  219. package/lib/runtime/transform.js.map +1 -1
  220. package/lib/runtime/types/common.d.ts +26 -9
  221. package/lib/runtime/types/options.d.ts +2 -5
  222. package/lib/runtime/types/theme.d.ts +2 -5
  223. package/lib/shape/area/curve.js +14 -7
  224. package/lib/shape/area/curve.js.map +1 -1
  225. package/lib/shape/box/box.js +1 -1
  226. package/lib/shape/box/box.js.map +1 -1
  227. package/lib/shape/connector/connector.js +2 -2
  228. package/lib/shape/connector/connector.js.map +1 -1
  229. package/lib/shape/image/image.js +2 -2
  230. package/lib/shape/image/image.js.map +1 -1
  231. package/lib/shape/interval/color.js +3 -1
  232. package/lib/shape/interval/color.js.map +1 -1
  233. package/lib/shape/label/position/default.d.ts +5 -7
  234. package/lib/shape/label/position/default.js +16 -40
  235. package/lib/shape/label/position/default.js.map +1 -1
  236. package/lib/shape/label/position/outside.d.ts +18 -1
  237. package/lib/shape/label/position/outside.js +72 -3
  238. package/lib/shape/label/position/outside.js.map +1 -1
  239. package/lib/shape/label/position/spider.d.ts +1 -1
  240. package/lib/shape/label/position/spider.js +12 -18
  241. package/lib/shape/label/position/spider.js.map +1 -1
  242. package/lib/shape/label/position/surround.d.ts +1 -1
  243. package/lib/shape/label/position/surround.js +11 -13
  244. package/lib/shape/label/position/surround.js.map +1 -1
  245. package/lib/shape/line/curve.js +1 -1
  246. package/lib/shape/line/curve.js.map +1 -1
  247. package/lib/shape/lineXY/line.js +2 -2
  248. package/lib/shape/lineXY/line.js.map +1 -1
  249. package/lib/shape/link/arc.js +2 -2
  250. package/lib/shape/link/arc.js.map +1 -1
  251. package/lib/shape/link/link.js +2 -2
  252. package/lib/shape/link/link.js.map +1 -1
  253. package/lib/shape/link/smooth.js +2 -2
  254. package/lib/shape/link/smooth.js.map +1 -1
  255. package/lib/shape/link/vhv.js +2 -2
  256. package/lib/shape/link/vhv.js.map +1 -1
  257. package/lib/shape/point/color.js +1 -1
  258. package/lib/shape/point/color.js.map +1 -1
  259. package/lib/shape/polygon/polygon.js +3 -3
  260. package/lib/shape/polygon/polygon.js.map +1 -1
  261. package/lib/shape/polygon/ribbon.js +3 -3
  262. package/lib/shape/polygon/ribbon.js.map +1 -1
  263. package/lib/shape/text/advance.js +1 -1
  264. package/lib/shape/text/advance.js.map +1 -1
  265. package/lib/shape/text/badge.js +3 -3
  266. package/lib/shape/text/badge.js.map +1 -1
  267. package/lib/shape/text/text.js +1 -1
  268. package/lib/shape/text/text.js.map +1 -1
  269. package/lib/shape/utils.d.ts +4 -0
  270. package/lib/shape/utils.js +6 -1
  271. package/lib/shape/utils.js.map +1 -1
  272. package/lib/shape/vector/vector.js +3 -3
  273. package/lib/shape/vector/vector.js.map +1 -1
  274. package/lib/spec/data.d.ts +24 -9
  275. package/lib/spec/geometry.d.ts +1 -0
  276. package/lib/spec/interaction.d.ts +22 -3
  277. package/lib/stdlib/index.js +2 -2
  278. package/lib/stdlib/index.js.map +1 -1
  279. package/lib/theme/academy.js +11 -15
  280. package/lib/theme/academy.js.map +1 -1
  281. package/lib/theme/dark.js +11 -18
  282. package/lib/theme/dark.js.map +1 -1
  283. package/lib/theme/light.js +25 -19
  284. package/lib/theme/light.js.map +1 -1
  285. package/package.json +1 -1
  286. package/src/api/chart.ts +29 -8
  287. package/src/api/mark/mark.ts +1 -0
  288. package/src/api/mark/types.ts +1 -0
  289. package/src/component/axis.ts +22 -5
  290. package/src/component/index.ts +2 -0
  291. package/src/component/scrollbar.ts +41 -0
  292. package/src/component/scrollbarX.ts +16 -0
  293. package/src/component/scrollbarY.ts +16 -0
  294. package/src/component/title.ts +69 -30
  295. package/src/data/fold.ts +6 -10
  296. package/src/data/index.ts +2 -2
  297. package/src/data/pick.ts +11 -2
  298. package/src/data/slice.ts +15 -0
  299. package/src/interaction/index.ts +20 -16
  300. package/src/interaction/native/brushAxisHighlight.ts +194 -0
  301. package/src/interaction/native/brushFilter.ts +163 -0
  302. package/src/interaction/native/brushHighlight.ts +104 -31
  303. package/src/interaction/native/brushXFilter.ts +9 -0
  304. package/src/interaction/native/brushXHighlight.ts +6 -4
  305. package/src/interaction/native/brushYFilter.ts +9 -0
  306. package/src/interaction/native/brushYHighlight.ts +6 -4
  307. package/src/interaction/native/tooltip.ts +9 -6
  308. package/src/interaction/native/utils.ts +15 -6
  309. package/src/mark/area.ts +1 -1
  310. package/src/mark/boxplot.ts +3 -1
  311. package/src/runtime/component.ts +46 -47
  312. package/src/runtime/layout.ts +6 -6
  313. package/src/runtime/plot.ts +6 -1
  314. package/src/runtime/render.ts +6 -58
  315. package/src/runtime/transform.ts +6 -2
  316. package/src/runtime/types/common.ts +26 -10
  317. package/src/runtime/types/options.ts +2 -5
  318. package/src/runtime/types/theme.ts +2 -5
  319. package/src/shape/area/curve.ts +15 -8
  320. package/src/shape/box/box.ts +6 -6
  321. package/src/shape/connector/connector.ts +2 -3
  322. package/src/shape/image/image.ts +2 -2
  323. package/src/shape/interval/color.ts +2 -1
  324. package/src/shape/label/position/default.ts +15 -55
  325. package/src/shape/label/position/outside.ts +121 -1
  326. package/src/shape/label/position/spider.ts +12 -19
  327. package/src/shape/label/position/surround.ts +13 -15
  328. package/src/shape/line/curve.ts +1 -1
  329. package/src/shape/lineXY/line.ts +2 -2
  330. package/src/shape/link/arc.ts +2 -2
  331. package/src/shape/link/link.ts +2 -2
  332. package/src/shape/link/smooth.ts +2 -2
  333. package/src/shape/link/vhv.ts +2 -2
  334. package/src/shape/point/color.ts +6 -5
  335. package/src/shape/polygon/polygon.ts +3 -3
  336. package/src/shape/polygon/ribbon.ts +3 -3
  337. package/src/shape/text/advance.ts +4 -1
  338. package/src/shape/text/badge.ts +8 -3
  339. package/src/shape/text/text.ts +1 -1
  340. package/src/shape/utils.ts +6 -5
  341. package/src/shape/vector/vector.ts +3 -3
  342. package/src/spec/action.ts +0 -1
  343. package/src/spec/data.ts +25 -10
  344. package/src/spec/geometry.ts +1 -0
  345. package/src/spec/interaction.ts +32 -2
  346. package/src/stdlib/index.ts +14 -2
  347. package/src/theme/academy.ts +11 -15
  348. package/src/theme/dark.ts +11 -18
  349. package/src/theme/light.ts +25 -19
  350. package/esm/data/subset.d.ts +0 -7
  351. package/esm/data/subset.js +0 -26
  352. package/esm/data/subset.js.map +0 -1
  353. package/lib/data/subset.d.ts +0 -7
  354. package/lib/data/subset.js +0 -30
  355. package/lib/data/subset.js.map +0 -1
  356. package/src/.DS_Store +0 -0
  357. package/src/data/.DS_Store +0 -0
  358. package/src/data/subset.ts +0 -35
  359. package/src/shape/.DS_Store +0 -0
package/src/spec/data.ts CHANGED
@@ -23,11 +23,11 @@ export type DataTransform =
23
23
  | SortTransform
24
24
  | PickTransform
25
25
  | RenameTransform
26
- | SubsetTransform
27
26
  | FoldTransform
28
27
  | JoinTransform
29
28
  | FilterDataTransform
30
29
  | MapTransform
30
+ | SliceTransform
31
31
  | CustomTransform;
32
32
 
33
33
  export type DataTransformTypes =
@@ -35,11 +35,11 @@ export type DataTransformTypes =
35
35
  | 'sort'
36
36
  | 'pick'
37
37
  | 'rename'
38
- | 'subset'
39
38
  | 'fold'
40
39
  | 'join'
41
40
  | 'filter'
42
41
  | 'map'
42
+ | 'slice'
43
43
  | 'custom'
44
44
  | DataComponent;
45
45
 
@@ -59,13 +59,6 @@ export type RenameTransform = {
59
59
  [key: string]: string;
60
60
  };
61
61
 
62
- export type SubsetTransform = {
63
- type?: 'subset';
64
- start?: number;
65
- end?: number;
66
- fields?: string[];
67
- };
68
-
69
62
  export type FilterDataTransform = {
70
63
  type?: 'filter';
71
64
  /**
@@ -74,6 +67,18 @@ export type FilterDataTransform = {
74
67
  callback?: (v: any, idx: number, arr: any[]) => boolean;
75
68
  };
76
69
 
70
+ export type SliceTransform = {
71
+ type?: 'slice';
72
+ /**
73
+ * The start index for slice. Default is 0.
74
+ */
75
+ start?: number;
76
+ /**
77
+ * The end index for slice. Default is arr.length - 1
78
+ */
79
+ end?: number;
80
+ };
81
+
77
82
  export type SortTransform = {
78
83
  type?: 'sort';
79
84
  /**
@@ -84,8 +89,18 @@ export type SortTransform = {
84
89
 
85
90
  export type FoldTransform = {
86
91
  type?: 'fold';
92
+ /**
93
+ * Set fields will be folded.
94
+ */
87
95
  fields?: string[];
88
- as?: string[];
96
+ /**
97
+ * Fold key field, default is `key`.
98
+ */
99
+ key?: string;
100
+ /**
101
+ * Fold value field, default is `value`.
102
+ */
103
+ value?: string;
89
104
  };
90
105
 
91
106
  export type CustomDataTransform = {
@@ -128,6 +128,7 @@ export type BaseGeometry<
128
128
  | boolean;
129
129
  legend?: Partial<Record<'size' | 'color', Legend | boolean>> | boolean;
130
130
  slider?: Partial<Record<'x' | 'y', any>>;
131
+ scrollbar?: Partial<Record<'x' | 'y', any>>;
131
132
  coordinates?: Coordinate[];
132
133
  style?: Record<string, any>;
133
134
  interactions?: Interaction[];
@@ -1,5 +1,5 @@
1
- import { ChannelTypes } from 'spec';
2
1
  import { InteractionComponent } from '../runtime';
2
+ import { ChannelTypes } from './geometry';
3
3
  import { ActiveRegionAction, PoptipAction, TooltipAction } from './action';
4
4
  import { FisheyeCoordinate } from './coordinate';
5
5
 
@@ -17,7 +17,11 @@ export type Interaction =
17
17
  | LegendFilterInteraction
18
18
  | BrushHighlightInteraction
19
19
  | BrushXHighlightInteraction
20
- | BrushYHighlightInteraction;
20
+ | BrushYHighlightInteraction
21
+ | BrushAxisHighlightInteraction
22
+ | BrushFilter
23
+ | BrushYFilter
24
+ | BrushXFilter;
21
25
  // | ElementListHighlightInteraction
22
26
  // | LegendActiveInteraction
23
27
  // | LegendHighlightInteraction
@@ -43,6 +47,9 @@ export type InteractionTypes =
43
47
  | 'brushXHighlight'
44
48
  | 'brushYHighlight'
45
49
  | 'brushHighlight'
50
+ | 'brushFilter'
51
+ | 'brushXFilter'
52
+ | 'brushYFilter'
46
53
  | InteractionComponent;
47
54
  // | 'elementListHighlight'
48
55
  // | 'legendActive'
@@ -62,6 +69,7 @@ export type BrushInteraction = {
62
69
 
63
70
  export type BrushHighlightInteraction = {
64
71
  type?: 'brushHighlight';
72
+ brushKey?: string;
65
73
  reverse?: boolean;
66
74
  shared?: boolean;
67
75
  series?: boolean;
@@ -70,6 +78,7 @@ export type BrushHighlightInteraction = {
70
78
 
71
79
  export type BrushXHighlightInteraction = {
72
80
  type?: 'brushXHighlight';
81
+ brushKey?: string;
73
82
  reverse?: boolean;
74
83
  shared?: boolean;
75
84
  series?: boolean;
@@ -78,12 +87,33 @@ export type BrushXHighlightInteraction = {
78
87
 
79
88
  export type BrushYHighlightInteraction = {
80
89
  type?: 'brushYHighlight';
90
+ brushKey?: string;
81
91
  reverse?: boolean;
82
92
  shared?: boolean;
83
93
  series?: boolean;
84
94
  facet?: boolean;
85
95
  } & Record<`${'mask' | 'highlighted' | 'unhighlighted'}${any}`, any>;
86
96
 
97
+ export type BrushAxisHighlightInteraction = {
98
+ type?: 'brushAxisHighlight';
99
+ reverse?: boolean;
100
+ } & Record<`${'mask' | 'highlighted' | 'unhighlighted'}${any}`, any>;
101
+
102
+ export type BrushFilter = {
103
+ type?: 'brushFilter';
104
+ reverse?: boolean;
105
+ } & Record<`${'mask' | 'highlighted' | 'unhighlighted'}${any}`, any>;
106
+
107
+ export type BrushXFilter = {
108
+ type?: 'brushXFilter';
109
+ reverse?: boolean;
110
+ } & Record<`${'mask' | 'highlighted' | 'unhighlighted'}${any}`, any>;
111
+
112
+ export type BrushYFilter = {
113
+ type?: 'brushYFilter';
114
+ reverse?: boolean;
115
+ } & Record<`${'mask' | 'highlighted' | 'unhighlighted'}${any}`, any>;
116
+
87
117
  export type BrushVisibleInteraction = {
88
118
  type?: 'brushVisible';
89
119
  brushType?: 'rect' | 'rectX' | 'rectY' | 'polygon';
@@ -140,6 +140,8 @@ import {
140
140
  TitleComponent,
141
141
  SliderX,
142
142
  SliderY,
143
+ ScrollbarX,
144
+ ScrollbarY,
143
145
  } from '../component';
144
146
  import {
145
147
  ScaleInX,
@@ -174,6 +176,10 @@ import {
174
176
  BrushHighlight,
175
177
  BrushXHighlight,
176
178
  BrushYHighlight,
179
+ BrushAxisHighlight,
180
+ BrushFilter,
181
+ BrushXFilter,
182
+ BrushYFilter,
177
183
  // ElementHighlightByX,
178
184
  // ElementHighlightByColor,
179
185
  // ElementListHighlight,
@@ -246,8 +252,8 @@ import {
246
252
  Map,
247
253
  Pick,
248
254
  Rename,
249
- Subset,
250
255
  Fold,
256
+ Slice,
251
257
  Inline,
252
258
  Custom,
253
259
  Cluster,
@@ -275,8 +281,8 @@ export function createLibrary(): G2Library {
275
281
  'data.filter': DataFilter,
276
282
  'data.pick': Pick,
277
283
  'data.rename': Rename,
278
- 'data.subset': Subset,
279
284
  'data.fold': Fold,
285
+ 'data.slice': Slice,
280
286
  'data.custom': Custom,
281
287
  'data.map': Map,
282
288
  'data.cluster': Cluster,
@@ -471,6 +477,8 @@ export function createLibrary(): G2Library {
471
477
  'component.title': TitleComponent,
472
478
  'component.sliderX': SliderX,
473
479
  'component.sliderY': SliderY,
480
+ 'component.scrollbarX': ScrollbarX,
481
+ 'component.scrollbarY': ScrollbarY,
474
482
  'animation.scaleInX': ScaleInX,
475
483
  'animation.scaleOutX': ScaleOutX,
476
484
  'animation.scaleInY': ScaleInY,
@@ -497,6 +505,10 @@ export function createLibrary(): G2Library {
497
505
  'interaction.brushHighlight': BrushHighlight,
498
506
  'interaction.brushXHighlight': BrushXHighlight,
499
507
  'interaction.brushYHighlight': BrushYHighlight,
508
+ 'interaction.brushAxisHighlight': BrushAxisHighlight,
509
+ 'interaction.brushFilter': BrushFilter,
510
+ 'interaction.brushXFilter': BrushXFilter,
511
+ 'interaction.brushYFilter': BrushYFilter,
500
512
  // 'interaction.elementSelected': ElementSelected,
501
513
  // 'interaction.elementHighlight': ElementHighlight,
502
514
  // 'interaction.elementHighlightByX': ElementHighlightByX,
@@ -55,19 +55,16 @@ export const Academy: TC<AcademyOptions> = (options) => {
55
55
  },
56
56
  hollow: {
57
57
  r: 3,
58
- fill: '',
59
58
  strokeOpacity: 0.95,
60
59
  lineWidth: 1,
61
60
  },
62
61
  plus: {
63
62
  r: 3,
64
- fill: '',
65
63
  strokeOpacity: 0.95,
66
64
  lineWidth: 3,
67
65
  },
68
66
  diamond: {
69
67
  r: 3,
70
- fill: '',
71
68
  strokeOpacity: 0.95,
72
69
  lineWidth: 1,
73
70
  },
@@ -357,6 +354,7 @@ export const Academy: TC<AcademyOptions> = (options) => {
357
354
  connectorStroke: COLORS.BLACK,
358
355
  connectorStrokeOpacity: 0.45,
359
356
  connectorLineWidth: 1,
357
+ connectorLength: 12,
360
358
  connectorLength2: 8,
361
359
  connectorDistance: 4,
362
360
  },
@@ -388,18 +386,16 @@ export const Academy: TC<AcademyOptions> = (options) => {
388
386
  },
389
387
  scrollbar: {},
390
388
  title: {
391
- fill: COLORS.BLACK,
392
- fillOpacity: 0.85,
393
- fontSize: 24,
394
- fontWeight: 'bold',
395
- textBaseline: 'top',
396
- },
397
- subtitle: {
398
- fill: COLORS.BLACK,
399
- fillOpacity: 0.65,
400
- fontSize: 10,
401
- fontWeight: 'normal',
402
- textBaseline: 'top',
389
+ titleFill: COLORS.BLACK,
390
+ titleFillOpacity: 0.85,
391
+ titleFontSize: 14,
392
+ titleFontWeight: 'bold',
393
+ titleTextBaseline: 'top',
394
+ subtitleFill: COLORS.BLACK,
395
+ subtitleFillOpacity: 0.65,
396
+ subtitleFontSize: 12,
397
+ subtitleFontWeight: 'normal',
398
+ subtitleTextBaseline: 'top',
403
399
  },
404
400
  };
405
401
  return Object.assign({}, defaultOptions, options);
package/src/theme/dark.ts CHANGED
@@ -47,7 +47,6 @@ export const Dark: TC<DarkOptions> = (options) => {
47
47
  fill: '',
48
48
  strokeOpacity: 1,
49
49
  lineWidth: 1,
50
- connectStroke: '#666',
51
50
  },
52
51
  },
53
52
  point: {
@@ -58,19 +57,16 @@ export const Dark: TC<DarkOptions> = (options) => {
58
57
  },
59
58
  hollow: {
60
59
  r: 3,
61
- fill: '',
62
60
  strokeOpacity: 0.95,
63
61
  lineWidth: 1,
64
62
  },
65
63
  plus: {
66
64
  r: 3,
67
- fill: '',
68
65
  strokeOpacity: 0.95,
69
66
  lineWidth: 3,
70
67
  },
71
68
  diamond: {
72
69
  r: 3,
73
- fill: '',
74
70
  strokeOpacity: 0.95,
75
71
  lineWidth: 1,
76
72
  },
@@ -89,8 +85,6 @@ export const Dark: TC<DarkOptions> = (options) => {
89
85
  area: {
90
86
  fillOpacity: 0.85,
91
87
  lineWidth: 0,
92
- connectFill: COLORS.BLACK,
93
- connectFillOpacity: 0.1,
94
88
  },
95
89
  },
96
90
  polygon: {
@@ -364,6 +358,7 @@ export const Dark: TC<DarkOptions> = (options) => {
364
358
  connectorStroke: COLORS.BLACK,
365
359
  connectorStrokeOpacity: 0.45,
366
360
  connectorLineWidth: 1,
361
+ connectorLength: 12,
367
362
  connectorLength2: 8,
368
363
  connectorDistance: 4,
369
364
  },
@@ -395,18 +390,16 @@ export const Dark: TC<DarkOptions> = (options) => {
395
390
  },
396
391
  scrollbar: {},
397
392
  title: {
398
- fill: COLORS.BLACK,
399
- fillOpacity: 0.85,
400
- fontSize: 24,
401
- fontWeight: 'bold',
402
- textBaseline: 'top',
403
- },
404
- subtitle: {
405
- fill: COLORS.BLACK,
406
- fillOpacity: 0.65,
407
- fontSize: 10,
408
- fontWeight: 'normal',
409
- textBaseline: 'top',
393
+ titleFill: COLORS.BLACK,
394
+ titleFillOpacity: 0.85,
395
+ titleFontSize: 14,
396
+ titleFontWeight: 'bold',
397
+ titleTextBaseline: 'top',
398
+ subtitleFill: COLORS.BLACK,
399
+ subtitleFillOpacity: 0.65,
400
+ subtitleFontSize: 12,
401
+ subtitleFontWeight: 'normal',
402
+ subtitleTextBaseline: 'top',
410
403
  },
411
404
  };
412
405
  return Object.assign({}, defaultOptions, options);
@@ -47,7 +47,6 @@ export const Light: TC<LightOptions> = (options) => {
47
47
  fill: '',
48
48
  strokeOpacity: 1,
49
49
  lineWidth: 1,
50
- connectStroke: '#aaa',
51
50
  },
52
51
  },
53
52
  point: {
@@ -58,19 +57,16 @@ export const Light: TC<LightOptions> = (options) => {
58
57
  },
59
58
  hollow: {
60
59
  r: 3,
61
- fill: '',
62
60
  strokeOpacity: 0.95,
63
61
  lineWidth: 1,
64
62
  },
65
63
  plus: {
66
64
  r: 3,
67
- fill: '',
68
65
  strokeOpacity: 0.95,
69
66
  lineWidth: 3,
70
67
  },
71
68
  diamond: {
72
69
  r: 3,
73
- fill: '',
74
70
  strokeOpacity: 0.95,
75
71
  lineWidth: 1,
76
72
  },
@@ -89,8 +85,6 @@ export const Light: TC<LightOptions> = (options) => {
89
85
  area: {
90
86
  fillOpacity: 0.85,
91
87
  lineWidth: 0,
92
- connectFill: COLORS.BLACK,
93
- connectFillOpacity: 0.1,
94
88
  },
95
89
  },
96
90
  polygon: {
@@ -365,6 +359,7 @@ export const Light: TC<LightOptions> = (options) => {
365
359
  connectorStroke: COLORS.BLACK,
366
360
  connectorStrokeOpacity: 0.45,
367
361
  connectorLineWidth: 1,
362
+ connectorLength: 12,
368
363
  connectorLength2: 8,
369
364
  connectorDistance: 4,
370
365
  },
@@ -394,20 +389,31 @@ export const Light: TC<LightOptions> = (options) => {
394
389
  handleLabelFontSize: 12,
395
390
  handleLabelFontWeight: 'normal',
396
391
  },
397
- scrollbar: {},
398
- title: {
399
- fill: COLORS.BLACK,
400
- fillOpacity: 0.85,
401
- fontSize: 24,
402
- fontWeight: 'bold',
403
- textBaseline: 'top',
392
+ scrollbar: {
393
+ padding: [2, 2, 2, 2],
394
+ trackSize: 10,
395
+ isRound: true,
396
+ slidable: true,
397
+ scrollable: true,
398
+ trackFill: '#e5e5e5',
399
+ trackFillOpacity: 0,
400
+ trackStroke: 'none',
401
+ thumbFill: '#000',
402
+ thumbFillOpacity: 0.15,
403
+ thumbStroke: 'none',
404
+ thumbHighlightedFillOpacity: 0.2,
404
405
  },
405
- subtitle: {
406
- fill: COLORS.BLACK,
407
- fillOpacity: 0.65,
408
- fontSize: 10,
409
- fontWeight: 'normal',
410
- textBaseline: 'top',
406
+ title: {
407
+ titleFill: COLORS.BLACK,
408
+ titleFillOpacity: 0.85,
409
+ titleFontSize: 14,
410
+ titleFontWeight: 'bold',
411
+ titleTextBaseline: 'top',
412
+ subtitleFill: COLORS.BLACK,
413
+ subtitleFillOpacity: 0.65,
414
+ subtitleFontSize: 12,
415
+ subtitleFontWeight: 'normal',
416
+ subtitleTextBaseline: 'top',
411
417
  },
412
418
  };
413
419
  return Object.assign({}, defaultOptions, options);
@@ -1,7 +0,0 @@
1
- import { DataComponent as DC } from '../runtime';
2
- import { SubsetTransform } from '../spec';
3
- export type SubsetOptions = Omit<SubsetTransform, 'type'>;
4
- /**
5
- * Immutable data sort by specified fields.
6
- */
7
- export declare const Subset: DC<SubsetOptions>;
@@ -1,26 +0,0 @@
1
- function constrain(v, min, max) {
2
- return Math.min(max, Math.max(min, v));
3
- }
4
- /**
5
- * Immutable data sort by specified fields.
6
- */
7
- export const Subset = (options) => {
8
- return (data) => {
9
- const { fields = [] } = options;
10
- let { start = 0, end = data.length } = options;
11
- start = constrain(start, 0, data.length - 1);
12
- end = constrain(end, 1, data.length);
13
- if (start > end)
14
- [start, end] = [end, start];
15
- const pick = (v) => fields.reduce((datum, field) => {
16
- // Pick the data deeply.
17
- if (field in v) {
18
- datum[field] = v[field];
19
- }
20
- return datum;
21
- }, {});
22
- return data.filter((_, i) => i >= start && i < end).map(pick);
23
- };
24
- };
25
- Subset.props = {};
26
- //# sourceMappingURL=subset.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"subset.js","sourceRoot":"src/","sources":["data/subset.ts"],"names":[],"mappings":"AAGA,SAAS,SAAS,CAAC,CAAS,EAAE,GAAW,EAAE,GAAW;IACpD,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC;AACzC,CAAC;AAID;;GAEG;AACH,MAAM,CAAC,MAAM,MAAM,GAAsB,CAAC,OAAO,EAAE,EAAE;IACnD,OAAO,CAAC,IAAI,EAAE,EAAE;QACd,MAAM,EAAE,MAAM,GAAG,EAAE,EAAE,GAAG,OAAO,CAAC;QAEhC,IAAI,EAAE,KAAK,GAAG,CAAC,EAAE,GAAG,GAAG,IAAI,CAAC,MAAM,EAAE,GAAG,OAAO,CAAC;QAC/C,KAAK,GAAG,SAAS,CAAC,KAAK,EAAE,CAAC,EAAE,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QAC7C,GAAG,GAAG,SAAS,CAAC,GAAG,EAAE,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;QACrC,IAAI,KAAK,GAAG,GAAG;YAAE,CAAC,KAAK,EAAE,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;QAE7C,MAAM,IAAI,GAAG,CAAC,CAAM,EAAE,EAAE,CACtB,MAAM,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE;YAC7B,wBAAwB;YACxB,IAAI,KAAK,IAAI,CAAC,EAAE;gBACd,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC;aACzB;YACD,OAAO,KAAK,CAAC;QACf,CAAC,EAAE,EAAE,CAAC,CAAC;QAET,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC,GAAG,GAAG,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAChE,CAAC,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,KAAK,GAAG,EAAE,CAAC"}
@@ -1,7 +0,0 @@
1
- import { DataComponent as DC } from '../runtime';
2
- import { SubsetTransform } from '../spec';
3
- export type SubsetOptions = Omit<SubsetTransform, 'type'>;
4
- /**
5
- * Immutable data sort by specified fields.
6
- */
7
- export declare const Subset: DC<SubsetOptions>;
@@ -1,30 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Subset = void 0;
4
- function constrain(v, min, max) {
5
- return Math.min(max, Math.max(min, v));
6
- }
7
- /**
8
- * Immutable data sort by specified fields.
9
- */
10
- const Subset = (options) => {
11
- return (data) => {
12
- const { fields = [] } = options;
13
- let { start = 0, end = data.length } = options;
14
- start = constrain(start, 0, data.length - 1);
15
- end = constrain(end, 1, data.length);
16
- if (start > end)
17
- [start, end] = [end, start];
18
- const pick = (v) => fields.reduce((datum, field) => {
19
- // Pick the data deeply.
20
- if (field in v) {
21
- datum[field] = v[field];
22
- }
23
- return datum;
24
- }, {});
25
- return data.filter((_, i) => i >= start && i < end).map(pick);
26
- };
27
- };
28
- exports.Subset = Subset;
29
- exports.Subset.props = {};
30
- //# sourceMappingURL=subset.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"subset.js","sourceRoot":"src/","sources":["data/subset.ts"],"names":[],"mappings":";;;AAGA,SAAS,SAAS,CAAC,CAAS,EAAE,GAAW,EAAE,GAAW;IACpD,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC;AACzC,CAAC;AAID;;GAEG;AACI,MAAM,MAAM,GAAsB,CAAC,OAAO,EAAE,EAAE;IACnD,OAAO,CAAC,IAAI,EAAE,EAAE;QACd,MAAM,EAAE,MAAM,GAAG,EAAE,EAAE,GAAG,OAAO,CAAC;QAEhC,IAAI,EAAE,KAAK,GAAG,CAAC,EAAE,GAAG,GAAG,IAAI,CAAC,MAAM,EAAE,GAAG,OAAO,CAAC;QAC/C,KAAK,GAAG,SAAS,CAAC,KAAK,EAAE,CAAC,EAAE,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QAC7C,GAAG,GAAG,SAAS,CAAC,GAAG,EAAE,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;QACrC,IAAI,KAAK,GAAG,GAAG;YAAE,CAAC,KAAK,EAAE,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;QAE7C,MAAM,IAAI,GAAG,CAAC,CAAM,EAAE,EAAE,CACtB,MAAM,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE;YAC7B,wBAAwB;YACxB,IAAI,KAAK,IAAI,CAAC,EAAE;gBACd,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC;aACzB;YACD,OAAO,KAAK,CAAC;QACf,CAAC,EAAE,EAAE,CAAC,CAAC;QAET,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC,GAAG,GAAG,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAChE,CAAC,CAAC;AACJ,CAAC,CAAC;AApBW,QAAA,MAAM,UAoBjB;AAEF,cAAM,CAAC,KAAK,GAAG,EAAE,CAAC"}
package/src/.DS_Store DELETED
Binary file
Binary file
@@ -1,35 +0,0 @@
1
- import { DataComponent as DC } from '../runtime';
2
- import { SubsetTransform } from '../spec';
3
-
4
- function constrain(v: number, min: number, max: number) {
5
- return Math.min(max, Math.max(min, v));
6
- }
7
-
8
- export type SubsetOptions = Omit<SubsetTransform, 'type'>;
9
-
10
- /**
11
- * Immutable data sort by specified fields.
12
- */
13
- export const Subset: DC<SubsetOptions> = (options) => {
14
- return (data) => {
15
- const { fields = [] } = options;
16
-
17
- let { start = 0, end = data.length } = options;
18
- start = constrain(start, 0, data.length - 1);
19
- end = constrain(end, 1, data.length);
20
- if (start > end) [start, end] = [end, start];
21
-
22
- const pick = (v: any) =>
23
- fields.reduce((datum, field) => {
24
- // Pick the data deeply.
25
- if (field in v) {
26
- datum[field] = v[field];
27
- }
28
- return datum;
29
- }, {});
30
-
31
- return data.filter((_, i) => i >= start && i < end).map(pick);
32
- };
33
- };
34
-
35
- Subset.props = {};
Binary file