From: Neal Nelson Date: Thu, 17 Jun 2010 14:07:52 +0000 (+0200) Subject: Ensure step plots draw lines to the start of missing values. X-Git-Tag: v1.0.0~636^2~7 X-Git-Url: https://adrianiainlam.tk/git/?a=commitdiff_plain;h=0599d13b7ddc7b0820ce6bac78085335ec14522e;p=dygraphs.git Ensure step plots draw lines to the start of missing values. --- diff --git a/dygraph-canvas.js b/dygraph-canvas.js index 2eb5ce1..3988b19 100644 --- a/dygraph-canvas.js +++ b/dygraph-canvas.js @@ -616,6 +616,15 @@ DygraphCanvasRenderer.prototype._renderLineChart = function() { var point = points[j]; if (point.name == setName) { if (!isOK(point.canvasy)) { + if (stepPlot) { + // Draw a horizontal line to the start of the missing data + ctx.beginPath(); + ctx.strokeStyle = color; + ctx.lineWidth = this.options.strokeWidth; + ctx.moveTo(prevX, prevY); + ctx.lineTo(point.canvasx, prevY); + ctx.stroke(); + } // this will make us move to the next point, not draw a line to it. prevX = prevY = null; } else {