C3: v0.6.11 introduced vertical chart growth every time the window loses and regains focus

Created on 22 Jan 2019  路  8Comments  路  Source: c3js/c3

  • C3 version: 0.6.11, 0.6.12
  • D3 version: 5.7.0
  • Browser: Firefox 64.0.2 and Chromium 71.0.3578.98
  • OS: Arch Linux 4.20

Timeseries line charts seemed to work fine with c3 v0.6.10 and lower. Once I changed to using v0.6.11 or v0.6.12 (latest at time of writing), the chart's height grows every time the browser/page loses and regains focus.

Here's the most minimal version of a chart that does it: https://codepen.io/anon/pen/JxjdXX

When it loads, click the white rendered HTML area that contains the chart, then click back to the JS, then back to the rendered area, and so on, and so on. Each time the focus is back on the area with the chart, the chart grows vertically.

This seems to be the likely culprit: https://github.com/c3js/c3/pull/2541

Please let me know if I can provide any further information.

C-bug

All 8 comments

Definitely a breaking issue here - I can't use this library while this bug exists

Happens to me as well. Additionally, our pie charts have initial 0 height, and applying the focus/blur approach above, the chart's height increases.

Happens to me as well. Additionally, our pie charts have initial 0 height, and applying the focus/blur approach above, the chart's height increases.

https://codepen.io/rompelstompel/pen/EMPmoV

You can edit settings to change to 0.6.10 to see how it used to react: https://codepen.io/rompelstompel/pen/Qoygje

Found a workaround. If you set svg's display property to block, then it seems fixing the issue.
https://codepen.io/kt3k/pen/OqXxoj

(I'm not sure the root cause of this behavior. Sometimes svg and its wrapper div have different sizes. And that cause this bug. But in some cases (for example this one in /htdocs) it doesn't simply happen (in that case, svg and its wrapper div have the same height.)

After looking at #2541's example carefully, I found that it doesn't work without additional styles like #chart { height: 100%; }. Now I think it's better to revert it.

Reverted #2541 and released it as v0.6.13.

Reverted #2541 and released it as v0.6.13.

Thanks!

The codepen example seems fixed with c3 updated to v0.6.13.
https://codepen.io/kt3k/pen/zboOKj

Was this page helpful?
0 / 5 - 0 ratings

Related issues

laurentdebricon picture laurentdebricon  路  3Comments

seubert picture seubert  路  3Comments

Shugardude picture Shugardude  路  4Comments

jstone-ponderosa picture jstone-ponderosa  路  3Comments

Kreozot picture Kreozot  路  3Comments