antvis/G2

The issue has been closed
【v5】散点图开启 label,label 会遮住 point 导致 tooltip 不显示 #5216
Deathsteps posted onGitHub
问题描述
无 label 设定效果 <img width="1076" alt="image" src="https://github.com/antvis/G2/assets/1549118/b85ff5e3-f831-4a86-a327-382584e7c82c">
有 label 设定,tooltip 无法触发 <img width="1067" alt="image" src="https://github.com/antvis/G2/assets/1549118/a2d0f114-136a-4fe2-8c44-9e8e6495e996">
期望结果
从体验上讲 label 应该不影响 tooltip 触发。 官方的数据点比较多,可能比较明显,真实情况可能没这么多点,但点与点距离是数据决定的。label 就算有偏移,长度也是不可控的,大概率也会有遮挡情况。
如何重现
官方代码修改
import { Chart } from '@antv/g2';
const chart = new Chart({
container: 'container',
theme: 'classic',
autoFit: true,
});
chart
.point()
.data({
type: 'fetch',
value:
'https://gw.alipayobjects.com/os/basement_prod/6b4aa721-b039-49b9-99d8-540b3f87d339.json',
})
.encode('x', 'height')
.encode('y', 'weight')
.encode('color', 'gender')
.label({ text: 'weight' });
chart.render();
额外信息
- G2 5.0.12 版本