@antv/g2 5.0.21 → 5.0.23
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/CHANGELOG.md +308 -0
- package/dist/g2-lite.min.js +3 -3
- package/dist/g2.min.js +3 -3
- package/esm/api/chart.d.ts +4 -1
- package/esm/api/chart.js.map +1 -1
- package/esm/api/index.d.ts +1 -1
- package/esm/api/index.js.map +1 -1
- package/esm/api/library.d.ts +1 -0
- package/esm/component/axis.js +15 -10
- package/esm/component/axis.js.map +1 -1
- package/esm/component/legendCategory.js +2 -2
- package/esm/component/legendCategory.js.map +1 -1
- package/esm/component/legendContinuous.js +4 -5
- package/esm/component/legendContinuous.js.map +1 -1
- package/esm/component/scrollbar.js +2 -0
- package/esm/component/scrollbar.js.map +1 -1
- package/esm/component/slider.js +2 -0
- package/esm/component/slider.js.map +1 -1
- package/esm/component/title.js +4 -2
- package/esm/component/title.js.map +1 -1
- package/esm/component/utils.d.ts +1 -1
- package/esm/component/utils.js +2 -3
- package/esm/component/utils.js.map +1 -1
- package/esm/composition/facetRect.js +2 -2
- package/esm/composition/facetRect.js.map +1 -1
- package/esm/composition/repeatMatrix.js +3 -3
- package/esm/composition/repeatMatrix.js.map +1 -1
- package/esm/index.d.ts +2 -2
- package/esm/index.js +1 -1
- package/esm/index.js.map +1 -1
- package/esm/interaction/brushHighlight.js.map +1 -1
- package/esm/interaction/tooltip.js +4 -3
- package/esm/interaction/tooltip.js.map +1 -1
- package/esm/lib/core.d.ts +1 -0
- package/esm/lib/core.js +4 -3
- package/esm/lib/core.js.map +1 -1
- package/esm/lib/std.d.ts +1 -0
- package/esm/runtime/component.js +33 -30
- package/esm/runtime/component.js.map +1 -1
- package/esm/runtime/layout.js +78 -28
- package/esm/runtime/layout.js.map +1 -1
- package/esm/runtime/plot.js +42 -42
- package/esm/runtime/plot.js.map +1 -1
- package/esm/runtime/render.js +0 -3
- package/esm/runtime/render.js.map +1 -1
- package/esm/runtime/scale.js +2 -0
- package/esm/runtime/scale.js.map +1 -1
- package/esm/runtime/types/common.d.ts +3 -1
- package/esm/runtime/types/theme.d.ts +8 -2
- package/esm/shape/connector/connector.js +19 -30
- package/esm/shape/connector/connector.js.map +1 -1
- package/esm/theme/classic.js +52 -37
- package/esm/theme/classic.js.map +1 -1
- package/esm/theme/index.d.ts +1 -0
- package/esm/theme/index.js +1 -0
- package/esm/theme/index.js.map +1 -1
- package/esm/theme/light.d.ts +6 -0
- package/esm/theme/light.js +476 -0
- package/esm/theme/light.js.map +1 -0
- package/esm/utils/selection.d.ts +1 -1
- package/esm/utils/selection.js +10 -10
- package/esm/utils/selection.js.map +1 -1
- package/esm/utils/size.js +1 -1
- package/lib/api/chart.d.ts +4 -1
- package/lib/api/chart.js.map +1 -1
- package/lib/api/index.d.ts +1 -1
- package/lib/api/index.js.map +1 -1
- package/lib/api/library.d.ts +1 -0
- package/lib/component/axis.js +14 -9
- package/lib/component/axis.js.map +1 -1
- package/lib/component/legendCategory.js +2 -2
- package/lib/component/legendCategory.js.map +1 -1
- package/lib/component/legendContinuous.js +4 -5
- package/lib/component/legendContinuous.js.map +1 -1
- package/lib/component/scrollbar.js +2 -0
- package/lib/component/scrollbar.js.map +1 -1
- package/lib/component/slider.js +2 -0
- package/lib/component/slider.js.map +1 -1
- package/lib/component/title.js +4 -2
- package/lib/component/title.js.map +1 -1
- package/lib/component/utils.d.ts +1 -1
- package/lib/component/utils.js +2 -3
- package/lib/component/utils.js.map +1 -1
- package/lib/composition/facetRect.js +2 -2
- package/lib/composition/facetRect.js.map +1 -1
- package/lib/composition/repeatMatrix.js +3 -3
- package/lib/composition/repeatMatrix.js.map +1 -1
- package/lib/index.d.ts +2 -2
- package/lib/index.js +4 -1
- package/lib/index.js.map +1 -1
- package/lib/interaction/brushHighlight.js.map +1 -1
- package/lib/interaction/tooltip.js +4 -3
- package/lib/interaction/tooltip.js.map +1 -1
- package/lib/lib/core.d.ts +1 -0
- package/lib/lib/core.js +1 -0
- package/lib/lib/core.js.map +1 -1
- package/lib/lib/std.d.ts +1 -0
- package/lib/runtime/component.js +33 -30
- package/lib/runtime/component.js.map +1 -1
- package/lib/runtime/layout.js +76 -26
- package/lib/runtime/layout.js.map +1 -1
- package/lib/runtime/plot.js +42 -42
- package/lib/runtime/plot.js.map +1 -1
- package/lib/runtime/render.js +0 -3
- package/lib/runtime/render.js.map +1 -1
- package/lib/runtime/scale.js +2 -0
- package/lib/runtime/scale.js.map +1 -1
- package/lib/runtime/types/common.d.ts +3 -1
- package/lib/runtime/types/theme.d.ts +8 -2
- package/lib/shape/connector/connector.js +19 -30
- package/lib/shape/connector/connector.js.map +1 -1
- package/lib/theme/classic.js +52 -37
- package/lib/theme/classic.js.map +1 -1
- package/lib/theme/index.d.ts +1 -0
- package/lib/theme/index.js +3 -1
- package/lib/theme/index.js.map +1 -1
- package/lib/theme/light.d.ts +6 -0
- package/lib/theme/light.js +480 -0
- package/lib/theme/light.js.map +1 -0
- package/lib/utils/selection.d.ts +1 -1
- package/lib/utils/selection.js +10 -10
- package/lib/utils/selection.js.map +1 -1
- package/lib/utils/size.js +1 -1
- package/package.json +4 -3
- package/src/api/chart.ts +3 -0
- package/src/api/index.ts +1 -1
- package/src/component/axis.ts +17 -13
- package/src/component/legendCategory.ts +3 -5
- package/src/component/legendContinuous.ts +4 -5
- package/src/component/scrollbar.ts +4 -1
- package/src/component/slider.ts +4 -1
- package/src/component/title.ts +3 -3
- package/src/component/utils.ts +1 -3
- package/src/composition/facetRect.ts +4 -3
- package/src/composition/repeatMatrix.ts +4 -3
- package/src/index.ts +10 -1
- package/src/interaction/brushHighlight.ts +1 -1
- package/src/interaction/tooltip.ts +5 -3
- package/src/lib/core.ts +4 -3
- package/src/runtime/component.ts +57 -30
- package/src/runtime/layout.ts +90 -31
- package/src/runtime/plot.ts +62 -40
- package/src/runtime/render.ts +0 -5
- package/src/runtime/scale.ts +1 -0
- package/src/runtime/types/common.ts +2 -0
- package/src/runtime/types/theme.ts +8 -2
- package/src/shape/connector/connector.ts +41 -47
- package/src/shape/utils.ts +2 -2
- package/src/theme/classic.ts +52 -37
- package/src/theme/index.ts +1 -0
- package/src/theme/light.ts +483 -0
- package/src/utils/selection.ts +11 -11
- package/src/utils/size.ts +1 -1
package/src/shape/utils.ts
CHANGED
|
@@ -3,10 +3,10 @@ import { Linear } from '@antv/scale';
|
|
|
3
3
|
import { lowerFirst } from '@antv/util';
|
|
4
4
|
import { extent } from 'd3-array';
|
|
5
5
|
import { Path as D3Path } from 'd3-path';
|
|
6
|
-
import {
|
|
6
|
+
import { Primitive, Vector2, Vector3 } from '../runtime';
|
|
7
7
|
import { indexOf } from '../utils/array';
|
|
8
8
|
import { isPolar, isTranspose } from '../utils/coordinate';
|
|
9
|
-
import { Selection } from '../utils/selection';
|
|
9
|
+
import { G2Element, Selection } from '../utils/selection';
|
|
10
10
|
import { angle, angleWithQuadrant, dist, sub } from '../utils/vector';
|
|
11
11
|
|
|
12
12
|
export function applyStyle(
|
package/src/theme/classic.ts
CHANGED
|
@@ -3,21 +3,35 @@ import { ThemeComponent as TC, Theme } from '../runtime';
|
|
|
3
3
|
export type ClassicOptions = Theme;
|
|
4
4
|
|
|
5
5
|
const COLORS = {
|
|
6
|
-
BLACK: '#
|
|
6
|
+
BLACK: '#1D2129',
|
|
7
7
|
WHITE: '#fff',
|
|
8
8
|
STROKE: '#416180',
|
|
9
|
+
DEFAULT: '#5B8FF9',
|
|
10
|
+
BACKGROUND: 'transparent',
|
|
9
11
|
};
|
|
10
12
|
|
|
11
|
-
const
|
|
13
|
+
const PADDING = {
|
|
14
|
+
1: 8,
|
|
15
|
+
2: 12,
|
|
16
|
+
3: 20,
|
|
17
|
+
};
|
|
12
18
|
|
|
13
|
-
const
|
|
19
|
+
const ALPHA = {
|
|
20
|
+
90: 0.9,
|
|
21
|
+
65: 0.65,
|
|
22
|
+
45: 0.45,
|
|
23
|
+
25: 0.25,
|
|
24
|
+
10: 0.1,
|
|
25
|
+
};
|
|
14
26
|
|
|
15
27
|
/**
|
|
16
28
|
* Default theme.
|
|
17
29
|
*/
|
|
18
30
|
export const Classic: TC<ClassicOptions> = (options) => {
|
|
19
31
|
const defaultOptions: Theme = {
|
|
20
|
-
|
|
32
|
+
padding: 'auto',
|
|
33
|
+
margin: 16,
|
|
34
|
+
color: COLORS.DEFAULT,
|
|
21
35
|
size: 1,
|
|
22
36
|
category10: 'category10',
|
|
23
37
|
category20: 'category20',
|
|
@@ -37,7 +51,7 @@ export const Classic: TC<ClassicOptions> = (options) => {
|
|
|
37
51
|
delay: 0,
|
|
38
52
|
},
|
|
39
53
|
view: {
|
|
40
|
-
viewFill:
|
|
54
|
+
viewFill: COLORS.BACKGROUND,
|
|
41
55
|
plotFill: 'transparent',
|
|
42
56
|
mainFill: 'transparent',
|
|
43
57
|
contentFill: 'transparent',
|
|
@@ -200,26 +214,26 @@ export const Classic: TC<ClassicOptions> = (options) => {
|
|
|
200
214
|
},
|
|
201
215
|
axis: {
|
|
202
216
|
arrow: false,
|
|
203
|
-
gridLineDash: [
|
|
217
|
+
gridLineDash: [3, 4],
|
|
204
218
|
gridLineWidth: 0.5,
|
|
205
219
|
gridStroke: COLORS.BLACK,
|
|
206
|
-
gridStrokeOpacity:
|
|
220
|
+
gridStrokeOpacity: ALPHA[10],
|
|
207
221
|
labelAlign: 'horizontal',
|
|
208
222
|
labelFill: COLORS.BLACK,
|
|
209
|
-
|
|
223
|
+
labelOpacity: ALPHA[45],
|
|
210
224
|
labelFontSize: 12,
|
|
211
|
-
labelFontWeight: '
|
|
212
|
-
labelSpacing:
|
|
225
|
+
labelFontWeight: 'normal',
|
|
226
|
+
labelSpacing: PADDING[1], // spacing between label and it's tick
|
|
213
227
|
line: false,
|
|
214
228
|
lineLineWidth: 0.5,
|
|
215
229
|
lineStroke: COLORS.BLACK,
|
|
216
|
-
lineStrokeOpacity:
|
|
230
|
+
lineStrokeOpacity: ALPHA[45],
|
|
217
231
|
tickLength: 4,
|
|
218
232
|
tickLineWidth: 1,
|
|
219
233
|
tickStroke: COLORS.BLACK,
|
|
220
|
-
|
|
234
|
+
tickOpacity: ALPHA[45],
|
|
221
235
|
titleFill: COLORS.BLACK,
|
|
222
|
-
|
|
236
|
+
titleOpacity: ALPHA[90],
|
|
223
237
|
titleFontSize: 12,
|
|
224
238
|
titleFontWeight: 'normal',
|
|
225
239
|
titleSpacing: 12,
|
|
@@ -228,20 +242,18 @@ export const Classic: TC<ClassicOptions> = (options) => {
|
|
|
228
242
|
axisTop: {
|
|
229
243
|
gridDirection: 'positive',
|
|
230
244
|
labelDirection: 'negative',
|
|
231
|
-
labelSpacing: 4,
|
|
232
245
|
tickDirection: 'negative',
|
|
233
246
|
titlePosition: 'top',
|
|
234
|
-
titleSpacing:
|
|
247
|
+
titleSpacing: 12,
|
|
235
248
|
titleTextBaseline: 'middle',
|
|
236
249
|
},
|
|
237
250
|
axisBottom: {
|
|
238
251
|
gridDirection: 'negative',
|
|
239
252
|
labelDirection: 'positive',
|
|
240
|
-
labelSpacing: 4,
|
|
241
253
|
labelAutoRotate: true,
|
|
242
254
|
tickDirection: 'positive',
|
|
243
255
|
titlePosition: 'bottom',
|
|
244
|
-
titleSpacing:
|
|
256
|
+
titleSpacing: 12,
|
|
245
257
|
titleTextBaseline: 'bottom',
|
|
246
258
|
},
|
|
247
259
|
axisLeft: {
|
|
@@ -251,7 +263,7 @@ export const Classic: TC<ClassicOptions> = (options) => {
|
|
|
251
263
|
labelSpacing: 4,
|
|
252
264
|
tickDirection: 'negative',
|
|
253
265
|
titlePosition: 'left',
|
|
254
|
-
titleSpacing:
|
|
266
|
+
titleSpacing: 12,
|
|
255
267
|
titleTextBaseline: 'middle',
|
|
256
268
|
titleDirection: 'vertical',
|
|
257
269
|
titleTransformOrigin: 'center',
|
|
@@ -262,7 +274,8 @@ export const Classic: TC<ClassicOptions> = (options) => {
|
|
|
262
274
|
labelSpacing: 4,
|
|
263
275
|
tickDirection: 'positive',
|
|
264
276
|
titlePosition: 'right',
|
|
265
|
-
|
|
277
|
+
labelAutoRotate: false,
|
|
278
|
+
titleSpacing: 12,
|
|
266
279
|
titleTextBaseline: 'top',
|
|
267
280
|
titleDirection: 'vertical',
|
|
268
281
|
titleTransformOrigin: 'center',
|
|
@@ -294,23 +307,23 @@ export const Classic: TC<ClassicOptions> = (options) => {
|
|
|
294
307
|
backgroundFill: 'transparent',
|
|
295
308
|
itemBackgroundFill: 'transparent',
|
|
296
309
|
itemLabelFill: COLORS.BLACK,
|
|
297
|
-
itemLabelFillOpacity:
|
|
310
|
+
itemLabelFillOpacity: ALPHA[90],
|
|
298
311
|
itemLabelFontSize: 12,
|
|
299
|
-
itemLabelFontWeight: '
|
|
312
|
+
itemLabelFontWeight: 'normal',
|
|
300
313
|
itemMarkerFillOpacity: 1,
|
|
301
314
|
itemMarkerSize: 8,
|
|
302
|
-
itemSpacing: [
|
|
315
|
+
itemSpacing: [PADDING[1], PADDING[1]],
|
|
303
316
|
itemValueFill: COLORS.BLACK,
|
|
304
317
|
itemValueFillOpacity: 0.65,
|
|
305
318
|
itemValueFontSize: 12,
|
|
306
|
-
itemValueFontWeight: '
|
|
319
|
+
itemValueFontWeight: 'normal',
|
|
307
320
|
navButtonFill: COLORS.BLACK,
|
|
308
321
|
navButtonFillOpacity: 0.65,
|
|
309
322
|
navPageNumFill: COLORS.BLACK,
|
|
310
323
|
navPageNumFillOpacity: 0.45,
|
|
311
324
|
navPageNumFontSize: 12,
|
|
312
325
|
padding: 8,
|
|
313
|
-
title:
|
|
326
|
+
title: false,
|
|
314
327
|
titleFill: COLORS.BLACK,
|
|
315
328
|
titleFillOpacity: 0.65,
|
|
316
329
|
titleFontSize: 12,
|
|
@@ -318,13 +331,15 @@ export const Classic: TC<ClassicOptions> = (options) => {
|
|
|
318
331
|
titleSpacing: 4,
|
|
319
332
|
tickStroke: COLORS.BLACK,
|
|
320
333
|
tickStrokeOpacity: 0.25,
|
|
321
|
-
rowPadding:
|
|
322
|
-
colPadding:
|
|
334
|
+
rowPadding: PADDING[1],
|
|
335
|
+
colPadding: PADDING[2],
|
|
336
|
+
maxRows: 3,
|
|
337
|
+
maxCols: 3,
|
|
323
338
|
},
|
|
324
339
|
legendContinuous: {
|
|
325
340
|
handleHeight: 12,
|
|
326
341
|
handleLabelFill: COLORS.BLACK,
|
|
327
|
-
handleLabelFillOpacity:
|
|
342
|
+
handleLabelFillOpacity: ALPHA[45],
|
|
328
343
|
handleLabelFontSize: 12,
|
|
329
344
|
handleLabelFontWeight: 'normal',
|
|
330
345
|
handleMarkerFill: COLORS.BLACK,
|
|
@@ -334,9 +349,9 @@ export const Classic: TC<ClassicOptions> = (options) => {
|
|
|
334
349
|
handleMarkerStrokeOpacity: 0.25,
|
|
335
350
|
handleWidth: 10,
|
|
336
351
|
labelFill: COLORS.BLACK,
|
|
337
|
-
labelFillOpacity:
|
|
352
|
+
labelFillOpacity: ALPHA[45],
|
|
338
353
|
labelFontSize: 12,
|
|
339
|
-
labelFontWeight: '
|
|
354
|
+
labelFontWeight: 'normal',
|
|
340
355
|
labelSpacing: 3,
|
|
341
356
|
tick: true,
|
|
342
357
|
tickLength: 12,
|
|
@@ -350,9 +365,9 @@ export const Classic: TC<ClassicOptions> = (options) => {
|
|
|
350
365
|
titleFontSize: 12,
|
|
351
366
|
titleSpacing: 4,
|
|
352
367
|
titleFontWeight: 'normal',
|
|
353
|
-
titleFillOpacity:
|
|
368
|
+
titleFillOpacity: ALPHA[90],
|
|
354
369
|
tickStroke: COLORS.BLACK,
|
|
355
|
-
tickStrokeOpacity:
|
|
370
|
+
tickStrokeOpacity: ALPHA[45],
|
|
356
371
|
},
|
|
357
372
|
label: {
|
|
358
373
|
fill: COLORS.BLACK,
|
|
@@ -386,7 +401,7 @@ export const Classic: TC<ClassicOptions> = (options) => {
|
|
|
386
401
|
trackSize: 16,
|
|
387
402
|
trackFill: COLORS.STROKE,
|
|
388
403
|
trackFillOpacity: 1,
|
|
389
|
-
selectionFill:
|
|
404
|
+
selectionFill: COLORS.DEFAULT,
|
|
390
405
|
selectionFillOpacity: 0.15,
|
|
391
406
|
handleIconSize: 10,
|
|
392
407
|
handleIconFill: '#f7f7f7',
|
|
@@ -401,8 +416,8 @@ export const Classic: TC<ClassicOptions> = (options) => {
|
|
|
401
416
|
handleLabelFontWeight: 'normal',
|
|
402
417
|
},
|
|
403
418
|
scrollbar: {
|
|
404
|
-
padding: [
|
|
405
|
-
trackSize:
|
|
419
|
+
padding: [0, 0, 0, 0],
|
|
420
|
+
trackSize: 6,
|
|
406
421
|
isRound: true,
|
|
407
422
|
slidable: true,
|
|
408
423
|
scrollable: true,
|
|
@@ -415,12 +430,12 @@ export const Classic: TC<ClassicOptions> = (options) => {
|
|
|
415
430
|
title: {
|
|
416
431
|
spacing: 8,
|
|
417
432
|
titleFill: COLORS.BLACK,
|
|
418
|
-
titleFillOpacity:
|
|
419
|
-
titleFontSize:
|
|
433
|
+
titleFillOpacity: ALPHA[90],
|
|
434
|
+
titleFontSize: 16,
|
|
420
435
|
titleFontWeight: 'bold',
|
|
421
436
|
titleTextBaseline: 'top',
|
|
422
437
|
subtitleFill: COLORS.BLACK,
|
|
423
|
-
subtitleFillOpacity:
|
|
438
|
+
subtitleFillOpacity: ALPHA[65],
|
|
424
439
|
subtitleFontSize: 12,
|
|
425
440
|
subtitleFontWeight: 'normal',
|
|
426
441
|
subtitleTextBaseline: 'top',
|
package/src/theme/index.ts
CHANGED