flot/flot — pull request #943 by tsareg (2013-01-29 11:12:32+00:00)
Title: Added option to control usage of devicePixelRatio and canvas scaling for "retina"-like displays

Retina display support was introduced in https://github.com/flot/flot/pull/52.
However, it seems that for large data sets and fast redraws (e.g. real-time) scaling a canvas may result in a performance hit. On my project I've got that iPad 2 was faster than iPad 4.

Here is sample: http://jsfiddle.net/p79gL/1/. On my HTC One X smartphone (devicePixelRation is 2) on native browser it shows about 11.5 fps.
While after disabling usage of devicePixelRatio (just make getPixelRatio() always return 1) sample shows up to 20 fps performance. Sample is here: http://jsfiddle.net/p79gL/2/.
The same situation can be observed on other devices with "retina"-like displays (tested on iPad 4 and Google Nexus 7).

So in the pull request I suggest to introduce an option "useDevicePixelRatio" which is true by default. If it will be set to false, then devicePixelRatio won't be used and getPixelRation() function will return just 1. Also it doesn't make sense to scale canvas if pixelRatio is 1.