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