antvis/G2

The issue has been closed
changeData更新数据tooltip会消失 #5883
demolhy posted onGitHub
问题描述
需要重新移动鼠标才会显示,而且偶尔会跑到左下角去再回来
chart
.line()
.axis('x', {
label: null,
title: null,
tickFilter: false,
tick: false,
line: false,
grid: true,
gridFilter: (_: any, index: number) => {
return index % 10 === 0;
},
})
.axis('y', {
labelFormatter: (val: string) => {
return `${val}%`;
},
line: true,
lineExtension: [0, 0],
lineStroke: '#EEEEEE',
})
.scale('y', { zero: true, type: 'linear', domain: [0, 100] })
.encode('x', 'time')
.encode('y', 'value')
.encode('shape', 'smooth')
.animate(false)
.encode('color', 'group')
.scale('color', {
range: ['#00baa4', '#0090f8', '#f97316'],
independent: true,
})
.interaction('tooltip', {
render: (_: unknown, { title, items }: never) => tooltipRender(title, items),
})
.tooltip(
(
d, // 每一个数据项
) => {
return {
value: d.value + '%',
};
},
)
.style('strokeWidth', 1)
重现链接
No response
重现步骤
No response
预期行为
实时显示更新的tooltip数据,tooltip不消失
平台
- 操作系统: [macOS, Windows, Linux, React Native ...]
- 网页浏览器: [Google Chrome, Safari, Firefox]
屏幕截图或视频(可选)
https://github.com/antvis/G2/assets/39995045/bda5caaf-671e-46fb-a2c2-5868645c3304
补充说明(可选)
No response