On my Mac, no chart is blurry. However, on most PC’s I’m working on, the charts look blurry, even at 100%.
I think it has something to do with Window.devicePixelRatio, which is different depending on what device you’re on.
This should help with clearing up the charts, but I’m having some trouble implementing it into canvasjs. Can you assist?
canvas = document.getElementById(‘output’)
var scale = window.devicePixelRatio; // Change to 1 on retina screens to see blurry canvas.
canvas.style.width = “100px”;
canvas.style.height = “100px”;
canvas.width = 100 * scale; // double above width
canvas.height = 100 * scale; // double above height
context = canvas.getContext(‘2d’)
context.scale(2,2)
// does chart.render go here??
Source:
https://coderwall.com/p/vmkk6a/how-to-make-the-canvas-not-look-like-crap-on-retina
-
This topic was modified 4 years, 9 months ago by gregs.