Ensure step plots draw lines to the start of missing values.
authorNeal Nelson <neal@makalumedia.com>
Thu, 17 Jun 2010 14:07:52 +0000 (16:07 +0200)
committerNeal Nelson <neal@makalumedia.com>
Thu, 17 Jun 2010 14:07:52 +0000 (16:07 +0200)
dygraph-canvas.js

index 2eb5ce1..3988b19 100644 (file)
@@ -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 {