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

Canvas 高度 500px 情况下,父容器是 505px #2159

Closed
hustcc opened this issue Mar 12, 2020 · 4 comments
Closed

Canvas 高度 500px 情况下,父容器是 505px #2159

hustcc opened this issue Mar 12, 2020 · 4 comments
Assignees

Comments

@hustcc
Copy link
Member

hustcc commented Mar 12, 2020

理论上,所有的 G2 版本都有这个问题, 带来的问题:

每次 resize 触发的时候,因为 canvas 大小有父容器大小决定,所以 resize 都会导致图形比之前的高度大 5px。

解决办法:

对 canvas 设置 css 样式。

  1. 设置 display: inline;
  2. 设置 vertical-align: center (只要不是 baseline 即可)

可以在 G 层解决掉,也可以在 G2 层创建 G.Canvas 之后,再设置样式。

image

@hustcc
Copy link
Member Author

hustcc commented Mar 12, 2020

这个应该是一个老问题了。di 中做到自动做了容器大小变化的时候触发 图表 resize,然后在 G2 中图表 resize 又会导致容器大小变化,然后就死循环了。

@simaQ
Copy link
Contributor

simaQ commented Mar 12, 2020

是否可以在 G 上解决 @dengfuping

@hustcc
Copy link
Member Author

hustcc commented Mar 24, 2020

暂时业务中设置样式吧~

@yangwenhaowenhe
Copy link

forcefit设置了还是会死循环,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants