From: Dan Vanderkam Date: Wed, 15 Aug 2012 17:41:32 +0000 (-0700) Subject: Merge pull request #164 from wimme/patch-3 X-Git-Tag: v1.0.0~196 X-Git-Url: https://adrianiainlam.tk/git/?a=commitdiff_plain;h=4766b6ed664c5a9556f5d9be40a6b4680737da29;hp=e276946939d737f58e904c94fa067e937a263d1e;p=dygraphs.git Merge pull request #164 from wimme/patch-3 Stepplot and errorbars sync fix --- diff --git a/dygraph-canvas.js b/dygraph-canvas.js index 571191c..165d885 100644 --- a/dygraph-canvas.js +++ b/dygraph-canvas.js @@ -618,7 +618,7 @@ DygraphCanvasRenderer._errorPlotter = function(e) { ctx.beginPath(); while (iter.hasNext) { var point = iter.next(); - if (!Dygraph.isOK(point.y)) { + if ((!stepPlot && !Dygraph.isOK(point.y)) || (stepPlot && !isNaN(prevY) && !Dygraph.isOK(prevY))) { prevX = NaN; continue; } @@ -633,17 +633,15 @@ DygraphCanvasRenderer._errorPlotter = function(e) { newYs[1] = e.plotArea.h * newYs[1] + e.plotArea.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]); + ctx.lineTo(point.canvasx, prevYs[0]); + ctx.lineTo(point.canvasx, prevYs[1]); } else { - ctx.lineTo(prevX, prevYs[1]); + ctx.moveTo(prevX, prevYs[0]); + ctx.lineTo(point.canvasx, newYs[0]); + ctx.lineTo(point.canvasx, newYs[1]); } + ctx.lineTo(prevX, prevYs[1]); ctx.closePath(); } prevYs = newYs;