@antv/g2 5.0.16 → 5.0.17
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 +15 -0
- package/dist/g2-lite.min.js +3 -3
- package/dist/g2.min.js +3 -3
- package/esm/api/chart.js +5 -1
- package/esm/api/chart.js.map +1 -1
- package/esm/api/mark/types.d.ts +2 -2
- package/esm/component/legendCategory.js +23 -21
- package/esm/component/legendCategory.js.map +1 -1
- package/esm/component/legendContinuous.js +1 -1
- package/esm/component/legendContinuous.js.map +1 -1
- package/esm/component/title.js +2 -4
- package/esm/component/title.js.map +1 -1
- package/esm/mark/point.js +1 -1
- package/esm/mark/point.js.map +1 -1
- package/esm/runtime/component.d.ts +3 -2
- package/esm/runtime/component.js +62 -22
- package/esm/runtime/component.js.map +1 -1
- package/esm/runtime/layout.js +3 -3
- package/esm/runtime/layout.js.map +1 -1
- package/esm/runtime/mark.js +3 -2
- package/esm/runtime/mark.js.map +1 -1
- package/esm/runtime/plot.js +5 -5
- package/esm/runtime/plot.js.map +1 -1
- package/esm/runtime/scale.d.ts +3 -3
- package/esm/runtime/scale.js +21 -13
- package/esm/runtime/scale.js.map +1 -1
- package/esm/runtime/types/common.d.ts +12 -14
- package/esm/runtime/types/theme.d.ts +9 -13
- package/esm/shape/label/position/default.js +7 -2
- package/esm/shape/label/position/default.js.map +1 -1
- package/esm/shape/text/advance.js +5 -2
- package/esm/shape/text/advance.js.map +1 -1
- package/esm/spec/component.d.ts +11 -12
- package/esm/spec/composition.d.ts +1 -1
- package/esm/spec/index.d.ts +2 -1
- package/esm/spec/index.js.map +1 -1
- package/esm/spec/interaction.d.ts +1 -2
- package/esm/spec/mark.d.ts +1 -1
- package/esm/theme/academy.js +11 -32
- package/esm/theme/academy.js.map +1 -1
- package/esm/theme/classic.js +12 -33
- package/esm/theme/classic.js.map +1 -1
- package/esm/theme/classicDark.js +11 -32
- package/esm/theme/classicDark.js.map +1 -1
- package/lib/api/chart.js +5 -1
- package/lib/api/chart.js.map +1 -1
- package/lib/api/mark/types.d.ts +2 -2
- package/lib/component/legendCategory.js +23 -21
- package/lib/component/legendCategory.js.map +1 -1
- package/lib/component/legendContinuous.js +1 -1
- package/lib/component/legendContinuous.js.map +1 -1
- package/lib/component/title.js +2 -4
- package/lib/component/title.js.map +1 -1
- package/lib/mark/point.js +1 -1
- package/lib/mark/point.js.map +1 -1
- package/lib/runtime/component.d.ts +3 -2
- package/lib/runtime/component.js +64 -23
- package/lib/runtime/component.js.map +1 -1
- package/lib/runtime/layout.js +3 -3
- package/lib/runtime/layout.js.map +1 -1
- package/lib/runtime/mark.js +3 -2
- package/lib/runtime/mark.js.map +1 -1
- package/lib/runtime/plot.js +4 -4
- package/lib/runtime/plot.js.map +1 -1
- package/lib/runtime/scale.d.ts +3 -3
- package/lib/runtime/scale.js +21 -13
- package/lib/runtime/scale.js.map +1 -1
- package/lib/runtime/types/common.d.ts +12 -14
- package/lib/runtime/types/theme.d.ts +9 -13
- package/lib/shape/label/position/default.js +7 -2
- package/lib/shape/label/position/default.js.map +1 -1
- package/lib/shape/text/advance.js +5 -2
- package/lib/shape/text/advance.js.map +1 -1
- package/lib/spec/component.d.ts +11 -12
- package/lib/spec/composition.d.ts +1 -1
- package/lib/spec/index.d.ts +2 -1
- package/lib/spec/index.js.map +1 -1
- package/lib/spec/interaction.d.ts +1 -2
- package/lib/spec/mark.d.ts +1 -1
- package/lib/theme/academy.js +11 -32
- package/lib/theme/academy.js.map +1 -1
- package/lib/theme/classic.js +12 -33
- package/lib/theme/classic.js.map +1 -1
- package/lib/theme/classicDark.js +11 -32
- package/lib/theme/classicDark.js.map +1 -1
- package/package.json +9 -6
- package/src/api/chart.ts +10 -1
- package/src/api/mark/types.ts +5 -2
- package/src/component/legendCategory.ts +26 -32
- package/src/component/legendContinuous.ts +1 -1
- package/src/component/title.ts +11 -15
- package/src/mark/point.ts +1 -1
- package/src/runtime/component.ts +76 -29
- package/src/runtime/layout.ts +3 -3
- package/src/runtime/mark.ts +10 -1
- package/src/runtime/plot.ts +10 -8
- package/src/runtime/scale.ts +30 -15
- package/src/runtime/types/common.ts +16 -18
- package/src/runtime/types/theme.ts +13 -17
- package/src/shape/label/position/default.ts +8 -2
- package/src/shape/text/advance.ts +7 -2
- package/src/spec/component.ts +11 -12
- package/src/spec/composition.ts +1 -1
- package/src/spec/index.ts +2 -1
- package/src/spec/interaction.ts +1 -2
- package/src/spec/mark.ts +1 -1
- package/src/theme/academy.ts +12 -32
- package/src/theme/classic.ts +13 -33
- package/src/theme/classicDark.ts +12 -32
package/src/spec/index.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { AxisComponent, LegendComponent } from './component';
|
|
1
2
|
import { Composition } from './composition';
|
|
2
3
|
import { Mark } from './mark';
|
|
3
4
|
|
|
4
|
-
export type G2Spec = (Mark | Composition) & {
|
|
5
|
+
export type G2Spec = (Mark | Composition | AxisComponent | LegendComponent) & {
|
|
5
6
|
width?: number;
|
|
6
7
|
height?: number;
|
|
7
8
|
};
|
package/src/spec/interaction.ts
CHANGED
|
@@ -184,8 +184,7 @@ export type TooltipInteraction = {
|
|
|
184
184
|
event, // @todo
|
|
185
185
|
options: { title: 'string'; items: TooltipItemValue[] },
|
|
186
186
|
) => HTMLElement | string;
|
|
187
|
-
|
|
188
|
-
};
|
|
187
|
+
} & Record<`crosshairs${any}`, any>;
|
|
189
188
|
|
|
190
189
|
export type FisheyeInteraction = {
|
|
191
190
|
type?: 'fisheye';
|
package/src/spec/mark.ts
CHANGED
|
@@ -280,7 +280,7 @@ export type SankeyMark = BaseMark<
|
|
|
280
280
|
linkLabels: Record<string, any>[];
|
|
281
281
|
};
|
|
282
282
|
|
|
283
|
-
export type PathMark = BaseMark<'path', ChannelTypes>;
|
|
283
|
+
export type PathMark = BaseMark<'path', ChannelTypes | 'd'>;
|
|
284
284
|
|
|
285
285
|
export type TreemapMark = BaseMark<'treemap', 'value' | ChannelTypes> & {
|
|
286
286
|
layout?: Record<string, any>;
|
package/src/theme/academy.ts
CHANGED
|
@@ -10,14 +10,14 @@ const COLORS = {
|
|
|
10
10
|
|
|
11
11
|
const BACKGROUND_COLOR = 'transparent';
|
|
12
12
|
|
|
13
|
+
const DEFAULT_COLOR = '#4e79a7';
|
|
14
|
+
|
|
13
15
|
export const Academy: TC<AcademyOptions> = (options) => {
|
|
14
|
-
const DEFAULT_COLOR = '#4e79a7';
|
|
15
16
|
const defaultOptions: Theme = {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
elementActiveStroke: COLORS.BLACK,
|
|
17
|
+
color: DEFAULT_COLOR,
|
|
18
|
+
size: 1,
|
|
19
|
+
category10: 'tableau10',
|
|
20
|
+
category20: 'tableau10',
|
|
21
21
|
enter: {
|
|
22
22
|
duration: 300,
|
|
23
23
|
fill: 'both',
|
|
@@ -33,12 +33,12 @@ export const Academy: TC<AcademyOptions> = (options) => {
|
|
|
33
33
|
fill: 'both',
|
|
34
34
|
delay: 0,
|
|
35
35
|
},
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
36
|
+
view: {
|
|
37
|
+
viewFill: BACKGROUND_COLOR,
|
|
38
|
+
plotFill: 'transparent',
|
|
39
|
+
mainFill: 'transparent',
|
|
40
|
+
contentFill: 'transparent',
|
|
41
|
+
},
|
|
42
42
|
line: {
|
|
43
43
|
line: {
|
|
44
44
|
fill: '',
|
|
@@ -198,26 +198,6 @@ export const Academy: TC<AcademyOptions> = (options) => {
|
|
|
198
198
|
endMarkerFillOpacity: 0.95,
|
|
199
199
|
},
|
|
200
200
|
},
|
|
201
|
-
interaction: {
|
|
202
|
-
active: {
|
|
203
|
-
line: {
|
|
204
|
-
line: { lineWidth: 3 },
|
|
205
|
-
},
|
|
206
|
-
interval: {
|
|
207
|
-
rect: { stroke: COLORS.BLACK },
|
|
208
|
-
},
|
|
209
|
-
area: {
|
|
210
|
-
area: { fillOpacity: 0.5 },
|
|
211
|
-
},
|
|
212
|
-
},
|
|
213
|
-
inactive: {
|
|
214
|
-
area: {
|
|
215
|
-
area: { fillOpacity: 0.3 },
|
|
216
|
-
},
|
|
217
|
-
},
|
|
218
|
-
selected: {},
|
|
219
|
-
disabled: {},
|
|
220
|
-
},
|
|
221
201
|
axis: {
|
|
222
202
|
arrow: false,
|
|
223
203
|
gridLineDash: [0, 0],
|
package/src/theme/classic.ts
CHANGED
|
@@ -10,17 +10,17 @@ const COLORS = {
|
|
|
10
10
|
|
|
11
11
|
const BACKGROUND_COLOR = 'transparent';
|
|
12
12
|
|
|
13
|
+
const DEFAULT_COLOR = '#5B8FF9';
|
|
14
|
+
|
|
13
15
|
/**
|
|
14
16
|
* Default theme.
|
|
15
17
|
*/
|
|
16
18
|
export const Classic: TC<ClassicOptions> = (options) => {
|
|
17
|
-
const DEFAULT_COLOR = '#5B8FF9';
|
|
18
19
|
const defaultOptions: Theme = {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
elementActiveStroke: COLORS.BLACK,
|
|
20
|
+
color: DEFAULT_COLOR,
|
|
21
|
+
size: 1,
|
|
22
|
+
category10: 'category10',
|
|
23
|
+
category20: 'category20',
|
|
24
24
|
enter: {
|
|
25
25
|
duration: 300,
|
|
26
26
|
fill: 'both',
|
|
@@ -36,12 +36,12 @@ export const Classic: TC<ClassicOptions> = (options) => {
|
|
|
36
36
|
fill: 'both',
|
|
37
37
|
delay: 0,
|
|
38
38
|
},
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
39
|
+
view: {
|
|
40
|
+
viewFill: BACKGROUND_COLOR,
|
|
41
|
+
plotFill: 'transparent',
|
|
42
|
+
mainFill: 'transparent',
|
|
43
|
+
contentFill: 'transparent',
|
|
44
|
+
},
|
|
45
45
|
line: {
|
|
46
46
|
line: {
|
|
47
47
|
fill: '',
|
|
@@ -132,7 +132,6 @@ export const Classic: TC<ClassicOptions> = (options) => {
|
|
|
132
132
|
},
|
|
133
133
|
text: {
|
|
134
134
|
text: {
|
|
135
|
-
// fill: COLORS.BLACK,fillOpacity: 0.65,
|
|
136
135
|
fill: '#1D2129',
|
|
137
136
|
fontSize: 12,
|
|
138
137
|
strokeWidth: 0,
|
|
@@ -199,26 +198,6 @@ export const Classic: TC<ClassicOptions> = (options) => {
|
|
|
199
198
|
endMarkerFillOpacity: 0.95,
|
|
200
199
|
},
|
|
201
200
|
},
|
|
202
|
-
interaction: {
|
|
203
|
-
active: {
|
|
204
|
-
line: {
|
|
205
|
-
line: { lineWidth: 3 },
|
|
206
|
-
},
|
|
207
|
-
interval: {
|
|
208
|
-
rect: { stroke: COLORS.BLACK },
|
|
209
|
-
},
|
|
210
|
-
area: {
|
|
211
|
-
area: { fillOpacity: 0.5 },
|
|
212
|
-
},
|
|
213
|
-
},
|
|
214
|
-
inactive: {
|
|
215
|
-
area: {
|
|
216
|
-
area: { fillOpacity: 0.3 },
|
|
217
|
-
},
|
|
218
|
-
},
|
|
219
|
-
selected: {},
|
|
220
|
-
disabled: {},
|
|
221
|
-
},
|
|
222
201
|
axis: {
|
|
223
202
|
arrow: false,
|
|
224
203
|
gridLineDash: [0, 0],
|
|
@@ -429,6 +408,7 @@ export const Classic: TC<ClassicOptions> = (options) => {
|
|
|
429
408
|
thumbHighlightedFillOpacity: 0.2,
|
|
430
409
|
},
|
|
431
410
|
title: {
|
|
411
|
+
spacing: 8,
|
|
432
412
|
titleFill: COLORS.BLACK,
|
|
433
413
|
titleFillOpacity: 0.85,
|
|
434
414
|
titleFontSize: 14,
|
package/src/theme/classicDark.ts
CHANGED
|
@@ -10,17 +10,17 @@ const COLORS = {
|
|
|
10
10
|
|
|
11
11
|
const BACKGROUND_COLOR = '#141414';
|
|
12
12
|
|
|
13
|
+
const DEFAULT_COLOR = '#5B8FF9';
|
|
14
|
+
|
|
13
15
|
/**
|
|
14
16
|
* Dark theme.
|
|
15
17
|
*/
|
|
16
18
|
export const ClassicDark: TC<ClassicDarkOptions> = (options) => {
|
|
17
|
-
const DEFAULT_COLOR = '#5B8FF9';
|
|
18
19
|
const defaultOptions: Theme = {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
elementActiveStroke: COLORS.BLACK,
|
|
20
|
+
color: DEFAULT_COLOR,
|
|
21
|
+
category10: 'category10',
|
|
22
|
+
category20: 'category20',
|
|
23
|
+
size: 1,
|
|
24
24
|
enter: {
|
|
25
25
|
duration: 300,
|
|
26
26
|
fill: 'both',
|
|
@@ -36,12 +36,12 @@ export const ClassicDark: TC<ClassicDarkOptions> = (options) => {
|
|
|
36
36
|
fill: 'both',
|
|
37
37
|
delay: 0,
|
|
38
38
|
},
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
39
|
+
view: {
|
|
40
|
+
viewFill: BACKGROUND_COLOR,
|
|
41
|
+
plotFill: 'transparent',
|
|
42
|
+
mainFill: 'transparent',
|
|
43
|
+
contentFill: 'transparent',
|
|
44
|
+
},
|
|
45
45
|
line: {
|
|
46
46
|
line: {
|
|
47
47
|
fill: '',
|
|
@@ -199,26 +199,6 @@ export const ClassicDark: TC<ClassicDarkOptions> = (options) => {
|
|
|
199
199
|
endMarkerFillOpacity: 0.95,
|
|
200
200
|
},
|
|
201
201
|
},
|
|
202
|
-
interaction: {
|
|
203
|
-
active: {
|
|
204
|
-
line: {
|
|
205
|
-
line: { lineWidth: 3 },
|
|
206
|
-
},
|
|
207
|
-
interval: {
|
|
208
|
-
rect: { stroke: COLORS.BLACK },
|
|
209
|
-
},
|
|
210
|
-
area: {
|
|
211
|
-
area: { fillOpacity: 0.5 },
|
|
212
|
-
},
|
|
213
|
-
},
|
|
214
|
-
inactive: {
|
|
215
|
-
area: {
|
|
216
|
-
area: { fillOpacity: 0.3 },
|
|
217
|
-
},
|
|
218
|
-
},
|
|
219
|
-
selected: {},
|
|
220
|
-
disabled: {},
|
|
221
|
-
},
|
|
222
202
|
axis: {
|
|
223
203
|
arrow: false,
|
|
224
204
|
gridLineDash: [0, 0],
|