@antv/g2 5.4.6 → 5.4.8
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/README.md +3 -0
- package/README.zh-CN.md +3 -0
- package/dist/g2.lite.min.js +13 -62
- package/dist/g2.min.js +13 -62
- package/esm/component/legendCategory.js +1 -1
- package/esm/component/legendCategory.js.map +1 -1
- package/esm/component/utils.js +4 -2
- package/esm/component/utils.js.map +1 -1
- package/esm/interaction/elementHoverScale.d.ts +2 -3
- package/esm/interaction/elementHoverScale.js +40 -50
- package/esm/interaction/elementHoverScale.js.map +1 -1
- package/esm/interaction/scrollbarFilter.js +4 -1
- package/esm/interaction/scrollbarFilter.js.map +1 -1
- package/esm/interaction/tooltip.js +11 -7
- package/esm/interaction/tooltip.js.map +1 -1
- package/esm/mark/beeswarm.js +1 -1
- package/esm/mark/beeswarm.js.map +1 -1
- package/esm/runtime/component.js +70 -7
- package/esm/runtime/component.js.map +1 -1
- package/esm/shape/interval/funnel.d.ts +1 -1
- package/esm/shape/interval/funnel.js +90 -5
- package/esm/shape/interval/funnel.js.map +1 -1
- package/esm/shape/interval/pyramid.js +23 -1
- package/esm/shape/interval/pyramid.js.map +1 -1
- package/esm/spec/interaction.d.ts +0 -1
- package/esm/transform/filter.js +4 -2
- package/esm/transform/filter.js.map +1 -1
- package/esm/transform/symmetryY.js +2 -1
- package/esm/transform/symmetryY.js.map +1 -1
- package/lib/component/legendCategory.js +1 -1
- package/lib/component/legendCategory.js.map +1 -1
- package/lib/component/utils.js +4 -2
- package/lib/component/utils.js.map +1 -1
- package/lib/interaction/elementHoverScale.d.ts +2 -3
- package/lib/interaction/elementHoverScale.js +40 -50
- package/lib/interaction/elementHoverScale.js.map +1 -1
- package/lib/interaction/scrollbarFilter.js +4 -1
- package/lib/interaction/scrollbarFilter.js.map +1 -1
- package/lib/interaction/tooltip.js +10 -6
- package/lib/interaction/tooltip.js.map +1 -1
- package/lib/mark/beeswarm.js +1 -1
- package/lib/mark/beeswarm.js.map +1 -1
- package/lib/runtime/component.js +70 -7
- package/lib/runtime/component.js.map +1 -1
- package/lib/shape/interval/funnel.d.ts +1 -1
- package/lib/shape/interval/funnel.js +90 -5
- package/lib/shape/interval/funnel.js.map +1 -1
- package/lib/shape/interval/pyramid.js +23 -1
- package/lib/shape/interval/pyramid.js.map +1 -1
- package/lib/spec/interaction.d.ts +0 -1
- package/lib/transform/filter.js +4 -2
- package/lib/transform/filter.js.map +1 -1
- package/lib/transform/symmetryY.js +2 -1
- package/lib/transform/symmetryY.js.map +1 -1
- package/package.json +1 -2
- package/src/component/legendCategory.ts +4 -1
- package/src/component/utils.ts +4 -2
- package/src/interaction/elementHoverScale.ts +38 -47
- package/src/interaction/scrollbarFilter.ts +3 -0
- package/src/interaction/tooltip.ts +15 -7
- package/src/mark/beeswarm.ts +1 -1
- package/src/runtime/component.ts +83 -8
- package/src/shape/interval/funnel.ts +137 -5
- package/src/shape/interval/pyramid.ts +31 -0
- package/src/spec/interaction.ts +0 -1
- package/src/transform/filter.ts +6 -2
- package/src/transform/symmetryY.ts +6 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"funnel.js","sourceRoot":"","sources":["../../../src/shape/interval/funnel.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,oDAAgE;AAEhE,uDAAqD;AAErD,qDAA+C;AAC/C,oCAA+C;
|
|
1
|
+
{"version":3,"file":"funnel.js","sourceRoot":"","sources":["../../../src/shape/interval/funnel.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,oDAAgE;AAEhE,uDAAqD;AAErD,qDAA+C;AAC/C,oCAA+C;AAa/C;;GAEG;AACH,SAAS,eAAe,CACtB,MAAiB,EACjB,UAAqB,EACrB,cAAyB,EACzB,UAAsB,EACtB,OAAgB;IAEhB,MAAM,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,GAAG,MAAM,CAAC;IAChC,IAAI,IAAA,wBAAW,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7B,IAAI,CAAC,kBAAU,EAAE,KAAK,CAAC;aACvB,IAAI,EAAE,CAAC;IACZ,CAAC,CAAC;AACJ,CAAC,CAAC;AAtDW,QAAA,MAAM,UAsDjB;AAEF,cAAM,CAAC,KAAK,GAAG;IACb,aAAa,EAAE,QAAQ;CACxB,CAAC"}
|
|
@@ -6,9 +6,20 @@ const funnel_1 = require("./funnel");
|
|
|
6
6
|
/**
|
|
7
7
|
* Adjust and return the new `points`.
|
|
8
8
|
*/
|
|
9
|
-
function getPyramidPoints(points, nextPoints, coordinate) {
|
|
9
|
+
function getPyramidPoints(points, nextPoints, previousPoints, coordinate, reverse) {
|
|
10
10
|
const [p0, p1, p2, p3] = points;
|
|
11
11
|
if ((0, coordinate_1.isTranspose)(coordinate)) {
|
|
12
|
+
if (reverse) {
|
|
13
|
+
const newP0 = [
|
|
14
|
+
previousPoints ? previousPoints[1][0] : (p0[0] + p3[0]) / 2,
|
|
15
|
+
p0[1],
|
|
16
|
+
];
|
|
17
|
+
const newP3 = [
|
|
18
|
+
previousPoints ? previousPoints[2][0] : (p0[0] + p3[0]) / 2,
|
|
19
|
+
p3[1],
|
|
20
|
+
];
|
|
21
|
+
return [newP0, p1, p2, newP3];
|
|
22
|
+
}
|
|
12
23
|
const newP1 = [
|
|
13
24
|
nextPoints ? nextPoints[0][0] : (p1[0] + p2[0]) / 2,
|
|
14
25
|
p1[1],
|
|
@@ -19,6 +30,17 @@ function getPyramidPoints(points, nextPoints, coordinate) {
|
|
|
19
30
|
];
|
|
20
31
|
return [p0, newP1, newP2, p3];
|
|
21
32
|
}
|
|
33
|
+
if (reverse) {
|
|
34
|
+
const newP0 = [
|
|
35
|
+
p0[0],
|
|
36
|
+
previousPoints ? previousPoints[1][1] : (p0[1] + p3[1]) / 2,
|
|
37
|
+
];
|
|
38
|
+
const newP3 = [
|
|
39
|
+
p3[0],
|
|
40
|
+
previousPoints ? previousPoints[2][1] : (p0[1] + p3[1]) / 2,
|
|
41
|
+
];
|
|
42
|
+
return [newP0, p1, p2, newP3];
|
|
43
|
+
}
|
|
22
44
|
const newP1 = [
|
|
23
45
|
p1[0],
|
|
24
46
|
nextPoints ? nextPoints[0][1] : (p1[1] + p2[1]) / 2,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pyramid.js","sourceRoot":"","sources":["../../../src/shape/interval/pyramid.ts"],"names":[],"mappings":";;;AACA,uDAAqD;AAErD,qCAAkC;AAIlC;;GAEG;AACH,SAAS,gBAAgB,CACvB,MAAiB,EACjB,UAAqB,EACrB,UAAsB;
|
|
1
|
+
{"version":3,"file":"pyramid.js","sourceRoot":"","sources":["../../../src/shape/interval/pyramid.ts"],"names":[],"mappings":";;;AACA,uDAAqD;AAErD,qCAAkC;AAIlC;;GAEG;AACH,SAAS,gBAAgB,CACvB,MAAiB,EACjB,UAAqB,EACrB,cAAyB,EACzB,UAAsB,EACtB,OAAgB;IAEhB,MAAM,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,GAAG,MAAM,CAAC;IAEhC,IAAI,IAAA,wBAAW,EAAC,UAAU,CAAC,EAAE,CAAC;QAC5B,IAAI,OAAO,EAAE,CAAC;YACZ,MAAM,KAAK,GAAY;gBACrB,cAAc,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;gBAC3D,EAAE,CAAC,CAAC,CAAC;aACN,CAAC;YAEF,MAAM,KAAK,GAAY;gBACrB,cAAc,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;gBAC3D,EAAE,CAAC,CAAC,CAAC;aACN,CAAC;YAEF,OAAO,CAAC,KAA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,CAAC,CAAC;QACL,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;KACpD,CAAC;IACF,MAAM,KAAK,GAAY;QACrB,EAAE,CAAC,CAAC,CAAC;QACL,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;KACpD,CAAC;IACF,OAAO,CAAC,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC;AAChC,CAAC;AAED;;GAEG;AACI,MAAM,OAAO,GAAuB,CAAC,OAAO,EAAE,OAAO,EAAE,EAAE;IAC9D,OAAO,IAAA,eAAM,kBAAG,YAAY,EAAE,gBAAgB,IAAK,OAAO,GAAI,OAAO,CAAC,CAAC;AACzE,CAAC,CAAC;AAFW,QAAA,OAAO,WAElB;AAEF,eAAO,CAAC,KAAK,GAAG;IACd,aAAa,EAAE,QAAQ;CACxB,CAAC"}
|
package/lib/transform/filter.js
CHANGED
|
@@ -37,6 +37,7 @@ function filterWhenNoElements(mark) {
|
|
|
37
37
|
const Filter = (options = {}) => {
|
|
38
38
|
return (I, mark) => {
|
|
39
39
|
const { encode, data } = mark;
|
|
40
|
+
const hasChannelOptions = Object.keys(options).length > 0;
|
|
40
41
|
const filters = Object.entries(options)
|
|
41
42
|
.map(([key, v]) => {
|
|
42
43
|
const [V] = (0, helper_2.columnOf)(encode, key);
|
|
@@ -63,9 +64,10 @@ const Filter = (options = {}) => {
|
|
|
63
64
|
const totalFilter = (i) => filters.every((f) => f(i));
|
|
64
65
|
const FI = I.filter(totalFilter);
|
|
65
66
|
const newIndex = FI.map((_, i) => i);
|
|
66
|
-
if (filters.length === 0) {
|
|
67
|
+
if (filters.length === 0 && hasChannelOptions) {
|
|
67
68
|
const targetMark = filterWhenNoElements(mark);
|
|
68
|
-
|
|
69
|
+
// Return empty index array to ensure no elements are rendered
|
|
70
|
+
return [[], targetMark];
|
|
69
71
|
}
|
|
70
72
|
const newEncodes = Object.entries(encode).map(([key, encode]) => {
|
|
71
73
|
return [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filter.js","sourceRoot":"","sources":["../../src/transform/filter.ts"],"names":[],"mappings":";;;AAAA,qCAAqC;AAGrC,4CAA0C;AAC1C,2CAA0C;AAI1C,SAAS,cAAc,CAAC,KAAK;IAC3B,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;;QAC9D,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;AAC5B,CAAC;AAED,SAAS,oBAAoB,CAAC,IAAY;;IACxC,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;IAExB,cAAc;IACd,MAAM,aAAa,mCACd,IAAI,KACP,MAAM,kCACD,IAAI,CAAC,MAAM,KACd,CAAC,kCACI,IAAI,CAAC,MAAM,CAAC,CAAC,KAChB,KAAK,EAAE,EAAE,SAGd,CAAC;IAEF,MAAM,WAAW,GAAG,MAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,KAAK,0CAAE,KAAK,CAAC;IACzC,IAAI,CAAC,MAAM,IAAI,CAAC,WAAW,EAAE,CAAC;QAC5B,OAAO,aAAa,CAAC;IACvB,CAAC;IAED,cAAc;IACd,IAAI,YAAY,CAAC;IAEjB,KAAK,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;QAC9C,IAAI,CAAC,GAAG,KAAK,GAAG,IAAI,GAAG,KAAK,GAAG,CAAC,IAAI,CAAC,CAAC,KAA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,CAAC;QAED,MAAM,UAAU,GAAG,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,MAAM,CAAC,EAAE,EAAE;YAC9D,OAAO;gBACL,GAAG;gDAEE,MAAM,KACT,KAAK,EAAE,QAAQ;yBACZ,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;yBAC/B,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,SAAS,CAAC;aAEpC,CAAC;QACJ,CAAC,CAAC,CAAC;QACH,OAAO;YACL,QAAQ;YACR,IAAA,cAAO,EAAC,EAAE,EAAE,IAAI,EAAE;gBAChB,MAAM,EAAE,MAAM,CAAC,WAAW,CAAC,UAAU,CAAC;gBACtC,gCAAgC;gBAChC,IAAI,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;aAC7B,CAAC;SACH,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC,CAAC;AAvDW,QAAA,MAAM,UAuDjB;AAEF,cAAM,CAAC,KAAK,GAAG,EAAE,CAAC"}
|
|
@@ -23,7 +23,7 @@ const order_1 = require("./utils/order");
|
|
|
23
23
|
const SymmetryY = (options = {}) => {
|
|
24
24
|
const { groupBy = 'x' } = options;
|
|
25
25
|
return (I, mark) => {
|
|
26
|
-
const { encode } = mark;
|
|
26
|
+
const { encode, style = {} } = mark;
|
|
27
27
|
const { x } = encode, rest = __rest(encode, ["x"]);
|
|
28
28
|
// Extract and create new channels starts with y, such as y, y1.
|
|
29
29
|
const Yn = Object.entries(rest)
|
|
@@ -55,6 +55,7 @@ const SymmetryY = (options = {}) => {
|
|
|
55
55
|
I,
|
|
56
56
|
(0, util_1.deepMix)({}, mark, {
|
|
57
57
|
encode: Object.fromEntries(newYn.map(([k, v]) => [k, (0, helper_1.column)(v, (0, helper_1.columnOf)(encode, k)[1])])),
|
|
58
|
+
style: Object.assign({ first: (_, i) => i === 0, last: (_, i) => i === groups.length - 1 }, style),
|
|
58
59
|
}),
|
|
59
60
|
];
|
|
60
61
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"symmetryY.js","sourceRoot":"","sources":["../../src/transform/symmetryY.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,qCAAqC;AACrC,oDAA+C;AAG/C,2CAAkD;AAClD,yCAA6C;AAI7C;;;GAGG;AACI,MAAM,SAAS,GAAyB,CAAC,OAAO,GAAG,EAAE,EAAE,EAAE;IAC9D,MAAM,EAAE,OAAO,GAAG,GAAG,EAAE,GAAG,OAAO,CAAC;IAClC,OAAO,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE;QACjB,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"symmetryY.js","sourceRoot":"","sources":["../../src/transform/symmetryY.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,qCAAqC;AACrC,oDAA+C;AAG/C,2CAAkD;AAClD,yCAA6C;AAI7C;;;GAGG;AACI,MAAM,SAAS,GAAyB,CAAC,OAAO,GAAG,EAAE,EAAE,EAAE;IAC9D,MAAM,EAAE,OAAO,GAAG,GAAG,EAAE,GAAG,OAAO,CAAC;IAClC,OAAO,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE;QACjB,MAAM,EAAE,MAAM,EAAE,KAAK,GAAG,EAAE,EAAE,GAAG,IAAI,CAAC;QACpC,MAAM,EAAE,CAAC,KAAc,MAAM,EAAf,IAAI,UAAK,MAAM,EAAvB,KAAc,CAAS,CAAC;QAE9B,gEAAgE;QAChE,MAAM,EAAE,GAAG,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC;aAC5B,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,CAA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 -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antv/g2",
|
|
3
|
-
"version": "5.4.
|
|
3
|
+
"version": "5.4.8",
|
|
4
4
|
"description": "the Grammar of Graphics in Javascript",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -52,7 +52,6 @@
|
|
|
52
52
|
"build": "run-p build:*",
|
|
53
53
|
"bundle-vis": "cross-env BUNDLE_VIS=1 run-p build:umd",
|
|
54
54
|
"ci": "run-s lint test build",
|
|
55
|
-
"prepublishOnly": "npm run ci",
|
|
56
55
|
"prepare": "husky install",
|
|
57
56
|
"upload": "node scripts/upload/snapshot.js",
|
|
58
57
|
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s",
|
|
@@ -225,7 +225,10 @@ function inferLegendShape(
|
|
|
225
225
|
function filterEmptyIds(legendStyle) {
|
|
226
226
|
return {
|
|
227
227
|
...legendStyle,
|
|
228
|
-
data:
|
|
228
|
+
data:
|
|
229
|
+
legendStyle?.data.filter(
|
|
230
|
+
(item) => item.id !== '' && item.id !== undefined,
|
|
231
|
+
) || [],
|
|
229
232
|
};
|
|
230
233
|
}
|
|
231
234
|
|
package/src/component/utils.ts
CHANGED
|
@@ -88,17 +88,19 @@ export class G2Layout extends Layout {
|
|
|
88
88
|
}
|
|
89
89
|
|
|
90
90
|
update(options: any) {
|
|
91
|
-
this.attr(options);
|
|
92
91
|
const { subOptions } = options;
|
|
92
|
+
// Update child first so that layout calculation uses updated child dimensions
|
|
93
93
|
this.child?.update(subOptions);
|
|
94
|
+
this.attr(options);
|
|
94
95
|
}
|
|
95
96
|
}
|
|
96
97
|
|
|
97
98
|
export class LegendCategoryLayout extends G2Layout {
|
|
98
99
|
update(options: any) {
|
|
99
100
|
const { subOptions } = options;
|
|
100
|
-
|
|
101
|
+
// Update child first so that layout calculation uses updated child dimensions
|
|
101
102
|
this.child?.update(subOptions);
|
|
103
|
+
this.attr(options);
|
|
102
104
|
}
|
|
103
105
|
}
|
|
104
106
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { DisplayObject } from '@antv/g';
|
|
2
2
|
import { deepMix } from '@antv/util';
|
|
3
3
|
import { group } from '@antv/vendor/d3-array';
|
|
4
|
+
import { isPolar } from '../utils/coordinate';
|
|
4
5
|
import {
|
|
5
6
|
createDatumof,
|
|
6
7
|
createUseState,
|
|
@@ -21,7 +22,6 @@ export function elementHoverScale(
|
|
|
21
22
|
datum,
|
|
22
23
|
groupKey = (element) => element,
|
|
23
24
|
scaleFactor = 1.04,
|
|
24
|
-
scaleOrigin = 'center center',
|
|
25
25
|
shadow = true,
|
|
26
26
|
shadowColor = 'rgba(0, 0, 0, 0.4)',
|
|
27
27
|
shadowBlur = 10,
|
|
@@ -31,6 +31,7 @@ export function elementHoverScale(
|
|
|
31
31
|
delay = 60,
|
|
32
32
|
emitter,
|
|
33
33
|
state = {},
|
|
34
|
+
coordinate,
|
|
34
35
|
}: Record<string, any>,
|
|
35
36
|
) {
|
|
36
37
|
// Helper function to get current valid elements
|
|
@@ -49,17 +50,19 @@ export function elementHoverScale(
|
|
|
49
50
|
const { updateState, removeState, hasState } = useState(valueof);
|
|
50
51
|
|
|
51
52
|
const originalStyles = new Map<DisplayObject, Record<string, any>>();
|
|
52
|
-
const hoveredElements = new Set<DisplayObject>();
|
|
53
53
|
|
|
54
54
|
let out;
|
|
55
55
|
|
|
56
56
|
const applyHoverEffect = (element: DisplayObject) => {
|
|
57
|
-
if (
|
|
57
|
+
if (originalStyles.has(element)) return;
|
|
58
58
|
|
|
59
|
-
// Capture current state before applying effect
|
|
60
59
|
const currentTransform = element.style.transform || '';
|
|
61
60
|
const currentTransformOrigin = element.style.transformOrigin || '';
|
|
61
|
+
// Normalize 'none' to empty string as 'none' is not a valid transform value for concatenation
|
|
62
|
+
const normalizedTransform =
|
|
63
|
+
currentTransform === 'none' ? '' : currentTransform;
|
|
62
64
|
|
|
65
|
+
// Save original styles for restoration
|
|
63
66
|
originalStyles.set(element, {
|
|
64
67
|
transform: currentTransform,
|
|
65
68
|
transformOrigin: currentTransformOrigin,
|
|
@@ -70,26 +73,21 @@ export function elementHoverScale(
|
|
|
70
73
|
shadowOffsetY: element.style.shadowOffsetY || 0,
|
|
71
74
|
});
|
|
72
75
|
|
|
73
|
-
//
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
let newTransform: string;
|
|
80
|
-
if (prefix && !prefix.includes('scale')) {
|
|
81
|
-
newTransform = `${prefix} ${scaleTransform}`.trimStart();
|
|
82
|
-
} else if (prefix && prefix.includes('scale')) {
|
|
83
|
-
newTransform = prefix
|
|
84
|
-
.replace(/scale\([^)]+\)/g, scaleTransform)
|
|
85
|
-
.trimStart();
|
|
86
|
-
} else {
|
|
87
|
-
newTransform = scaleTransform;
|
|
76
|
+
// For polar coordinates without transform, set transformOrigin to coordinate center
|
|
77
|
+
// When legend filtering occurs, element positioning changes from translate to absolute path coords
|
|
78
|
+
// Setting transformOrigin to center ensures consistent radial growth in both cases
|
|
79
|
+
if (coordinate && isPolar(coordinate) && !normalizedTransform) {
|
|
80
|
+
const center = coordinate.getCenter() as [number, number];
|
|
81
|
+
element.style.transformOrigin = `${center[0]}px ${center[1]}px`;
|
|
88
82
|
}
|
|
89
83
|
|
|
90
|
-
// Apply
|
|
91
|
-
|
|
92
|
-
element.style.transform =
|
|
84
|
+
// Apply scale transform
|
|
85
|
+
const scaleTransform = `scale(${scaleFactor})`;
|
|
86
|
+
element.style.transform = normalizedTransform
|
|
87
|
+
? `${normalizedTransform} ${scaleTransform}`
|
|
88
|
+
: scaleTransform;
|
|
89
|
+
|
|
90
|
+
// Apply visual effects
|
|
93
91
|
element.style.zIndex = zIndex;
|
|
94
92
|
|
|
95
93
|
if (shadow) {
|
|
@@ -98,8 +96,6 @@ export function elementHoverScale(
|
|
|
98
96
|
element.style.shadowOffsetX = shadowOffsetX;
|
|
99
97
|
element.style.shadowOffsetY = shadowOffsetY;
|
|
100
98
|
}
|
|
101
|
-
|
|
102
|
-
hoveredElements.add(element);
|
|
103
99
|
};
|
|
104
100
|
|
|
105
101
|
const removeHoverEffect = (element: DisplayObject) => {
|
|
@@ -115,7 +111,6 @@ export function elementHoverScale(
|
|
|
115
111
|
element.style.shadowOffsetX = original.shadowOffsetX;
|
|
116
112
|
element.style.shadowOffsetY = original.shadowOffsetY;
|
|
117
113
|
|
|
118
|
-
hoveredElements.delete(element);
|
|
119
114
|
originalStyles.delete(element);
|
|
120
115
|
};
|
|
121
116
|
|
|
@@ -131,25 +126,25 @@ export function elementHoverScale(
|
|
|
131
126
|
if (out) clearTimeout(out);
|
|
132
127
|
|
|
133
128
|
const currentKeyGroup = group(validElements, groupKey);
|
|
134
|
-
const
|
|
135
|
-
const currentGroup = currentKeyGroup.get(
|
|
129
|
+
const currentKey = groupKey(element);
|
|
130
|
+
const currentGroup = currentKeyGroup.get(currentKey);
|
|
136
131
|
|
|
137
132
|
if (!currentGroup) return;
|
|
138
133
|
|
|
139
134
|
const groupSet = new Set(currentGroup);
|
|
140
135
|
|
|
141
136
|
// Remove hover effects from elements not in current group
|
|
142
|
-
for (const
|
|
143
|
-
if (!groupSet.has(
|
|
144
|
-
removeState(
|
|
145
|
-
removeHoverEffect(
|
|
137
|
+
for (const element of validElements) {
|
|
138
|
+
if (!groupSet.has(element)) {
|
|
139
|
+
removeState(element, 'active');
|
|
140
|
+
removeHoverEffect(element);
|
|
146
141
|
}
|
|
147
142
|
}
|
|
148
143
|
|
|
149
144
|
// Apply hover effects to current group
|
|
150
|
-
for (const
|
|
151
|
-
if (!hasState(
|
|
152
|
-
applyHoverEffect(
|
|
145
|
+
for (const element of currentGroup) {
|
|
146
|
+
if (!hasState(element, 'active')) updateState(element, 'active');
|
|
147
|
+
applyHoverEffect(element as DisplayObject);
|
|
153
148
|
}
|
|
154
149
|
|
|
155
150
|
// Emit events
|
|
@@ -175,21 +170,18 @@ export function elementHoverScale(
|
|
|
175
170
|
const validElements = getCurrentElements();
|
|
176
171
|
|
|
177
172
|
// Remove hover effects and states from all valid elements
|
|
178
|
-
for (const
|
|
179
|
-
removeState(
|
|
180
|
-
removeHoverEffect(
|
|
173
|
+
for (const element of validElements) {
|
|
174
|
+
removeState(element, 'active');
|
|
175
|
+
removeHoverEffect(element);
|
|
181
176
|
}
|
|
182
177
|
|
|
183
|
-
hoveredElements.clear();
|
|
184
|
-
|
|
185
178
|
if (nativeEvent) {
|
|
186
179
|
emitter.emit('element:unhoverscale', { nativeEvent });
|
|
187
180
|
}
|
|
188
181
|
};
|
|
189
182
|
|
|
190
|
-
const pointerout = (
|
|
191
|
-
|
|
192
|
-
else reset();
|
|
183
|
+
const pointerout = () => {
|
|
184
|
+
delay > 0 ? delayReset() : reset();
|
|
193
185
|
};
|
|
194
186
|
|
|
195
187
|
const pointerleave = () => {
|
|
@@ -232,11 +224,10 @@ export function elementHoverScale(
|
|
|
232
224
|
|
|
233
225
|
// Clean up all hover effects from current elements
|
|
234
226
|
const validElements = getCurrentElements();
|
|
235
|
-
for (const
|
|
236
|
-
removeHoverEffect(
|
|
227
|
+
for (const element of validElements) {
|
|
228
|
+
removeHoverEffect(element);
|
|
237
229
|
}
|
|
238
230
|
originalStyles.clear();
|
|
239
|
-
hoveredElements.clear();
|
|
240
231
|
};
|
|
241
232
|
}
|
|
242
233
|
|
|
@@ -244,7 +235,6 @@ export function ElementHoverScale({
|
|
|
244
235
|
delay,
|
|
245
236
|
createGroup,
|
|
246
237
|
scale: scaleFactorParam,
|
|
247
|
-
scaleOrigin,
|
|
248
238
|
shadow,
|
|
249
239
|
shadowColor,
|
|
250
240
|
shadowBlur,
|
|
@@ -257,6 +247,7 @@ export function ElementHoverScale({
|
|
|
257
247
|
const { container, view, options } = context;
|
|
258
248
|
const plotArea = selectPlotArea(container);
|
|
259
249
|
const datumof = createDatumof(view);
|
|
250
|
+
const { coordinate } = view;
|
|
260
251
|
|
|
261
252
|
return elementHoverScale(plotArea, {
|
|
262
253
|
elements: selectG2Elements,
|
|
@@ -266,7 +257,6 @@ export function ElementHoverScale({
|
|
|
266
257
|
: undefined,
|
|
267
258
|
state: mergeState(options, ['active']),
|
|
268
259
|
scaleFactor: scaleFactorParam,
|
|
269
|
-
scaleOrigin,
|
|
270
260
|
shadow,
|
|
271
261
|
shadowColor,
|
|
272
262
|
shadowBlur,
|
|
@@ -275,6 +265,7 @@ export function ElementHoverScale({
|
|
|
275
265
|
zIndex,
|
|
276
266
|
delay,
|
|
277
267
|
emitter,
|
|
268
|
+
coordinate,
|
|
278
269
|
...rest,
|
|
279
270
|
});
|
|
280
271
|
};
|
|
@@ -31,6 +31,9 @@ export function ScrollbarFilter(options: any = {}) {
|
|
|
31
31
|
const values = scrollbar.slider.attributes.values;
|
|
32
32
|
if (values[0] !== 0 || values[1] !== 1) return values;
|
|
33
33
|
},
|
|
34
|
+
// Scrollbar should not have adaptive filtering by default
|
|
35
|
+
// Only enable if explicitly set in options
|
|
36
|
+
adaptiveMode: false,
|
|
34
37
|
...options,
|
|
35
38
|
});
|
|
36
39
|
return interaction(context, _, emitter);
|
|
@@ -14,7 +14,11 @@ import { angle, sub, dist } from '../utils/vector';
|
|
|
14
14
|
import { invert } from '../utils/scale';
|
|
15
15
|
import { BBox } from '../runtime';
|
|
16
16
|
import { CALLBACK_ITEM_SYMBOL } from '../runtime/transform';
|
|
17
|
-
import {
|
|
17
|
+
import {
|
|
18
|
+
G2_CLASS_PREFIX,
|
|
19
|
+
g2Selector,
|
|
20
|
+
ANNOTATION_MARKS,
|
|
21
|
+
} from '../component/constant';
|
|
18
22
|
import {
|
|
19
23
|
selectG2Elements,
|
|
20
24
|
createXKey,
|
|
@@ -649,7 +653,10 @@ export function findSingleElement({
|
|
|
649
653
|
shared,
|
|
650
654
|
}): DisplayObject | undefined {
|
|
651
655
|
const inInterval = (d) => d.markType === 'interval';
|
|
652
|
-
const
|
|
656
|
+
const inAnnotation = (d) => ANNOTATION_MARKS.includes(d.markType);
|
|
657
|
+
const markEls = elements.filter((d) => !inAnnotation(d));
|
|
658
|
+
const isBar =
|
|
659
|
+
markEls.length > 0 && markEls.every(inInterval) && !isPolar(coordinate);
|
|
653
660
|
const scaleX = scale.x;
|
|
654
661
|
const isEqualWidth = equalBandWidth(scale);
|
|
655
662
|
const scaleSeries = scale.series;
|
|
@@ -667,7 +674,7 @@ export function findSingleElement({
|
|
|
667
674
|
: (d) => d.__data__.x + bandWidth / 2;
|
|
668
675
|
|
|
669
676
|
// Sort for bisector search.
|
|
670
|
-
if (isBar)
|
|
677
|
+
if (isBar) markEls.sort((a, b) => xof(a) - xof(b));
|
|
671
678
|
const findElementByTarget = (event) => {
|
|
672
679
|
const { target = last(elements) } = event;
|
|
673
680
|
return maybeRoot(target, (node) => {
|
|
@@ -693,13 +700,13 @@ export function findSingleElement({
|
|
|
693
700
|
const [abstractX] = coordinate.invert(mouse);
|
|
694
701
|
const search = bisector(xof).center;
|
|
695
702
|
const i = isEqualWidth
|
|
696
|
-
? search(
|
|
703
|
+
? search(markEls, abstractX)
|
|
697
704
|
: findNearestElementIndex(scaleX, abstractX);
|
|
698
|
-
const target =
|
|
705
|
+
const target = markEls[i];
|
|
699
706
|
|
|
700
707
|
if (!shared) {
|
|
701
708
|
// For grouped bar chart without shared options.
|
|
702
|
-
const isGrouped =
|
|
709
|
+
const isGrouped = markEls.find(
|
|
703
710
|
(d) => d !== target && xof(d) === xof(target),
|
|
704
711
|
);
|
|
705
712
|
if (isGrouped) return findElementByTarget(event) || isGrouped;
|
|
@@ -751,6 +758,7 @@ export function findSeriesElement({
|
|
|
751
758
|
const seriesElements = [];
|
|
752
759
|
const itemElements = [];
|
|
753
760
|
for (const element of elements) {
|
|
761
|
+
if (ANNOTATION_MARKS.includes(element.markType)) continue;
|
|
754
762
|
const { __data__: data } = element;
|
|
755
763
|
const { seriesX, title, items } = data;
|
|
756
764
|
if (seriesX) seriesElements.push(element);
|
|
@@ -783,7 +791,7 @@ export function findSeriesElement({
|
|
|
783
791
|
};
|
|
784
792
|
|
|
785
793
|
// Sort itemElements for bisector search.
|
|
786
|
-
if (isBar)
|
|
794
|
+
if (isBar) itemElements.sort((a, b) => xof(a) - xof(b));
|
|
787
795
|
else {
|
|
788
796
|
itemElements.sort((a, b) => {
|
|
789
797
|
const [minA, maxA] = extent(a);
|
package/src/mark/beeswarm.ts
CHANGED
|
@@ -96,7 +96,7 @@ export const Beeswarm: MC<BeeswarmOptions> = (options) => {
|
|
|
96
96
|
);
|
|
97
97
|
|
|
98
98
|
// 主轴吸附
|
|
99
|
-
sim.force('x', forceX<any>((d) => d.x).strength(0
|
|
99
|
+
sim.force('x', forceX<any>((d) => d.x).strength(0));
|
|
100
100
|
sim.force('y', forceY<any>((d) => d.y).strength(5));
|
|
101
101
|
|
|
102
102
|
for (let i = 0; i < ITERATIONS; i++) sim.tick();
|
package/src/runtime/component.ts
CHANGED
|
@@ -871,19 +871,94 @@ function computeCategoryLegendSize(
|
|
|
871
871
|
? crossSize0 + (isVertical ? 0 : crossPadding[0] + crossPadding[1])
|
|
872
872
|
: length;
|
|
873
873
|
|
|
874
|
+
// Create scale.
|
|
875
|
+
const scale = createScale(component, library);
|
|
876
|
+
|
|
877
|
+
// If render is provided, use HTML to render.
|
|
878
|
+
const { render } = component;
|
|
879
|
+
if (render && typeof document !== 'undefined') {
|
|
880
|
+
const domain = scale.getOptions().domain;
|
|
881
|
+
const { labelFormatter } = rest;
|
|
882
|
+
const formatLabel = (d: any) => {
|
|
883
|
+
if (!labelFormatter) return `${d}`;
|
|
884
|
+
return typeof labelFormatter === 'string'
|
|
885
|
+
? format(labelFormatter)(d)
|
|
886
|
+
: labelFormatter(d);
|
|
887
|
+
};
|
|
888
|
+
|
|
889
|
+
const items = domain.map((d, i) => ({
|
|
890
|
+
id: d,
|
|
891
|
+
index: i,
|
|
892
|
+
label: formatLabel(d),
|
|
893
|
+
value: d,
|
|
894
|
+
color: scale.map(d),
|
|
895
|
+
}));
|
|
896
|
+
|
|
897
|
+
const html = render(items, rest);
|
|
898
|
+
const container = document.createElement('div');
|
|
899
|
+
const { width, height } = component;
|
|
900
|
+
|
|
901
|
+
const style: Partial<CSSStyleDeclaration> = {
|
|
902
|
+
position: 'absolute',
|
|
903
|
+
visibility: 'hidden',
|
|
904
|
+
top: '-9999px',
|
|
905
|
+
};
|
|
906
|
+
|
|
907
|
+
if (width) style.width = `${width}px`;
|
|
908
|
+
else if (!isVertical) style.width = `${crossSize}px`;
|
|
909
|
+
|
|
910
|
+
if (height) style.height = `${height}px`;
|
|
911
|
+
else if (isVertical) style.height = `${crossSize}px`;
|
|
912
|
+
|
|
913
|
+
Object.assign(container.style, style);
|
|
914
|
+
|
|
915
|
+
if (typeof html === 'string') {
|
|
916
|
+
container.innerHTML = html;
|
|
917
|
+
} else if (html instanceof HTMLElement) {
|
|
918
|
+
container.appendChild(html);
|
|
919
|
+
}
|
|
920
|
+
document.body.appendChild(container);
|
|
921
|
+
const bbox = container.getBoundingClientRect();
|
|
922
|
+
document.body.removeChild(container);
|
|
923
|
+
component.size = isVertical ? bbox.width : bbox.height;
|
|
924
|
+
return;
|
|
925
|
+
}
|
|
926
|
+
|
|
874
927
|
// Compute title.
|
|
875
928
|
const titleBBox = computeTitleBBox(rest);
|
|
876
929
|
|
|
877
|
-
const scale = createScale(component, library);
|
|
878
930
|
const labelBBoxes = computeLabelsBBox(rest, scale, 'itemLabel');
|
|
879
931
|
|
|
880
|
-
|
|
881
|
-
const
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
932
|
+
// Compute itemValue sizes if itemValue is configured
|
|
933
|
+
const valueBBoxes =
|
|
934
|
+
rest.itemValueText !== undefined
|
|
935
|
+
? computeLabelsBBox(rest, scale, 'itemValue')
|
|
936
|
+
: null;
|
|
937
|
+
|
|
938
|
+
const height =
|
|
939
|
+
Math.max(
|
|
940
|
+
labelBBoxes[0].height,
|
|
941
|
+
itemMarkerSize,
|
|
942
|
+
// Also consider itemValue height if it exists
|
|
943
|
+
...(valueBBoxes?.[0] ? [valueBBoxes[0].height] : []),
|
|
944
|
+
) + rowPadding;
|
|
945
|
+
|
|
946
|
+
const widthOf = (labelWidth, padding = 0) => {
|
|
947
|
+
// Calculate total width including marker, label, value (if exists), and focus icon
|
|
948
|
+
let totalWidth = itemMarkerSize + labelWidth + itemSpacing[0] + padding;
|
|
949
|
+
|
|
950
|
+
// Add itemValue width if it exists
|
|
951
|
+
if (valueBBoxes?.[0]) {
|
|
952
|
+
totalWidth += valueBBoxes[0].width + itemSpacing[1];
|
|
953
|
+
}
|
|
954
|
+
|
|
955
|
+
// Add focus icon width if focus is enabled
|
|
956
|
+
if (focus) {
|
|
957
|
+
totalWidth += focusMarkerSize + itemSpacing[2];
|
|
958
|
+
}
|
|
959
|
+
|
|
960
|
+
return totalWidth;
|
|
961
|
+
};
|
|
887
962
|
|
|
888
963
|
// Only support grid layout for vertical area.
|
|
889
964
|
const computeVerticalSize = () => {
|