look at examples:
- jsfiddle.net/Kky6J/5/
- jsfiddle.net/8t3Nq/2/
The only difference is in which way canvas is cleared, in window.render function:
- ctx.clearRect(0, 0, width, height);
- chart.width = chart.width;
In google chrome “23.0.1271.97m” (and firefox 17.0.1) i got performance degradation at each frame in (1.) (number at right side from the red bar – time spent to draw frame in ms)
I think it is my mistake, because in popular manuals the (1.) are faster in examples. (http://www.html5rocks.com/en/tutorials/canvas/performance/)
jsfiddle.net/Kky6J/21/
Solution – use ctx.beginPath() before use ctx.rect(10, 10, 5, 20)