findClosestPoint visibility bias fix, as described in this issue;
authorshole <pahappo@gmail.com>
Sat, 27 Oct 2012 15:55:57 +0000 (18:55 +0300)
committershole <pahappo@gmail.com>
Sat, 27 Oct 2012 15:55:57 +0000 (18:55 +0300)
https://code.google.com/p/dygraphs/issues/detail?id=369

dygraph.js

index 621ea32..9d58201 100644 (file)
@@ -1670,7 +1670,7 @@ Dygraph.prototype.findClosestPoint = function(domX, domY) {
   var minDist = Infinity;
   var idx = -1;
   var dist, dx, dy, point, closestPoint, closestSeries;
-  for (var setIdx = 0; setIdx < this.layout_.datasets.length; ++setIdx) {
+  for ( var setIdx = this.layout_.datasets.length - 1 ; setIdx >= 0 ; --setIdx ) {
     var points = this.layout_.points[setIdx];
     for (var i = 0; i < points.length; ++i) {
       var point = points[i];