-
Notifications
You must be signed in to change notification settings - Fork 11.9k
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 resize on redraw #1006
Comments
@Oldwo1f Can you create a JSBin of the issue? Are you recreating the chart each time? If so, did you use 'destroy' on the old chart? |
hi thanks for your answer No i am not recreating the chart each time . |
The thing is: I use angular-chart.js and it seem to not work with jsfiddle. You can reproduce the bug by resizing browser window. You ll see the chart increasing his height. on each redraw. So it ll become very tall very very fast
|
Not sure if the cause is the same, but here is a jsFiddle with the same symptoms: Please click the "resize" button several times. |
Setting the chart canvas to display: block; was a good workaround for me. |
I got the same issue, did you resolve it ? Regards, |
As I noted earlier, you can avoid this problem by setting the chart canvas to "display: block" (this worked for me) |
I use angular-chartjs too and I had the same issue. Regards |
@RemiNV see it: https://jsfiddle.net/jedarc/dgoxydzc/3/ |
@Jedarc I still see the same issue in the jsfiddle you provided. Does rendering the chart one extra time at each resize fix it in your case ? This would have bad performance if you are reacting to many resize events, so I don't think this is a good option anyway. |
I'm using Chart.js v1.0.2 and angular-chart.js v0.7.6. Commenting out the line helpers.retinaScale(this); did not work for me, neither using display:block. After each redraw, the graph always increases its height in 40px. What I found while debugging was that the Charts.js's constructor gets the value returned by computeDimension function and assign it to the canvas' height. The problem, in my case, was that computeDimension returns the offsetHeight and this value did happen to be always greater than the canvas' height property. The docs say offsetHeight includes padding and borders so I checked my canvas element and it was using a padding of 20px. After setting the padding to 0px the problem was gone. |
I faced the same issue and I fount that one reason why height of chart is changed is (this.endPoint - this.startPoint).
|
I'm testing chartjs, this is my .js file copied from the website: Why when I try to change the size of the chart via css it doesn't work? My screen just keep blinking when I refresh the browser. I've tried other different types of chart and the same happened. |
Hello, today I am closing all issues that are only affecting version 1 of Chart.js as WONTFIX. If this issue does affect version 2 as well, I apologize for the error. Please create a test case against Chart.js 2 using on of the below websites and we will be happy to reopen the issue and update its classification: |
This is still happening in version 2.6.0 chart.destroy(); Recreating chart increases its height. |
Yap! |
@yakuzaaaa @DBenS can you guys provide a jsfiddle that reproduce this issue with Chart.js 2.7.1? |
I had the same issue of a resizing canvas with
I could only solve it by adding a div around the canvas and setting
|
Hi
I got the same issue as in 713 and 759
But the quick fix ( comment out the line helpers.retinaScale(this); ) doesnt work me (even on chrome or firefox).
My line Chart still increase his own size each time i redraw it (on browser resize or on data change).
Any idea of how to fix that?
Thanks
The text was updated successfully, but these errors were encountered: