@antv/g2 5.0.0 → 5.0.1
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 +17 -0
- package/README.en-US.md +1 -1
- package/README.md +1 -1
- package/dist/g2-lite.min.js +4 -4
- package/dist/g2.min.js +4 -4
- package/esm/interaction/tooltip.d.ts +1 -1
- package/esm/interaction/tooltip.js +5 -3
- package/esm/interaction/tooltip.js.map +1 -1
- package/esm/spec/interaction.d.ts +19 -33
- package/esm/transform/maybeTitle.js +5 -1
- package/esm/transform/maybeTitle.js.map +1 -1
- package/lib/interaction/tooltip.d.ts +1 -1
- package/lib/interaction/tooltip.js +4 -2
- package/lib/interaction/tooltip.js.map +1 -1
- package/lib/spec/interaction.d.ts +19 -33
- package/lib/transform/maybeTitle.js +5 -1
- package/lib/transform/maybeTitle.js.map +1 -1
- package/package.json +25 -22
- package/src/interaction/tooltip.ts +5 -3
- package/src/spec/interaction.ts +19 -43
- package/src/transform/maybeTitle.ts +5 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antv/g2",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.1",
|
|
4
4
|
"description": "the Grammar of Graphics in Javascript",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -31,7 +31,8 @@
|
|
|
31
31
|
"ci": "run-s lint test build",
|
|
32
32
|
"prepublishOnly": "npm run ci",
|
|
33
33
|
"prepare": "husky install",
|
|
34
|
-
"upload": "node scripts/uploadSnapshot.js"
|
|
34
|
+
"upload": "node scripts/uploadSnapshot.js",
|
|
35
|
+
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s"
|
|
35
36
|
},
|
|
36
37
|
"keywords": [
|
|
37
38
|
"antv",
|
|
@@ -43,11 +44,32 @@
|
|
|
43
44
|
"interaction",
|
|
44
45
|
"animation"
|
|
45
46
|
],
|
|
47
|
+
"dependencies": {
|
|
48
|
+
"@antv/coord": "^0.4.1",
|
|
49
|
+
"@antv/event-emitter": "^0.1.3",
|
|
50
|
+
"@antv/g": "^5.7.4",
|
|
51
|
+
"@antv/g-canvas": "^1.7.4",
|
|
52
|
+
"@antv/g-plugin-dragndrop": "^1.6.1",
|
|
53
|
+
"@antv/gui": "^0.5.0-alpha.8",
|
|
54
|
+
"@antv/path-util": "^3.0.1",
|
|
55
|
+
"@antv/scale": "^0.4.7",
|
|
56
|
+
"@antv/util": "^3.3.2",
|
|
57
|
+
"d3-array": "^3.2.2",
|
|
58
|
+
"d3-dsv": "^3.0.1",
|
|
59
|
+
"d3-force": "^3.0.0",
|
|
60
|
+
"d3-format": "^3.1.0",
|
|
61
|
+
"d3-geo": "^3.0.1",
|
|
62
|
+
"d3-hierarchy": "^3.1.2",
|
|
63
|
+
"d3-scale-chromatic": "^3.0.0",
|
|
64
|
+
"d3-shape": "^3.1.0",
|
|
65
|
+
"d3-voronoi": "^1.1.4"
|
|
66
|
+
},
|
|
46
67
|
"devDependencies": {
|
|
47
68
|
"@antv/g-plugin-rough-canvas-renderer": "^1.7.9",
|
|
48
69
|
"@antv/g-plugin-rough-svg-renderer": "^1.7.9",
|
|
49
70
|
"@antv/g-svg": "^1.8.6",
|
|
50
71
|
"@commitlint/cli": "^11.0.0",
|
|
72
|
+
"@commitlint/config-conventional": "^17.4.4",
|
|
51
73
|
"@rollup/plugin-commonjs": "^21.0.2",
|
|
52
74
|
"@types/d3-array": "^3.0.2",
|
|
53
75
|
"@types/d3-shape": "^3.0.2",
|
|
@@ -59,6 +81,7 @@
|
|
|
59
81
|
"ali-oss": "^6.17.1",
|
|
60
82
|
"archiver": "^5.3.1",
|
|
61
83
|
"canvas": "^2.10.2",
|
|
84
|
+
"conventional-changelog-cli": "^2.2.2",
|
|
62
85
|
"cross-env": "^7.0.3",
|
|
63
86
|
"d3-dsv": "^3.0.1",
|
|
64
87
|
"d3-fetch": "^3.0.1",
|
|
@@ -121,25 +144,5 @@
|
|
|
121
144
|
},
|
|
122
145
|
"bugs": {
|
|
123
146
|
"url": "https://github.com/antvis/g2/issues"
|
|
124
|
-
},
|
|
125
|
-
"dependencies": {
|
|
126
|
-
"@antv/coord": "^0.4.1",
|
|
127
|
-
"@antv/event-emitter": "^0.1.3",
|
|
128
|
-
"@antv/g": "^5.7.4",
|
|
129
|
-
"@antv/g-canvas": "^1.7.4",
|
|
130
|
-
"@antv/g-plugin-dragndrop": "^1.6.1",
|
|
131
|
-
"@antv/gui": "^0.5.0-alpha.8",
|
|
132
|
-
"@antv/path-util": "^3.0.1",
|
|
133
|
-
"@antv/scale": "^0.4.7",
|
|
134
|
-
"@antv/util": "^3.3.2",
|
|
135
|
-
"d3-array": "^3.2.2",
|
|
136
|
-
"d3-dsv": "^3.0.1",
|
|
137
|
-
"d3-force": "^3.0.0",
|
|
138
|
-
"d3-format": "^3.1.0",
|
|
139
|
-
"d3-geo": "^3.0.1",
|
|
140
|
-
"d3-hierarchy": "^3.1.2",
|
|
141
|
-
"d3-scale-chromatic": "^3.0.0",
|
|
142
|
-
"d3-shape": "^3.1.0",
|
|
143
|
-
"d3-voronoi": "^1.1.4"
|
|
144
147
|
}
|
|
145
148
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DisplayObject, IElement, Line } from '@antv/g';
|
|
2
2
|
import { sort, group, mean, bisector } from 'd3-array';
|
|
3
|
-
import { lowerFirst, throttle } from '@antv/util';
|
|
3
|
+
import { deepMix, lowerFirst, throttle } from '@antv/util';
|
|
4
4
|
import { Tooltip as TooltipComponent } from '@antv/gui';
|
|
5
5
|
import { Constant, Identity } from '@antv/scale';
|
|
6
6
|
import { defined, subObject } from '../utils/helper';
|
|
@@ -275,7 +275,6 @@ export function seriesTooltip(
|
|
|
275
275
|
coordinate,
|
|
276
276
|
crosshairs,
|
|
277
277
|
render,
|
|
278
|
-
style,
|
|
279
278
|
groupName = true,
|
|
280
279
|
wait = 50,
|
|
281
280
|
leading = true,
|
|
@@ -286,11 +285,14 @@ export function seriesTooltip(
|
|
|
286
285
|
single = true,
|
|
287
286
|
position,
|
|
288
287
|
enterable,
|
|
288
|
+
style: _style = {},
|
|
289
|
+
...rest
|
|
289
290
|
}: Record<string, any>,
|
|
290
291
|
) {
|
|
291
292
|
const elements = elementsof(root);
|
|
292
293
|
const transposed = isTranspose(coordinate);
|
|
293
294
|
const polar = isPolar(coordinate);
|
|
295
|
+
const style = deepMix(_style, rest);
|
|
294
296
|
const { innerWidth: width, innerHeight: height } = coordinate.getOptions();
|
|
295
297
|
|
|
296
298
|
// Split elements into series elements and item elements.
|
|
@@ -386,7 +388,7 @@ export function seriesTooltip(
|
|
|
386
388
|
selectedSeriesElements.push(element);
|
|
387
389
|
const d = seriesData(element, index);
|
|
388
390
|
const { x, y } = d;
|
|
389
|
-
const p = coordinate.map([x + offsetX, y]);
|
|
391
|
+
const p = coordinate.map([(x || 0) + offsetX, y || 0]);
|
|
390
392
|
selectedSeriesData.push([d, p] as const);
|
|
391
393
|
}
|
|
392
394
|
}
|
package/src/spec/interaction.ts
CHANGED
|
@@ -50,62 +50,50 @@ export type InteractionTypes =
|
|
|
50
50
|
| 'poptip'
|
|
51
51
|
| InteractionComponent;
|
|
52
52
|
|
|
53
|
-
export type BrushInteraction = {
|
|
54
|
-
type?: 'brush';
|
|
55
|
-
brushType?: 'rect' | 'rectX' | 'rectY' | 'polygon';
|
|
56
|
-
};
|
|
57
|
-
|
|
58
53
|
export type BrushHighlightInteraction = {
|
|
59
54
|
type?: 'brushHighlight';
|
|
60
55
|
brushKey?: string;
|
|
61
56
|
reverse?: boolean;
|
|
62
|
-
shared?: boolean;
|
|
63
57
|
series?: boolean;
|
|
64
58
|
facet?: boolean;
|
|
65
|
-
} & Record<`${'mask'
|
|
59
|
+
} & Record<`${'mask'}${any}`, any>;
|
|
66
60
|
|
|
67
61
|
export type BrushXHighlightInteraction = {
|
|
68
62
|
type?: 'brushXHighlight';
|
|
69
63
|
brushKey?: string;
|
|
70
64
|
reverse?: boolean;
|
|
71
|
-
shared?: boolean;
|
|
72
65
|
series?: boolean;
|
|
73
66
|
facet?: boolean;
|
|
74
|
-
} & Record<`${'mask'
|
|
67
|
+
} & Record<`${'mask'}${any}`, any>;
|
|
75
68
|
|
|
76
69
|
export type BrushYHighlightInteraction = {
|
|
77
70
|
type?: 'brushYHighlight';
|
|
78
71
|
brushKey?: string;
|
|
79
72
|
reverse?: boolean;
|
|
80
|
-
shared?: boolean;
|
|
81
73
|
series?: boolean;
|
|
82
74
|
facet?: boolean;
|
|
83
|
-
} & Record<`${'mask'
|
|
75
|
+
} & Record<`${'mask'}${any}`, any>;
|
|
84
76
|
|
|
85
77
|
export type BrushAxisHighlightInteraction = {
|
|
86
78
|
type?: 'brushAxisHighlight';
|
|
87
79
|
reverse?: boolean;
|
|
88
|
-
|
|
80
|
+
brushKey?: string;
|
|
81
|
+
} & Record<`${'mask'}${any}`, any>;
|
|
89
82
|
|
|
90
83
|
export type BrushFilterInteraction = {
|
|
91
84
|
type?: 'brushFilter';
|
|
92
85
|
reverse?: boolean;
|
|
93
|
-
} & Record<`${'mask'
|
|
86
|
+
} & Record<`${'mask'}${any}`, any>;
|
|
94
87
|
|
|
95
88
|
export type BrushXFilterInteraction = {
|
|
96
89
|
type?: 'brushXFilter';
|
|
97
90
|
reverse?: boolean;
|
|
98
|
-
} & Record<`${'mask'
|
|
91
|
+
} & Record<`${'mask'}${any}`, any>;
|
|
99
92
|
|
|
100
93
|
export type BrushYFilterInteraction = {
|
|
101
94
|
type?: 'brushYFilter';
|
|
102
95
|
reverse?: boolean;
|
|
103
|
-
} & Record<`${'mask'
|
|
104
|
-
|
|
105
|
-
export type BrushVisibleInteraction = {
|
|
106
|
-
type?: 'brushVisible';
|
|
107
|
-
brushType?: 'rect' | 'rectX' | 'rectY' | 'polygon';
|
|
108
|
-
};
|
|
96
|
+
} & Record<`${'mask'}${any}`, any>;
|
|
109
97
|
|
|
110
98
|
export type ElementHighlightInteraction = {
|
|
111
99
|
type?: 'elementHighlight';
|
|
@@ -113,41 +101,35 @@ export type ElementHighlightInteraction = {
|
|
|
113
101
|
link?: boolean;
|
|
114
102
|
background?: boolean;
|
|
115
103
|
offset?: number;
|
|
116
|
-
} & Record
|
|
117
|
-
`${'link' | 'highlighted' | 'unhighlighted' | 'background'}${any}`,
|
|
118
|
-
any
|
|
119
|
-
>;
|
|
104
|
+
} & Record<`${'link' | 'background'}${any}`, any>;
|
|
120
105
|
|
|
121
106
|
export type ElementSelectInteraction = {
|
|
122
107
|
type?: 'elementSelect';
|
|
123
108
|
single?: boolean;
|
|
124
|
-
background?:
|
|
109
|
+
background?: boolean;
|
|
125
110
|
offset?: number;
|
|
126
|
-
} & Record<`${'
|
|
111
|
+
} & Record<`${'link' | 'background'}${any}`, any>;
|
|
127
112
|
|
|
128
113
|
export type ElementSelectByColorInteraction = {
|
|
129
114
|
type?: 'elementSelectByColor';
|
|
130
115
|
single?: boolean;
|
|
131
116
|
offset?: number;
|
|
132
|
-
|
|
117
|
+
background?: boolean;
|
|
118
|
+
} & Record<`${'link' | 'background'}${any}`, any>;
|
|
133
119
|
|
|
134
120
|
export type ElementSelectByXInteraction = {
|
|
135
121
|
type?: 'elementSelectByX';
|
|
136
122
|
single?: boolean;
|
|
137
|
-
background?:
|
|
123
|
+
background?: boolean;
|
|
138
124
|
offset?: number;
|
|
139
|
-
} & Record<`${'
|
|
125
|
+
} & Record<`${'link' | 'background'}${any}`, any>;
|
|
140
126
|
|
|
141
127
|
export type ElementHighlightByXInteraction = {
|
|
142
128
|
type?: 'elementHighlightByX';
|
|
143
|
-
x?: string;
|
|
144
129
|
link?: boolean;
|
|
145
130
|
background?: boolean;
|
|
146
131
|
offset?: number;
|
|
147
|
-
} & Record
|
|
148
|
-
`${'link' | 'highlighted' | 'unhighlighted' | 'background'}${any}`,
|
|
149
|
-
any
|
|
150
|
-
>;
|
|
132
|
+
} & Record<`${'link' | 'background'}${any}`, any>;
|
|
151
133
|
|
|
152
134
|
export type ElementHighlightByColorInteraction = {
|
|
153
135
|
type?: 'elementHighlightByColor';
|
|
@@ -155,10 +137,7 @@ export type ElementHighlightByColorInteraction = {
|
|
|
155
137
|
background?: boolean;
|
|
156
138
|
link?: boolean;
|
|
157
139
|
offset?: number;
|
|
158
|
-
} & Record
|
|
159
|
-
`${'link' | 'highlighted' | 'unhighlighted' | 'background'}${any}`,
|
|
160
|
-
any
|
|
161
|
-
>;
|
|
140
|
+
} & Record<`${'link' | 'background'}${any}`, any>;
|
|
162
141
|
|
|
163
142
|
export type PoptipInteraction = {
|
|
164
143
|
type?: 'poptip';
|
|
@@ -168,14 +147,11 @@ export type PoptipInteraction = {
|
|
|
168
147
|
|
|
169
148
|
export type LegendFilterInteraction = {
|
|
170
149
|
type?: 'legendFilter';
|
|
171
|
-
|
|
172
|
-
[key: string]: any; // @todo
|
|
173
|
-
} & Record<`${'marker' | 'label'}Unselected${any}`, any>;
|
|
150
|
+
};
|
|
174
151
|
|
|
175
152
|
export type LegendHighlightInteraction = {
|
|
176
153
|
type?: 'legendHighlight';
|
|
177
|
-
|
|
178
|
-
} & Record<`${'marker' | 'label'}Unhighlighted${any}`, any>;
|
|
154
|
+
};
|
|
179
155
|
|
|
180
156
|
export type ChartIndexInteraction = {
|
|
181
157
|
type?: 'chartIndex';
|
|
@@ -25,11 +25,15 @@ export const MaybeTitle: TC<MaybeTitleOptions> = (options = {}) => {
|
|
|
25
25
|
.filter(([T]) => T)
|
|
26
26
|
.map((d) => d[0]);
|
|
27
27
|
if (titles.length === 0) return [I, mark];
|
|
28
|
+
const T = [];
|
|
29
|
+
for (const i of I) {
|
|
30
|
+
T[i] = { value: titles.map((t) => t[i]).join(', ') };
|
|
31
|
+
}
|
|
28
32
|
return [
|
|
29
33
|
I,
|
|
30
34
|
deepMix({}, mark, {
|
|
31
35
|
tooltip: {
|
|
32
|
-
title:
|
|
36
|
+
title: T,
|
|
33
37
|
},
|
|
34
38
|
}),
|
|
35
39
|
];
|