From e60234cd5ea3a1c0cc2c97d711d8ae72c9cd2fba Mon Sep 17 00:00:00 2001 From: Dan Vanderkam Date: Wed, 18 Jul 2012 12:13:36 -0500 Subject: [PATCH] add comment about the "remove canvasx/y" optimization --- dygraph-canvas.js | 6 ++++++ 1 file changed, 6 insertions(+) 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]; -- 2.7.4