@antv/g2 5.0.0-beta.2 → 5.0.0-beta.4

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 (205) hide show
  1. package/dist/g2-lite.min.js +2 -2
  2. package/dist/g2.min.js +2 -2
  3. package/esm/api/mark/mark.js +1 -0
  4. package/esm/api/mark/mark.js.map +1 -1
  5. package/esm/api/mark/types.d.ts +1 -0
  6. package/esm/component/axis.js +45 -24
  7. package/esm/component/axis.js.map +1 -1
  8. package/esm/component/index.d.ts +4 -0
  9. package/esm/component/index.js +2 -0
  10. package/esm/component/index.js.map +1 -1
  11. package/esm/component/legendCategory.js +1 -0
  12. package/esm/component/legendCategory.js.map +1 -1
  13. package/esm/component/slider.d.ts +9 -0
  14. package/esm/component/slider.js +59 -0
  15. package/esm/component/slider.js.map +1 -0
  16. package/esm/component/sliderX.d.ts +7 -0
  17. package/esm/component/sliderX.js +9 -0
  18. package/esm/component/sliderX.js.map +1 -0
  19. package/esm/component/sliderY.d.ts +7 -0
  20. package/esm/component/sliderY.js +9 -0
  21. package/esm/component/sliderY.js.map +1 -0
  22. package/esm/composition/facetRect.js +4 -4
  23. package/esm/composition/facetRect.js.map +1 -1
  24. package/esm/composition/mark.js +2 -1
  25. package/esm/composition/mark.js.map +1 -1
  26. package/esm/composition/repeatMatrix.js +2 -2
  27. package/esm/composition/repeatMatrix.js.map +1 -1
  28. package/esm/data/filter.d.ts +3 -3
  29. package/esm/data/filter.js.map +1 -1
  30. package/esm/data/index.d.ts +3 -1
  31. package/esm/data/index.js +1 -0
  32. package/esm/data/index.js.map +1 -1
  33. package/esm/data/sort.d.ts +8 -0
  34. package/esm/data/sort.js +12 -0
  35. package/esm/data/sort.js.map +1 -0
  36. package/esm/interaction/builtin/tooltip.d.ts +6 -4
  37. package/esm/interaction/index.d.ts +2 -0
  38. package/esm/interaction/index.js +2 -0
  39. package/esm/interaction/index.js.map +1 -1
  40. package/esm/interaction/native/legendFilter.d.ts +8 -0
  41. package/esm/interaction/native/legendFilter.js +189 -0
  42. package/esm/interaction/native/legendFilter.js.map +1 -0
  43. package/esm/interaction/native/tooltip.d.ts +2 -2
  44. package/esm/interaction/native/tooltip.js +39 -17
  45. package/esm/interaction/native/tooltip.js.map +1 -1
  46. package/esm/interaction/native/utils.d.ts +1 -1
  47. package/esm/interaction/native/utils.js +2 -2
  48. package/esm/interaction/native/utils.js.map +1 -1
  49. package/esm/mark/area.js +1 -1
  50. package/esm/mark/area.js.map +1 -1
  51. package/esm/mark/line.js +1 -1
  52. package/esm/mark/line.js.map +1 -1
  53. package/esm/runtime/component.js +29 -1
  54. package/esm/runtime/component.js.map +1 -1
  55. package/esm/runtime/plot.js +14 -7
  56. package/esm/runtime/plot.js.map +1 -1
  57. package/esm/runtime/types/mark.d.ts +1 -1
  58. package/esm/runtime/types/options.d.ts +1 -0
  59. package/esm/runtime/types/theme.d.ts +5 -0
  60. package/esm/spec/data.d.ts +10 -3
  61. package/esm/spec/geometry.d.ts +2 -1
  62. package/esm/spec/interaction.d.ts +9 -2
  63. package/esm/spec/transform.d.ts +7 -2
  64. package/esm/stdlib/index.js +6 -6
  65. package/esm/stdlib/index.js.map +1 -1
  66. package/esm/theme/dark.js +78 -28
  67. package/esm/theme/dark.js.map +1 -1
  68. package/esm/theme/light.js +68 -17
  69. package/esm/theme/light.js.map +1 -1
  70. package/esm/transform/filter.d.ts +7 -0
  71. package/esm/transform/filter.js +42 -0
  72. package/esm/transform/filter.js.map +1 -0
  73. package/esm/transform/index.d.ts +2 -0
  74. package/esm/transform/index.js +1 -0
  75. package/esm/transform/index.js.map +1 -1
  76. package/esm/transform/sample.js.map +1 -1
  77. package/esm/transform/selectX.js +1 -1
  78. package/esm/transform/selectY.js +1 -1
  79. package/esm/utils/selection.d.ts +1 -0
  80. package/esm/utils/selection.js.map +1 -1
  81. package/esm/utils/size.js +1 -1
  82. package/esm/utils/size.js.map +1 -1
  83. package/lib/api/mark/mark.js +1 -0
  84. package/lib/api/mark/mark.js.map +1 -1
  85. package/lib/api/mark/types.d.ts +1 -0
  86. package/lib/component/axis.js +45 -24
  87. package/lib/component/axis.js.map +1 -1
  88. package/lib/component/index.d.ts +4 -0
  89. package/lib/component/index.js +5 -1
  90. package/lib/component/index.js.map +1 -1
  91. package/lib/component/legendCategory.js +1 -0
  92. package/lib/component/legendCategory.js.map +1 -1
  93. package/lib/component/slider.d.ts +9 -0
  94. package/lib/component/slider.js +63 -0
  95. package/lib/component/slider.js.map +1 -0
  96. package/lib/component/sliderX.d.ts +7 -0
  97. package/lib/component/sliderX.js +13 -0
  98. package/lib/component/sliderX.js.map +1 -0
  99. package/lib/component/sliderY.d.ts +7 -0
  100. package/lib/component/sliderY.js +13 -0
  101. package/lib/component/sliderY.js.map +1 -0
  102. package/lib/composition/facetRect.js +4 -4
  103. package/lib/composition/facetRect.js.map +1 -1
  104. package/lib/composition/mark.js +2 -1
  105. package/lib/composition/mark.js.map +1 -1
  106. package/lib/composition/repeatMatrix.js +2 -2
  107. package/lib/composition/repeatMatrix.js.map +1 -1
  108. package/lib/data/filter.d.ts +3 -3
  109. package/lib/data/filter.js.map +1 -1
  110. package/lib/data/index.d.ts +3 -1
  111. package/lib/data/index.js +3 -1
  112. package/lib/data/index.js.map +1 -1
  113. package/lib/data/sort.d.ts +8 -0
  114. package/lib/data/sort.js +17 -0
  115. package/lib/data/sort.js.map +1 -0
  116. package/lib/interaction/builtin/tooltip.d.ts +6 -4
  117. package/lib/interaction/index.d.ts +2 -0
  118. package/lib/interaction/index.js +5 -1
  119. package/lib/interaction/index.js.map +1 -1
  120. package/lib/interaction/native/legendFilter.d.ts +8 -0
  121. package/lib/interaction/native/legendFilter.js +193 -0
  122. package/lib/interaction/native/legendFilter.js.map +1 -0
  123. package/lib/interaction/native/tooltip.d.ts +2 -2
  124. package/lib/interaction/native/tooltip.js +39 -17
  125. package/lib/interaction/native/tooltip.js.map +1 -1
  126. package/lib/interaction/native/utils.d.ts +1 -1
  127. package/lib/interaction/native/utils.js +2 -2
  128. package/lib/interaction/native/utils.js.map +1 -1
  129. package/lib/mark/area.js +1 -1
  130. package/lib/mark/area.js.map +1 -1
  131. package/lib/mark/line.js +1 -1
  132. package/lib/mark/line.js.map +1 -1
  133. package/lib/runtime/component.js +29 -1
  134. package/lib/runtime/component.js.map +1 -1
  135. package/lib/runtime/plot.js +14 -7
  136. package/lib/runtime/plot.js.map +1 -1
  137. package/lib/runtime/types/mark.d.ts +1 -1
  138. package/lib/runtime/types/options.d.ts +1 -0
  139. package/lib/runtime/types/theme.d.ts +5 -0
  140. package/lib/spec/data.d.ts +10 -3
  141. package/lib/spec/geometry.d.ts +2 -1
  142. package/lib/spec/interaction.d.ts +9 -2
  143. package/lib/spec/transform.d.ts +7 -2
  144. package/lib/stdlib/index.js +2 -2
  145. package/lib/stdlib/index.js.map +1 -1
  146. package/lib/theme/dark.js +78 -28
  147. package/lib/theme/dark.js.map +1 -1
  148. package/lib/theme/light.js +68 -17
  149. package/lib/theme/light.js.map +1 -1
  150. package/lib/transform/filter.d.ts +7 -0
  151. package/lib/transform/filter.js +46 -0
  152. package/lib/transform/filter.js.map +1 -0
  153. package/lib/transform/index.d.ts +2 -0
  154. package/lib/transform/index.js +3 -1
  155. package/lib/transform/index.js.map +1 -1
  156. package/lib/transform/sample.js.map +1 -1
  157. package/lib/transform/selectX.js +2 -2
  158. package/lib/transform/selectY.js +2 -2
  159. package/lib/utils/selection.d.ts +1 -0
  160. package/lib/utils/selection.js.map +1 -1
  161. package/lib/utils/size.js +1 -1
  162. package/lib/utils/size.js.map +1 -1
  163. package/package.json +5 -4
  164. package/src/api/mark/mark.ts +1 -0
  165. package/src/api/mark/types.ts +1 -0
  166. package/src/component/axis.ts +46 -91
  167. package/src/component/index.ts +4 -0
  168. package/src/component/legendCategory.ts +1 -0
  169. package/src/component/slider.ts +63 -0
  170. package/src/component/sliderX.ts +16 -0
  171. package/src/component/sliderY.ts +16 -0
  172. package/src/composition/facetRect.ts +4 -2
  173. package/src/composition/mark.ts +2 -0
  174. package/src/composition/repeatMatrix.ts +8 -1
  175. package/src/data/filter.ts +3 -3
  176. package/src/data/index.ts +3 -1
  177. package/src/data/sort.ts +18 -0
  178. package/src/interaction/index.ts +3 -0
  179. package/src/interaction/native/legendFilter.ts +206 -0
  180. package/src/interaction/native/tooltip.ts +57 -16
  181. package/src/interaction/native/utils.ts +2 -1
  182. package/src/mark/area.ts +1 -1
  183. package/src/mark/line.ts +1 -1
  184. package/src/runtime/component.ts +49 -2
  185. package/src/runtime/plot.ts +11 -5
  186. package/src/runtime/types/mark.ts +1 -1
  187. package/src/runtime/types/options.ts +1 -0
  188. package/src/runtime/types/theme.ts +5 -0
  189. package/src/spec/data.ts +12 -2
  190. package/src/spec/geometry.ts +2 -7
  191. package/src/spec/interaction.ts +11 -1
  192. package/src/spec/transform.ts +9 -1
  193. package/src/stdlib/index.ts +12 -2
  194. package/src/theme/dark.ts +79 -28
  195. package/src/theme/light.ts +68 -17
  196. package/src/transform/filter.ts +48 -0
  197. package/src/transform/index.ts +2 -0
  198. package/src/transform/sample.ts +1 -2
  199. package/src/transform/selectX.ts +1 -1
  200. package/src/transform/selectY.ts +1 -1
  201. package/src/utils/selection.ts +2 -0
  202. package/src/utils/size.ts +1 -1
  203. package/src/.DS_Store +0 -0
  204. package/src/data/.DS_Store +0 -0
  205. package/src/shape/.DS_Store +0 -0
@@ -138,6 +138,8 @@ import {
138
138
  LegendCategory,
139
139
  LegendContinuous,
140
140
  TitleComponent,
141
+ SliderX,
142
+ SliderY,
141
143
  } from '../component';
142
144
  import {
143
145
  ScaleInX,
@@ -168,6 +170,7 @@ import {
168
170
  ChartIndex,
169
171
  Fisheye as ChartFisheye,
170
172
  Tooltip,
173
+ LegendFilter,
171
174
  // ElementHighlightByX,
172
175
  // ElementHighlightByColor,
173
176
  // ElementListHighlight,
@@ -231,11 +234,12 @@ import {
231
234
  MaybeGradient,
232
235
  MaybeTooltip,
233
236
  Sample,
237
+ Filter,
234
238
  } from '../transform';
235
239
  import {
236
240
  Fetch,
237
241
  SortBy,
238
- Filter,
242
+ Filter as DataFilter,
239
243
  Map,
240
244
  Pick,
241
245
  Rename,
@@ -249,6 +253,7 @@ import {
249
253
  Arc as ArcTransform,
250
254
  WordCloud,
251
255
  Join,
256
+ Sort,
252
257
  } from '../data';
253
258
  import { HideOverlap, DodgeY, Spider, Surround } from '../label-transform';
254
259
  import { geoLibrary } from '../geo';
@@ -258,7 +263,8 @@ export function createLibrary(): G2Library {
258
263
  'data.fetch': Fetch,
259
264
  'data.inline': Inline,
260
265
  'data.sortBy': SortBy,
261
- 'data.filter': Filter,
266
+ 'data.sort': Sort,
267
+ 'data.filter': DataFilter,
262
268
  'data.pick': Pick,
263
269
  'data.rename': Rename,
264
270
  'data.subset': Subset,
@@ -313,6 +319,7 @@ export function createLibrary(): G2Library {
313
319
  'transform.maybeTooltip': MaybeTooltip,
314
320
  'transform.pack': Pack,
315
321
  'transform.sample': Sample,
322
+ 'transform.filter': Filter,
316
323
  'coordinate.cartesian': Cartesian,
317
324
  'coordinate.polar': Polar,
318
325
  'coordinate.helix': Helix,
@@ -453,6 +460,8 @@ export function createLibrary(): G2Library {
453
460
  'component.legendCategory': LegendCategory,
454
461
  'component.legendContinuous': LegendContinuous,
455
462
  'component.title': TitleComponent,
463
+ 'component.sliderX': SliderX,
464
+ 'component.sliderY': SliderY,
456
465
  'animation.scaleInX': ScaleInX,
457
466
  'animation.scaleOutX': ScaleOutX,
458
467
  'animation.scaleInY': ScaleInY,
@@ -475,6 +484,7 @@ export function createLibrary(): G2Library {
475
484
  'interaction.fisheye': ChartFisheye,
476
485
  'interaction.chartIndex': ChartIndex,
477
486
  'interaction.tooltip': Tooltip,
487
+ 'interaction.legendFilter': LegendFilter,
478
488
  // 'interaction.elementSelected': ElementSelected,
479
489
  // 'interaction.elementHighlight': ElementHighlight,
480
490
  // 'interaction.elementHighlightByX': ElementHighlightByX,
package/src/theme/dark.ts CHANGED
@@ -9,7 +9,6 @@ const COLORS = {
9
9
  };
10
10
 
11
11
  const BACKGROUND_COLOR = '#141414';
12
- const STROKE_COLOR = '#416180';
13
12
 
14
13
  /**
15
14
  * Dark theme.
@@ -143,10 +142,10 @@ export const Dark: TC<DarkOptions> = (options) => {
143
142
  fillOpacity: 0.65,
144
143
  fontSize: 12,
145
144
  strokeWidth: 0,
146
- connectorStroke: STROKE_COLOR,
145
+ connectorStroke: COLORS.STROKE,
147
146
  connectorStrokeOpacity: 0.45,
148
147
  connectorLineWidth: 1,
149
- backgroundFill: STROKE_COLOR,
148
+ backgroundFill: COLORS.STROKE,
150
149
  backgroundFillOpacity: 0.15,
151
150
  backgroundPadding: [2, 4],
152
151
  startMarkerSymbol: 'circle',
@@ -161,48 +160,48 @@ export const Dark: TC<DarkOptions> = (options) => {
161
160
  fontSize: 10,
162
161
  textAlign: 'center',
163
162
  textBaseline: 'middle',
164
- markerFill: STROKE_COLOR,
163
+ markerFill: COLORS.STROKE,
165
164
  markerFillOpacity: 0.25,
166
165
  markerStrokeOpacity: 0,
167
166
  },
168
167
  },
169
168
  lineX: {
170
169
  line: {
171
- stroke: STROKE_COLOR,
170
+ stroke: COLORS.STROKE,
172
171
  strokeOpacity: 0.45,
173
172
  lineWidth: 1,
174
173
  },
175
174
  },
176
175
  lineY: {
177
176
  line: {
178
- stroke: STROKE_COLOR,
177
+ stroke: COLORS.STROKE,
179
178
  strokeOpacity: 0.45,
180
179
  lineWidth: 1,
181
180
  },
182
181
  },
183
182
  rangeX: {
184
183
  range: {
185
- fill: STROKE_COLOR,
184
+ fill: COLORS.STROKE,
186
185
  fillOpacity: 0.15,
187
186
  lineWidth: 0,
188
187
  },
189
188
  },
190
189
  rangeY: {
191
190
  range: {
192
- fill: STROKE_COLOR,
191
+ fill: COLORS.STROKE,
193
192
  fillOpacity: 0.15,
194
193
  lineWidth: 0,
195
194
  },
196
195
  },
197
196
  connector: {
198
197
  connector: {
199
- stroke: STROKE_COLOR,
198
+ stroke: COLORS.STROKE,
200
199
  strokeOpacity: 0.45,
201
200
  lineWidth: 1,
202
201
  connectLength1: 12,
203
202
  endMarker: true,
204
203
  endMarkerSize: 6,
205
- endMarkerFill: STROKE_COLOR,
204
+ endMarkerFill: COLORS.STROKE,
206
205
  endMarkerFillOpacity: 0.95,
207
206
  },
208
207
  },
@@ -237,6 +236,7 @@ export const Dark: TC<DarkOptions> = (options) => {
237
236
  lineStroke: COLORS.BLACK,
238
237
  lineStrokeOpacity: 0.45,
239
238
  lineLineWidth: 0.5,
239
+ lineArrow: null,
240
240
  // axis tick line
241
241
  tickStroke: COLORS.BLACK,
242
242
  tickStrokeOpacity: 0.25,
@@ -248,11 +248,62 @@ export const Dark: TC<DarkOptions> = (options) => {
248
248
  labelFontSize: 12,
249
249
  labelFontWeight: 'lighter',
250
250
  labelSpacing: 8, // spacing between label and it's tick
251
+ labelAlign: 'horizontal',
251
252
  // axis grid
252
253
  gridStroke: COLORS.BLACK,
253
254
  gridStrokeOpacity: 0.05,
254
255
  gridLineWidth: 0.5,
255
256
  gridLineDash: [0, 0],
257
+ titleTransformOrigin: 'center',
258
+ },
259
+ axisTop: {
260
+ titlePosition: 'top',
261
+ titleSpacing: 0,
262
+ titleTextBaseline: 'middle',
263
+ labelSpacing: 8,
264
+ labelDirection: 'negative',
265
+ tickDirection: 'negative',
266
+ gridDirection: 'positive',
267
+ },
268
+ axisBottom: {
269
+ titleSpacing: 10,
270
+ titleTextBaseline: 'bottom',
271
+ labelSpacing: 12,
272
+ labelDirection: 'positive',
273
+ tickDirection: 'positive',
274
+ gridDirection: 'negative',
275
+ },
276
+ axisLeft: {
277
+ titleTextBaseline: 'middle',
278
+ titleSpacing: 10,
279
+ titlePosition: 'left',
280
+ titleTransformOrigin: 'center',
281
+ titleTransform: `translate(50%, 0) rotate(-90)`,
282
+ labelSpacing: 4,
283
+ labelDirection: 'positive',
284
+ tickDirection: 'positive',
285
+ gridDirection: 'negative',
286
+ },
287
+ axisRight: {
288
+ titleTextBaseline: 'top',
289
+ titleSpacing: 0,
290
+ titlePosition: 'right',
291
+ titleTransformOrigin: 'center',
292
+ titleTransform: `translate(-50%, 0) rotate(-90)`,
293
+ labelSpacing: 4,
294
+ labelDirection: 'negative',
295
+ tickDirection: 'negative',
296
+ gridDirection: 'positive',
297
+ },
298
+ axisArcY: {
299
+ titlePosition: 'top',
300
+ titleSpacing: 0,
301
+ titleTextBaseline: 'bottom',
302
+ gridDirection: 'negative',
303
+ gridConnect: 'arc',
304
+ gridControlAngles: [90, 180, 360],
305
+ gridType: 'surround',
306
+ girdClosed: true,
256
307
  },
257
308
  legend: {
258
309
  padding: 8,
@@ -276,7 +327,6 @@ export const Dark: TC<DarkOptions> = (options) => {
276
327
  itemValueFontSize: 12,
277
328
  itemValueFontWeight: 'normal',
278
329
  itemBackgroundFill: 'transparent',
279
- // [todo] support navButtonSize
280
330
  navButtonFill: COLORS.BLACK,
281
331
  navButtonFillOpacity: 0.45,
282
332
  navPageNumFill: COLORS.BLACK,
@@ -325,23 +375,22 @@ export const Dark: TC<DarkOptions> = (options) => {
325
375
  offset: 0,
326
376
  },
327
377
  slider: {
328
- railHeight: 16,
329
- railFill: STROKE_COLOR,
330
- railFillOpacity: 0.05,
331
- railForegroundFill: DEFAULT_COLOR,
332
- railForegroundFillOpacity: 0.15,
333
- handleHeight: 24,
334
- handleWidth: 10,
335
- handleFill: '#f7f7f7',
336
- handleFillOpacity: 1,
337
- handleStroke: COLORS.BLACK,
338
- handleStrokeOpacity: 0.25,
339
- handleLineWidth: 1,
340
- handleRadius: 2,
341
- textFill: COLORS.BLACK,
342
- textFillOpacity: 0.45,
343
- textFontSize: 12,
344
- textFontWeight: 'normal',
378
+ railSize: 16,
379
+ backgroundFill: COLORS.STROKE,
380
+ backgroundFillOpacity: 1,
381
+ selectionFill: DEFAULT_COLOR,
382
+ selectionFillOpacity: 0.15,
383
+ handleIconSize: 10,
384
+ handleIconFill: '#f7f7f7',
385
+ handleIconFillOpacity: 1,
386
+ handleIconStroke: COLORS.BLACK,
387
+ handleIconStrokeOpacity: 0.25,
388
+ handleIconLineWidth: 1,
389
+ handleIconRadius: 2,
390
+ handleLabelFill: COLORS.BLACK,
391
+ handleLabelFillOpacity: 0.45,
392
+ handleLabelFontSize: 12,
393
+ handleLabelFontWeight: 'normal',
345
394
  },
346
395
  scrollbar: {},
347
396
  title: {
@@ -363,3 +412,5 @@ export const Dark: TC<DarkOptions> = (options) => {
363
412
  };
364
413
 
365
414
  Dark.props = {};
415
+
416
+ Dark.props = {};
@@ -236,6 +236,7 @@ export const Light: TC<LightOptions> = (options) => {
236
236
  lineStroke: COLORS.BLACK,
237
237
  lineStrokeOpacity: 0.45,
238
238
  lineLineWidth: 0.5,
239
+ lineArrow: null,
239
240
  // axis tick line
240
241
  tickStroke: COLORS.BLACK,
241
242
  tickStrokeOpacity: 0.25,
@@ -247,11 +248,62 @@ export const Light: TC<LightOptions> = (options) => {
247
248
  labelFontSize: 12,
248
249
  labelFontWeight: 'lighter',
249
250
  labelSpacing: 8, // spacing between label and it's tick
251
+ labelAlign: 'horizontal',
250
252
  // axis grid
251
253
  gridStroke: COLORS.BLACK,
252
254
  gridStrokeOpacity: 0.05,
253
255
  gridLineWidth: 0.5,
254
256
  gridLineDash: [0, 0],
257
+ titleTransformOrigin: 'center',
258
+ },
259
+ axisTop: {
260
+ titlePosition: 'top',
261
+ titleSpacing: 0,
262
+ titleTextBaseline: 'middle',
263
+ labelSpacing: 8,
264
+ labelDirection: 'negative',
265
+ tickDirection: 'negative',
266
+ gridDirection: 'positive',
267
+ },
268
+ axisBottom: {
269
+ titleSpacing: 10,
270
+ titleTextBaseline: 'bottom',
271
+ labelSpacing: 12,
272
+ labelDirection: 'positive',
273
+ tickDirection: 'positive',
274
+ gridDirection: 'negative',
275
+ },
276
+ axisLeft: {
277
+ titleTextBaseline: 'middle',
278
+ titleSpacing: 10,
279
+ titlePosition: 'left',
280
+ titleTransformOrigin: 'center',
281
+ titleTransform: `translate(50%, 0) rotate(-90)`,
282
+ labelSpacing: 4,
283
+ labelDirection: 'positive',
284
+ tickDirection: 'positive',
285
+ gridDirection: 'negative',
286
+ },
287
+ axisRight: {
288
+ titleTextBaseline: 'top',
289
+ titleSpacing: 0,
290
+ titlePosition: 'right',
291
+ titleTransformOrigin: 'center',
292
+ titleTransform: `translate(-50%, 0) rotate(-90)`,
293
+ labelSpacing: 4,
294
+ labelDirection: 'negative',
295
+ tickDirection: 'negative',
296
+ gridDirection: 'positive',
297
+ },
298
+ axisArcY: {
299
+ titlePosition: 'top',
300
+ titleSpacing: 0,
301
+ titleTextBaseline: 'bottom',
302
+ gridDirection: 'negative',
303
+ gridConnect: 'arc',
304
+ gridControlAngles: [90, 180, 360],
305
+ gridType: 'surround',
306
+ girdClosed: true,
255
307
  },
256
308
  legend: {
257
309
  padding: 8,
@@ -324,23 +376,22 @@ export const Light: TC<LightOptions> = (options) => {
324
376
  offset: 0,
325
377
  },
326
378
  slider: {
327
- railHeight: 16,
328
- railFill: COLORS.STROKE,
329
- railFillOpacity: 0.05,
330
- railForegroundFill: DEFAULT_COLOR,
331
- railForegroundFillOpacity: 0.15,
332
- handleHeight: 24,
333
- handleWidth: 10,
334
- handleFill: '#f7f7f7',
335
- handleFillOpacity: 1,
336
- handleStroke: COLORS.BLACK,
337
- handleStrokeOpacity: 0.25,
338
- handleLineWidth: 1,
339
- handleRadius: 2,
340
- textFill: COLORS.BLACK,
341
- textFillOpacity: 0.45,
342
- textFontSize: 12,
343
- textFontWeight: 'normal',
379
+ railSize: 16,
380
+ backgroundFill: COLORS.STROKE,
381
+ backgroundFillOpacity: 1,
382
+ selectionFill: DEFAULT_COLOR,
383
+ selectionFillOpacity: 0.15,
384
+ handleIconSize: 10,
385
+ handleIconFill: '#f7f7f7',
386
+ handleIconFillOpacity: 1,
387
+ handleIconStroke: COLORS.BLACK,
388
+ handleIconStrokeOpacity: 0.25,
389
+ handleIconLineWidth: 1,
390
+ handleIconRadius: 2,
391
+ handleLabelFill: COLORS.BLACK,
392
+ handleLabelFillOpacity: 0.45,
393
+ handleLabelFontSize: 12,
394
+ handleLabelFontWeight: 'normal',
344
395
  },
345
396
  scrollbar: {},
346
397
  title: {
@@ -0,0 +1,48 @@
1
+ import { deepMix } from '@antv/util';
2
+ import { TransformComponent as TC } from '../runtime';
3
+ import { FilterTransform } from '../spec';
4
+ import { defined } from '../utils/helper';
5
+ import { columnOf } from './utils/helper';
6
+
7
+ export type FilterOptions = Omit<FilterTransform, 'type'>;
8
+
9
+ /**
10
+ * The Filter transform filter channels.
11
+ */
12
+ export const Filter: TC<FilterOptions> = (options = {}) => {
13
+ return (I, mark) => {
14
+ const { encode } = mark;
15
+ const filters = Object.entries(options)
16
+ .map(([key, value]) => {
17
+ const [V] = columnOf(encode, key);
18
+ // Skip empty channel.
19
+ if (!V) return null;
20
+ 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]);
25
+ })
26
+ .filter(defined);
27
+
28
+ // Skip empty filters.
29
+ if (filters.length === 0) return [I, mark];
30
+
31
+ // Filter index and channels.
32
+ const totalFilter = (i) => filters.every((f) => f(i));
33
+ const FI = I.filter(totalFilter);
34
+ const newIndex = FI.map((_, i) => i);
35
+ const newEncodes = Object.entries(encode).map(([key, encode]) => {
36
+ return [
37
+ key,
38
+ {
39
+ ...encode,
40
+ value: newIndex.map((i) => encode.value[FI[i]]),
41
+ },
42
+ ];
43
+ });
44
+ return [I, deepMix({}, mark, { encode: Object.fromEntries(newEncodes) })];
45
+ };
46
+ };
47
+
48
+ Filter.props = {};
@@ -39,6 +39,7 @@ export { Pack } from './pack';
39
39
  export { BinX } from './binX';
40
40
  export { Bin } from './bin';
41
41
  export { Sample } from './sample';
42
+ export { Filter } from './filter';
42
43
 
43
44
  export type { MaybeZeroY1Options } from './maybeZeroY1';
44
45
  export type { MaybeStackYOptions } from './maybeStackY';
@@ -81,3 +82,4 @@ export type { PackOptions } from './pack';
81
82
  export type { BinXOptions } from './binX';
82
83
  export type { BinOptions } from './bin';
83
84
  export type { SampleOptions } from './sample';
85
+ export type { FilterOptions } from './filter';
@@ -1,5 +1,4 @@
1
- import { max } from 'd3-array';
2
- import { TransformComponent as TC, G2Mark, Primitive } from '../runtime';
1
+ import { TransformComponent as TC, Primitive } from '../runtime';
3
2
  import { SampleTransform } from '../spec';
4
3
  import { createGroups } from './utils/order';
5
4
  import { GroupN } from './groupN';
@@ -1,6 +1,6 @@
1
1
  import { TransformComponent as TC } from '../runtime';
2
2
  import { SelectXTransform } from '../spec';
3
- import { Select } from './Select';
3
+ import { Select } from './select';
4
4
 
5
5
  export type SelectXOptions = Omit<SelectXTransform, 'type'>;
6
6
 
@@ -1,6 +1,6 @@
1
1
  import { TransformComponent as TC } from '../runtime';
2
2
  import { SelectYTransform } from '../spec';
3
- import { Select } from './Select';
3
+ import { Select } from './select';
4
4
 
5
5
  export type SelectYOptions = Omit<SelectYTransform, 'type'>;
6
6
 
@@ -27,6 +27,8 @@ export type G2Element = DisplayObject & {
27
27
  __fromElements__?: DisplayObject[];
28
28
  // Whether to update parent if it in update selection.
29
29
  __facet__?: boolean;
30
+ // Whether is removed in G2, but also exist in G dom.
31
+ __removed__?: boolean;
30
32
  };
31
33
 
32
34
  export function select<T = any>(node: DisplayObject) {
package/src/utils/size.ts CHANGED
@@ -23,7 +23,7 @@ export function getContainerSize(container: HTMLElement): Size {
23
23
  const widthPadding =
24
24
  parseInt10(style.paddingLeft) + parseInt10(style.paddingRight);
25
25
  const heightPadding =
26
- parseInt10(style.paddingLeft) + parseInt10(style.paddingRight);
26
+ parseInt10(style.paddingTop) + parseInt10(style.paddingBottom);
27
27
 
28
28
  return {
29
29
  width: wrapperWidth - widthPadding,
package/src/.DS_Store DELETED
Binary file
Binary file
Binary file