antvis/G2










The issue has been closed
【v5】tooltip share 打开,有时会不共享 #5543
Deathsteps posted onGitHub
问题描述
应该和热区有关(截图看不到光标位置,可自行尝试)
边上一点,就只有柱子的数据 <img width="1140" alt="image" src="https://github.com/antvis/G2/assets/1549118/c8a365a8-77fd-4aad-af0d-330f5741e532">
中间一点,才能有线的数据 <img width="1102" alt="image" src="https://github.com/antvis/G2/assets/1549118/498e012b-37c3-4f00-a613-096712e4f49a">
期望结果
不管鼠标 hover 在图形何处都应该保持工具提示数据共享
如何重现
官方代码修改
import { Chart } from '@antv/g2';
const data = [
{ time: '10:10', call: 4, waiting: 2, people: 2 },
{ time: '10:15', call: 2, waiting: 6, people: 3 },
{ time: '10:20', call: 13, waiting: 2, people: 5 },
{ time: '10:25', call: 9, waiting: 9, people: 1 },
{ time: '10:30', call: 5, waiting: 2, people: 3 },
{ time: '10:35', call: 8, waiting: 2, people: 1 },
{ time: '10:40', call: 13, waiting: 1, people: 2 },
];
const chart = new Chart({
container: 'container',
autoFit: true,
});
chart.data(data);
chart
.interval()
.encode('x', 'time')
.encode('y', 'waiting')
.axis('y', { title: 'Waiting', titleFill: '#5B8FF9' });
chart
.line()
.encode('x', 'time')
.encode('y', 'people')
.encode('shape', 'smooth')
.style('stroke', '#fdae6b')
.style('lineWidth', 2)
.scale('y', { independent: true })
.axis('y', {
position: 'right',
grid: null,
title: 'People',
titleFill: '#fdae6b',
});
chart.interaction('tooltip', { "shared": true });
chart.render();
额外信息
- G2 5.1.2 版本