Hacker News new | ask | show | jobs
by nirkalimi 4042 days ago
Interestingly enough, I had a problem with ChartJS that no one seemed to be able to remedy. It was quite bizarre and at first seemed to be a cross browser issue, but after further investigation it seemed to just be some type of strange cross-machine issue. See it here http://stackoverflow.com/questions/30063762/side-effects-fro...

Given that, I had to do some hacky stuff upon every refresh. Instead of using destroy() on the canvas, I had to remove the Canvas DOM object itself, building it back up, and inserting it again. Because of this I am a bit skeptical about using ChartJS again, which is unfortunate because I do love their Charts. I feel like maybe SVG might be the better way to go for analytics.

1 comments

hey nirkalimi, I'm one of the maintainers of Chart.js. I know of a previous issue where the behaviour you described occurred on devices with window.devicePixelRatio greater than 1. Your JS fiddle didn't reproduce on my machine and it appears to use v1.0.1 which was the version that fixed the bug with devicePixelRatio. Calling destroy() on the chart object should be enough to reset the canvas to it's original state. If you'd like, file an issue on github and I can have a more detailed look.