Skip to content

Commit 08e59b1

Browse files
authored
Merge bc4cf2e into 1c2073d
2 parents 1c2073d + bc4cf2e commit 08e59b1

File tree

4 files changed

+14
-4
lines changed

4 files changed

+14
-4
lines changed

packages/plots/CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## 2.1.11
2+
3+
`2024-01-12`
4+
5+
- 🐞 修复 tooltip 抖动
6+
17
## 2.1.10
28
## 2.1.9
39

packages/plots/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@ant-design/plots",
3-
"version": "2.1.10",
3+
"version": "2.1.11",
44
"description": "G2Plot Statistical chart",
55
"bugs": {
66
"url": "https://github.com/ant-design/ant-design-charts/issues"

packages/plots/src/hooks/useChart.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,9 @@ export default function useChart<T extends Chart, U extends CommonConfig>(ChartC
5050
let isTooltip = flag;
5151
keys.forEach((key) => {
5252
const current = cfg[key];
53-
isTooltip = key === 'tooltip';
53+
if (key === 'tooltip') {
54+
isTooltip = true;
55+
}
5456
if (isFunction(current) && isValidElement(`${current}`)) {
5557
cfg[key] = (...arg) => createNode(current(...arg), isTooltip);
5658
} else {
@@ -60,6 +62,8 @@ export default function useChart<T extends Chart, U extends CommonConfig>(ChartC
6062
});
6163
} else if (isObject(current)) {
6264
processConfig(current, isTooltip);
65+
} else {
66+
isTooltip = flag;
6367
}
6468
}
6569
});

site/examples/statistics/bar/demo/background.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ const DemoBar = () => {
3232
},
3333
markBackground: {
3434
label: {
35-
text: (d) => {
36-
return `${(d.value / 1000) * 100}% | ${d.value}`;
35+
text: ({ originData }) => {
36+
return `${(originData.value / 1000) * 100}% | ${originData.value}`;
3737
},
3838
position: 'right',
3939
dx: 80,

0 commit comments

Comments
 (0)