Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tooltip 带来 G2 在容器中的滚动条 #5024

Closed
2 tasks
hustcc opened this issue May 15, 2023 · 0 comments · Fixed by #5025
Closed
2 tasks

tooltip 带来 G2 在容器中的滚动条 #5024

hustcc opened this issue May 15, 2023 · 0 comments · Fixed by #5025
Assignees
Labels

Comments

@hustcc
Copy link
Member

hustcc commented May 15, 2023

在 G2 官网中可以复现:

image

只要 G2 作为一个卡片在容器中渲染的时候,都会因为 tooltip 超出容器带来滚动条,非常不美观,解决方案有二:

  • tooltip 限制在画布范围之内,这也是之前版本一直这么做的
  • 渲染到 body 上,扩大显示范围,但是 tooltip 也需要限制在 body 之内

tooltip 限制在画布范围之内

chart.interaction('tooltip', {
  bounding: [0, 0, width, height],
});

渲染到 body 上,扩大显示范围

chart.interaction('tooltip', {
  mount: 'body', // string | HTMLElement,
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant