Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Chart.js flickering

can anybody tell me why my chart.js chart is flickering? see this screencast video.

https://www.screencast.com/t/J8demDuX

It looks slow in the video but it actually changes very fast. You will see in the console the height and width changes but I don't have any code in javascript that forces it to change.

And also it happens only sometimes depending on the size of the browser. Making the canvas small is just a temporary fix but it will still be reproducible when I resize the browser.

Any suggestions?

like image 987
Voltaire John Secondes Biton Avatar asked Sep 15 '25 04:09

Voltaire John Secondes Biton


1 Answers

I had a similar problem with my chart. I discovered it happend when recreating the chart on the same canvas.

If you recreate your chart multiple times on the same canvas, try calling the

    .destroy();  

function on your chart before recreating it.

Hope this helps

like image 83
Jan Avatar answered Sep 16 '25 16:09

Jan