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

Chart does not render properly when it was generated in not active tab in chrome #924

Closed
norecces opened this issue Jan 21, 2015 · 7 comments
Labels
C-bug Category: This is a bug

Comments

@norecces
Copy link

I opened http://c3js.org/samples/chart_combination.html from http://c3js.org/examples.html by clicking at link and opening it in new tab. Then I waited few seconds and went to combination example. It was not rendered (Actually it was but wrong). 10
To get chart visible I had to resize window. If it is only one tab in chrome, this bug does not seem to appear.

Google Chrome 39.0.2171.99 m

@tw3
Copy link

tw3 commented Jan 22, 2015

I saw the same bug in Chrome when rendering bar charts. I was able to fix this by changing this line in c3.js:

$$.redrawBar(drawBar, false), // changed from true to false to fix bug (line 626)

@norecces
Copy link
Author

Hi, tw3

As I understand with this change in code you will loose smooth transitions.

Compare transition behaviour in http://c3js.org/samples/chart_bar_stacked.html and http://jsfiddle.net/norecces/sq5Lq7br/1/

@aendra-rininsland
Copy link
Member

Marking this as a bug. #774 might allow @tw3's fix to be added to core while still enabling transitions.

@aendra-rininsland
Copy link
Member

I've noticed this quite a lot recently working with C3, seems like if a chart is rendered and not painted, it will paint only upon being told to resize or flush or whatever. According to #936, charts also fail to render properly if they're not visible and are then made as such.

@aendra-rininsland
Copy link
Member

See this SO answer. It's a broader problem with D3, due to requestAnimationFrame.

IMO, the answer is 100% to drop all D3 transition() calls altogether in favour of CSS transitions/animations. See #774. Another solution would be to call a redraw when the visibilitychange event fires; see: https://developer.mozilla.org/en-US/docs/Web/Guide/User_experience/Using_the_Page_Visibility_API

@fmluizao
Copy link

fmluizao commented Sep 5, 2018

I'm facing this problem with version 0.6.7. Its happening with examples too.

To reproduce, open an example chart in a new tab with Chrome. Wait a few seconds and switch to the new tab, the chart isn't rendered correctly.

Chrome version: 69.0.3497.81 (linux)

@fmluizao
Copy link

fmluizao commented Sep 5, 2018

Seems like its already reported:

#2458

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug
Projects
None yet
Development

No branches or pull requests

4 participants