Merge branch 'master' of http://github.com/kberg/dygraphs
authorDan Vanderkam <danvk@google.com>
Wed, 10 Nov 2010 15:40:40 +0000 (10:40 -0500)
committerDan Vanderkam <danvk@google.com>
Wed, 10 Nov 2010 15:40:40 +0000 (10:40 -0500)
dygraph.js

index 0893f65..7384e71 100644 (file)
@@ -1160,6 +1160,8 @@ Dygraph.prototype.mouseMove_ = function(event) {
   var minDist = 1e+100;
   var idx = -1;
   for (var i = 0; i < points.length; i++) {
+    var point = points[i];
+    if (point == null) continue;
     var dist = Math.abs(points[i].canvasx - canvasx);
     if (dist > minDist) continue;
     minDist = dist;
@@ -1167,7 +1169,8 @@ Dygraph.prototype.mouseMove_ = function(event) {
   }
   if (idx >= 0) lastx = points[idx].xval;
   // Check that you can really highlight the last day's data
-  if (canvasx > points[points.length-1].canvasx)
+  var last = points[points.length-1];
+  if (last != null && canvasx > last.canvasx)
     lastx = points[points.length-1].xval;
 
   // Extract the points we've selected