remove if statement
authorDan Vanderkam <dan@dygraphs.com>
Tue, 17 Jul 2012 17:06:14 +0000 (12:06 -0500)
committerDan Vanderkam <dan@dygraphs.com>
Tue, 17 Jul 2012 17:06:14 +0000 (12:06 -0500)
dygraph-canvas.js

index 0d0f895..efae1cf 100644 (file)
@@ -554,62 +554,60 @@ DygraphCanvasRenderer.prototype.drawFillBars_ = 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 (stackedGraph) {
-          currBaseline = baseline[point.canvasx];
-          var lastY;
-          if (currBaseline === undefined) {
-            lastY = axisY;
+      if (!Dygraph.isOK(point.y)) {
+        prevX = NaN;
+        continue;
+      }
+      if (stackedGraph) {
+        currBaseline = baseline[point.canvasx];
+        var lastY;
+        if (currBaseline === undefined) {
+          lastY = axisY;
+        } else {
+          if(stepPlot) {
+            lastY = currBaseline[0];
           } else {
-            if(stepPlot) {
-              lastY = currBaseline[0];
-            } else {
-              lastY = currBaseline;
-            }
+            lastY = currBaseline;
           }
-          newYs = [ point.canvasy, lastY ];
+        }
+        newYs = [ point.canvasy, lastY ];
 
-          if(stepPlot) {
-            // Step plots must keep track of the top and bottom of
-            // the baseline at each point.
-            if(prevYs[0] === -1) {
-              baseline[point.canvasx] = [ point.canvasy, axisY ];
-            } else {
-              baseline[point.canvasx] = [ point.canvasy, prevYs[0] ];
-            }
+        if(stepPlot) {
+          // Step plots must keep track of the top and bottom of
+          // the baseline at each point.
+          if(prevYs[0] === -1) {
+            baseline[point.canvasx] = [ point.canvasy, axisY ];
           } else {
-            baseline[point.canvasx] = point.canvasy;
+            baseline[point.canvasx] = [ point.canvasy, prevYs[0] ];
           }
-
         } else {
-          newYs = [ point.canvasy, axisY ];
+          baseline[point.canvasx] = point.canvasy;
         }
-        if (!isNaN(prevX)) {
-          ctx.moveTo(prevX, prevYs[0]);
 
-          if (stepPlot) {
-            ctx.lineTo(point.canvasx, prevYs[0]);
-            if(currBaseline) {
-              // Draw to the bottom of the baseline
-              ctx.lineTo(point.canvasx, currBaseline[1]);
-            } else {
-              ctx.lineTo(point.canvasx, newYs[1]);
-            }
+      } else {
+        newYs = [ point.canvasy, axisY ];
+      }
+      if (!isNaN(prevX)) {
+        ctx.moveTo(prevX, prevYs[0]);
+
+        if (stepPlot) {
+          ctx.lineTo(point.canvasx, prevYs[0]);
+          if(currBaseline) {
+            // Draw to the bottom of the baseline
+            ctx.lineTo(point.canvasx, currBaseline[1]);
           } else {
-            ctx.lineTo(point.canvasx, newYs[0]);
             ctx.lineTo(point.canvasx, newYs[1]);
           }
-
-          ctx.lineTo(prevX, prevYs[1]);
-          ctx.closePath();
+        } else {
+          ctx.lineTo(point.canvasx, newYs[0]);
+          ctx.lineTo(point.canvasx, newYs[1]);
         }
-        prevYs = newYs;
-        prevX = point.canvasx;
+
+        ctx.lineTo(prevX, prevYs[1]);
+        ctx.closePath();
       }
+      prevYs = newYs;
+      prevX = point.canvasx;
     }
     ctx.fill();
   }