Patch for issue 242 from kberg
authorDan Vanderkam <dan@dygraphs.com>
Thu, 17 Nov 2011 22:23:48 +0000 (17:23 -0500)
committerDan Vanderkam <dan@dygraphs.com>
Thu, 17 Nov 2011 22:23:48 +0000 (17:23 -0500)
dygraph-interaction-model.js

index 06655f1..98d1411 100644 (file)
@@ -266,7 +266,8 @@ Dygraph.Interaction.treatMouseOpAsClick = function(g, event, context) {
       var p = g.selPoints_[i];
       var distance = Math.pow(p.canvasx - context.dragEndX, 2) +
                      Math.pow(p.canvasy - context.dragEndY, 2);
-      if (closestIdx == -1 || distance < closestDistance) {
+      if (!isNaN(distance) &&
+          (closestIdx == -1 || distance < closestDistance)) {
         closestDistance = distance;
         closestIdx = i;
       }