4
我已经在bitbucket上看到3 tickets在去年问过这个问题,但从未见过明确的答案。HIDPI /视网膜绘图?
One这些门票给了一些代码,但我不知道代码属于哪里。
var devicePixelRatio = window.devicePixelRatio || 1,
backingStoreRatio = ctx.webkitBackingStorePixelRatio ||
ctx.mozBackingStorePixelRatio ||
ctx.msBackingStorePixelRatio ||
ctx.oBackingStorePixelRatio ||
ctx.backingStorePixelRatio || 1;
ratio = devicePixelRatio/backingStoreRatio;
if (devicePixelRatio !== backingStoreRatio) {
var oldWidth = canvas.width;
var oldHeight = canvas.height;
this.canvasOrigWidth = oldWidth;
this.canvasOrigHeight = oldHeight;
canvas.width = oldWidth * ratio;
canvas.height = oldHeight * ratio;
canvas.style.width = oldWidth + 'px';
canvas.style.height = oldHeight + 'px';
// now scale the context to counter
// the fact that we've manually scaled
// our canvas element
ctx.scale(ratio, ratio);
}
如何让JQPlot输出高分辨率图?
编辑1 上面的代码似乎来自这个website。
感谢分享,感谢! – Teson
刚刚测试过它,它对我很好。谢谢一堆! – TWilly
@Andrew,不幸的是,这似乎打破了饼图:( – halfdan