Merge branch 'master' of git://github.com/danvk/dygraphs
authorNikhil Kasinadhuni <nikhilk@google.com>
Thu, 11 Mar 2010 01:14:40 +0000 (17:14 -0800)
committerNikhil Kasinadhuni <nikhilk@google.com>
Thu, 11 Mar 2010 01:14:40 +0000 (17:14 -0800)
Conflicts:
dygraph.js

dygraph.js

index defac69..1b4600e 100644 (file)
@@ -903,19 +903,20 @@ Dygraph.prototype.mouseMove_ = function(event) {
   var cumulative_sum = 0;  // used only if we have a stackedGraph.
   var l = points.length;
   var isStacked = this.attr_("stackedGraph");
-  for (var i = 0; i < l; i++) {
+  for (var i = l - 1; i >= 0; i--) {
     if (points[i].xval == lastx) {
       if (!isStacked) {
-        this.selPoints_.push(points[i]);
+        this.selPoints_.unshift(points[i]);
       } else {
         // Clone the point, since we need to 'unstack' it below. Stacked points
         // are in reverse order.
         var p = {};
-        for (var k in points[l - i - 1]) {
-          p[k] = points[l - i -1][k];
+        for (var k in points[i]) {
+          p[k] = points[i][k];
         }
         p.yval -= cumulative_sum;
         cumulative_sum += p.yval;
+        this.selPoints_.push(p);
       }
     }
   }