@antv/g2 5.0.0-beta.3 → 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.
- package/dist/g2-lite.min.js +2 -2
- package/dist/g2.min.js +2 -2
- package/esm/api/mark/mark.js +1 -0
- package/esm/api/mark/mark.js.map +1 -1
- package/esm/api/mark/types.d.ts +1 -0
- package/esm/component/axis.js +45 -24
- package/esm/component/axis.js.map +1 -1
- package/esm/component/index.d.ts +4 -0
- package/esm/component/index.js +2 -0
- package/esm/component/index.js.map +1 -1
- package/esm/component/legendCategory.js +1 -0
- package/esm/component/legendCategory.js.map +1 -1
- package/esm/component/slider.d.ts +9 -0
- package/esm/component/slider.js +59 -0
- package/esm/component/slider.js.map +1 -0
- package/esm/component/sliderX.d.ts +7 -0
- package/esm/component/sliderX.js +9 -0
- package/esm/component/sliderX.js.map +1 -0
- package/esm/component/sliderY.d.ts +7 -0
- package/esm/component/sliderY.js +9 -0
- package/esm/component/sliderY.js.map +1 -0
- package/esm/composition/facetRect.js +4 -4
- package/esm/composition/facetRect.js.map +1 -1
- package/esm/composition/mark.js +2 -1
- package/esm/composition/mark.js.map +1 -1
- package/esm/composition/repeatMatrix.js +2 -2
- package/esm/composition/repeatMatrix.js.map +1 -1
- package/esm/data/filter.d.ts +3 -3
- package/esm/data/filter.js.map +1 -1
- package/esm/data/index.d.ts +3 -1
- package/esm/data/index.js +1 -0
- package/esm/data/index.js.map +1 -1
- package/esm/data/sort.d.ts +8 -0
- package/esm/data/sort.js +12 -0
- package/esm/data/sort.js.map +1 -0
- package/esm/interaction/builtin/tooltip.d.ts +6 -4
- package/esm/interaction/index.d.ts +2 -0
- package/esm/interaction/index.js +2 -0
- package/esm/interaction/index.js.map +1 -1
- package/esm/interaction/native/legendFilter.d.ts +8 -0
- package/esm/interaction/native/legendFilter.js +189 -0
- package/esm/interaction/native/legendFilter.js.map +1 -0
- package/esm/interaction/native/tooltip.d.ts +2 -2
- package/esm/interaction/native/tooltip.js +39 -17
- package/esm/interaction/native/tooltip.js.map +1 -1
- package/esm/interaction/native/utils.d.ts +1 -1
- package/esm/interaction/native/utils.js +2 -2
- package/esm/interaction/native/utils.js.map +1 -1
- package/esm/mark/area.js +1 -1
- package/esm/mark/area.js.map +1 -1
- package/esm/mark/line.js +1 -1
- package/esm/mark/line.js.map +1 -1
- package/esm/runtime/component.js +29 -1
- package/esm/runtime/component.js.map +1 -1
- package/esm/runtime/plot.js +14 -7
- package/esm/runtime/plot.js.map +1 -1
- package/esm/runtime/types/mark.d.ts +1 -1
- package/esm/runtime/types/options.d.ts +1 -0
- package/esm/runtime/types/theme.d.ts +5 -0
- package/esm/spec/data.d.ts +10 -3
- package/esm/spec/geometry.d.ts +1 -0
- package/esm/spec/interaction.d.ts +9 -2
- package/esm/spec/transform.d.ts +7 -2
- package/esm/stdlib/index.js +6 -6
- package/esm/stdlib/index.js.map +1 -1
- package/esm/theme/dark.js +78 -28
- package/esm/theme/dark.js.map +1 -1
- package/esm/theme/light.js +68 -17
- package/esm/theme/light.js.map +1 -1
- package/esm/transform/filter.d.ts +7 -0
- package/esm/transform/filter.js +42 -0
- package/esm/transform/filter.js.map +1 -0
- package/esm/transform/index.d.ts +2 -0
- package/esm/transform/index.js +1 -0
- package/esm/transform/index.js.map +1 -1
- package/esm/utils/selection.d.ts +1 -0
- package/esm/utils/selection.js.map +1 -1
- package/esm/utils/size.js +1 -1
- package/esm/utils/size.js.map +1 -1
- package/lib/api/mark/mark.js +1 -0
- package/lib/api/mark/mark.js.map +1 -1
- package/lib/api/mark/types.d.ts +1 -0
- package/lib/component/axis.js +45 -24
- package/lib/component/axis.js.map +1 -1
- package/lib/component/index.d.ts +4 -0
- package/lib/component/index.js +5 -1
- package/lib/component/index.js.map +1 -1
- package/lib/component/legendCategory.js +1 -0
- package/lib/component/legendCategory.js.map +1 -1
- package/lib/component/slider.d.ts +9 -0
- package/lib/component/slider.js +63 -0
- package/lib/component/slider.js.map +1 -0
- package/lib/component/sliderX.d.ts +7 -0
- package/lib/component/sliderX.js +13 -0
- package/lib/component/sliderX.js.map +1 -0
- package/lib/component/sliderY.d.ts +7 -0
- package/lib/component/sliderY.js +13 -0
- package/lib/component/sliderY.js.map +1 -0
- package/lib/composition/facetRect.js +4 -4
- package/lib/composition/facetRect.js.map +1 -1
- package/lib/composition/mark.js +2 -1
- package/lib/composition/mark.js.map +1 -1
- package/lib/composition/repeatMatrix.js +2 -2
- package/lib/composition/repeatMatrix.js.map +1 -1
- package/lib/data/filter.d.ts +3 -3
- package/lib/data/filter.js.map +1 -1
- package/lib/data/index.d.ts +3 -1
- package/lib/data/index.js +3 -1
- package/lib/data/index.js.map +1 -1
- package/lib/data/sort.d.ts +8 -0
- package/lib/data/sort.js +17 -0
- package/lib/data/sort.js.map +1 -0
- package/lib/interaction/builtin/tooltip.d.ts +6 -4
- package/lib/interaction/index.d.ts +2 -0
- package/lib/interaction/index.js +5 -1
- package/lib/interaction/index.js.map +1 -1
- package/lib/interaction/native/legendFilter.d.ts +8 -0
- package/lib/interaction/native/legendFilter.js +193 -0
- package/lib/interaction/native/legendFilter.js.map +1 -0
- package/lib/interaction/native/tooltip.d.ts +2 -2
- package/lib/interaction/native/tooltip.js +39 -17
- package/lib/interaction/native/tooltip.js.map +1 -1
- package/lib/interaction/native/utils.d.ts +1 -1
- package/lib/interaction/native/utils.js +2 -2
- package/lib/interaction/native/utils.js.map +1 -1
- package/lib/mark/area.js +1 -1
- package/lib/mark/area.js.map +1 -1
- package/lib/mark/line.js +1 -1
- package/lib/mark/line.js.map +1 -1
- package/lib/runtime/component.js +29 -1
- package/lib/runtime/component.js.map +1 -1
- package/lib/runtime/plot.js +14 -7
- package/lib/runtime/plot.js.map +1 -1
- package/lib/runtime/types/mark.d.ts +1 -1
- package/lib/runtime/types/options.d.ts +1 -0
- package/lib/runtime/types/theme.d.ts +5 -0
- package/lib/spec/data.d.ts +10 -3
- package/lib/spec/geometry.d.ts +1 -0
- package/lib/spec/interaction.d.ts +9 -2
- package/lib/spec/transform.d.ts +7 -2
- package/lib/stdlib/index.js +2 -2
- package/lib/stdlib/index.js.map +1 -1
- package/lib/theme/dark.js +78 -28
- package/lib/theme/dark.js.map +1 -1
- package/lib/theme/light.js +68 -17
- package/lib/theme/light.js.map +1 -1
- package/lib/transform/filter.d.ts +7 -0
- package/lib/transform/filter.js +46 -0
- package/lib/transform/filter.js.map +1 -0
- package/lib/transform/index.d.ts +2 -0
- package/lib/transform/index.js +3 -1
- package/lib/transform/index.js.map +1 -1
- package/lib/utils/selection.d.ts +1 -0
- package/lib/utils/selection.js.map +1 -1
- package/lib/utils/size.js +1 -1
- package/lib/utils/size.js.map +1 -1
- package/package.json +5 -4
- package/src/api/mark/mark.ts +1 -0
- package/src/api/mark/types.ts +1 -0
- package/src/component/axis.ts +46 -91
- package/src/component/index.ts +4 -0
- package/src/component/legendCategory.ts +1 -0
- package/src/component/slider.ts +63 -0
- package/src/component/sliderX.ts +16 -0
- package/src/component/sliderY.ts +16 -0
- package/src/composition/facetRect.ts +4 -2
- package/src/composition/mark.ts +2 -0
- package/src/composition/repeatMatrix.ts +8 -1
- package/src/data/filter.ts +3 -3
- package/src/data/index.ts +3 -1
- package/src/data/sort.ts +18 -0
- package/src/interaction/index.ts +3 -0
- package/src/interaction/native/legendFilter.ts +206 -0
- package/src/interaction/native/tooltip.ts +57 -16
- package/src/interaction/native/utils.ts +2 -1
- package/src/mark/area.ts +1 -1
- package/src/mark/line.ts +1 -1
- package/src/runtime/component.ts +49 -2
- package/src/runtime/plot.ts +11 -5
- package/src/runtime/types/mark.ts +1 -1
- package/src/runtime/types/options.ts +1 -0
- package/src/runtime/types/theme.ts +5 -0
- package/src/spec/data.ts +12 -2
- package/src/spec/geometry.ts +1 -0
- package/src/spec/interaction.ts +11 -1
- package/src/spec/transform.ts +9 -1
- package/src/stdlib/index.ts +12 -2
- package/src/theme/dark.ts +79 -28
- package/src/theme/light.ts +68 -17
- package/src/transform/filter.ts +48 -0
- package/src/transform/index.ts +2 -0
- package/src/utils/selection.ts +2 -0
- package/src/utils/size.ts +1 -1
- package/src/.DS_Store +0 -0
- package/src/data/.DS_Store +0 -0
- package/src/shape/.DS_Store +0 -0
package/src/stdlib/index.ts
CHANGED
|
@@ -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.
|
|
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:
|
|
145
|
+
connectorStroke: COLORS.STROKE,
|
|
147
146
|
connectorStrokeOpacity: 0.45,
|
|
148
147
|
connectorLineWidth: 1,
|
|
149
|
-
backgroundFill:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
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 = {};
|
package/src/theme/light.ts
CHANGED
|
@@ -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
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
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 = {};
|
package/src/transform/index.ts
CHANGED
|
@@ -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';
|
package/src/utils/selection.ts
CHANGED
|
@@ -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.
|
|
26
|
+
parseInt10(style.paddingTop) + parseInt10(style.paddingBottom);
|
|
27
27
|
|
|
28
28
|
return {
|
|
29
29
|
width: wrapperWidth - widthPadding,
|
package/src/.DS_Store
DELETED
|
Binary file
|
package/src/data/.DS_Store
DELETED
|
Binary file
|
package/src/shape/.DS_Store
DELETED
|
Binary file
|