antvis/G2
The issue has been closed
tooltip 带来 G2 在容器中的滚动条 #5024
hustcc posted onGitHub
在 G2 官网中可以复现:
只要 G2 作为一个卡片在容器中渲染的时候,都会因为 tooltip 超出容器带来滚动条,非常不美观,解决方案有二:
- tooltip 限制在画布范围之内,这也是之前版本一直这么做的
- 渲染到 body 上,扩大显示范围,但是 tooltip 也需要限制在 body 之内
tooltip 限制在画布范围之内
chart.interaction('tooltip', {
bounding: [0, 0, width, height],
});
渲染到 body 上,扩大显示范围
chart.interaction('tooltip', {
mount: 'body', // string | HTMLElement,
});