antvis/G2





The issue has been closed
Tooltip crosshairs 设置问题 #3436
visiky posted onGitHub
- I have searched the issues of this repository and believe that this is not a duplicate.
Reproduction link
https://g2-v4.antv.vision/en/examples/line/basic#base
Steps to reproduce
chart.tooltip({
showCrosshairs: true, // 展示 Tooltip 辅助线
shared: true,
crosshairs: {
type: 'xy',
follow: true,
text: (type, defaultContent, items) => {
const tooltipCrosshairsText = { position: type === 'y' ? 'start' : 'end' };
if (type === 'x') {
const item = items[0];
tooltipCrosshairsText['content'] = item ? item.title : defaultContent;
} else {
tooltipCrosshairsText['content'] = `${defaultContent.toFixed(2)}`;
}
return tooltipCrosshairsText;
},
textBackground: {
padding: [4, 8],
style: {}
}
}
});
Environment | Info |
---|---|
g2 | 4.1.16 |
System | - |
Browser | - |
<!-- generated by antv-issue-helper. DO NOT REMOVE -->