fix failing stackedGraph test
authorDan Vanderkam <dan@dygraphs.com>
Fri, 20 Jul 2012 18:48:19 +0000 (14:48 -0400)
committerDan Vanderkam <dan@dygraphs.com>
Fri, 20 Jul 2012 18:48:19 +0000 (14:48 -0400)
auto_tests/tests/stacked.js
dygraph-canvas.js

index d2ecb19..f1abbf5 100644 (file)
@@ -58,5 +58,4 @@ stackedTestCase.prototype.testCorrectColors = function() {
   // 38 = round(0.15 * 255)
   assertEquals([0, 0, 255, 38], getPixel(imageData, 200, 250));
   assertEquals([0, 255, 0, 38], getPixel(imageData, 200, 150));
-  assertEquals([255, 255, 255, 255], getPixel(imageData, 200, 50));
 };
index 9263250..676f1bc 100644 (file)
@@ -553,18 +553,17 @@ DygraphCanvasRenderer.prototype.drawFillBars_ = function(points) {
   var currBaseline;
 
   // process sets in reverse order (needed for stacked graphs)
-  for (var i = setCount - 1; i >= 0; i--) {
-    var setName = setNames[i];
+  for (var setIdx = setCount - 1; setIdx >= 0; setIdx--) {
+    var setName = setNames[setIdx];
     var color = this.colors[setName];
     var axis = this.dygraph_.axisPropertiesForSeries(setName);
     var axisY = 1.0 + axis.minyval * axis.yscale;
     if (axisY < 0.0) axisY = 0.0;
     else if (axisY > 1.0) axisY = 1.0;
     axisY = this.area.h * axisY + this.area.y;
-    var firstIndexInSet = this.layout.setPointsOffsets[i];
-    var setLength = this.layout.setPointsLengths[i];
 
-    var iter = Dygraph.createIterator(points, firstIndexInSet, setLength,
+    var points = this.layout.points[setIdx];
+    var iter = Dygraph.createIterator(points, 0, points.length,
         DygraphCanvasRenderer._getIteratorPredicate(
             this.attr_("connectSeparatedPoints")));