From a570118833885dfc7b52840b2c33da8a3abd459a Mon Sep 17 00:00:00 2001 From: Dan Vanderkam Date: Tue, 17 Jul 2012 12:12:44 -0500 Subject: [PATCH] remove another if --- dygraph-canvas.js | 52 +++++++++++++++++++++++++--------------------------- 1 file changed, 25 insertions(+), 27 deletions(-) diff --git a/dygraph-canvas.js b/dygraph-canvas.js index efae1cf..3d4b880 100644 --- a/dygraph-canvas.js +++ b/dygraph-canvas.js @@ -470,39 +470,37 @@ DygraphCanvasRenderer.prototype.drawErrorBars_ = function(points) { ctx.beginPath(); while (iter.hasNext) { var point = iter.next(); - if (point.name == setName) { // TODO(klausw): this is always true - if (!Dygraph.isOK(point.y)) { - prevX = NaN; - continue; - } + if (!Dygraph.isOK(point.y)) { + prevX = NaN; + continue; + } - // TODO(danvk): here + // TODO(danvk): here + if (stepPlot) { + newYs = [ point.y_bottom, point.y_top ]; + prevY = point.y; + } else { + newYs = [ point.y_bottom, point.y_top ]; + } + newYs[0] = this.area.h * newYs[0] + this.area.y; + newYs[1] = this.area.h * newYs[1] + this.area.y; + if (!isNaN(prevX)) { if (stepPlot) { - newYs = [ point.y_bottom, point.y_top ]; - prevY = point.y; + ctx.moveTo(prevX, newYs[0]); } else { - newYs = [ point.y_bottom, point.y_top ]; + ctx.moveTo(prevX, prevYs[0]); } - newYs[0] = this.area.h * newYs[0] + this.area.y; - newYs[1] = this.area.h * newYs[1] + this.area.y; - if (!isNaN(prevX)) { - if (stepPlot) { - ctx.moveTo(prevX, newYs[0]); - } else { - ctx.moveTo(prevX, prevYs[0]); - } - ctx.lineTo(point.canvasx, newYs[0]); - ctx.lineTo(point.canvasx, newYs[1]); - if (stepPlot) { - ctx.lineTo(prevX, newYs[1]); - } else { - ctx.lineTo(prevX, prevYs[1]); - } - ctx.closePath(); + ctx.lineTo(point.canvasx, newYs[0]); + ctx.lineTo(point.canvasx, newYs[1]); + if (stepPlot) { + ctx.lineTo(prevX, newYs[1]); + } else { + ctx.lineTo(prevX, prevYs[1]); } - prevYs = newYs; - prevX = point.canvasx; + ctx.closePath(); } + prevYs = newYs; + prevX = point.canvasx; } ctx.fill(); } -- 2.7.4