From: Dan Vanderkam Date: Wed, 18 Jul 2012 17:13:36 +0000 (-0500) Subject: add comment about the "remove canvasx/y" optimization X-Git-Tag: v1.0.0~221 X-Git-Url: https://adrianiainlam.tk/git/?a=commitdiff_plain;h=e60234cd5ea3a1c0cc2c97d711d8ae72c9cd2fba;p=dygraphs.git add comment about the "remove canvasx/y" optimization --- diff --git a/dygraph-canvas.js b/dygraph-canvas.js index fd74d5b..5b7c973 100644 --- a/dygraph-canvas.js +++ b/dygraph-canvas.js @@ -422,6 +422,12 @@ DygraphCanvasRenderer.prototype._renderLineChart = function() { // TODO(bhs): this loop is a hot-spot for high-point-count charts. These // transformations can be pushed into the canvas via linear transformation // matrices. + // NOTE(danvk): this is trickier than it sounds at first. The transformation + // needs to be done before the .moveTo() and .lineTo() calls, but must be + // undone before the .stroke() call to ensure that the stroke width is + // unaffected. An alternative is to reduce the stroke width in the + // transformed coordinate space, but you can't specify different values for + // each dimension (as you can with .scale()). The speedup here is ~12%. var points = this.layout.points; for (i = points.length; i--;) { var point = points[i];