From: Robert Konigsberg Date: Tue, 9 Nov 2010 23:58:02 +0000 (-0500) Subject: When a module is a pure underlay with no data points, mousemove X-Git-Tag: v1.0.0~613^2~1 X-Git-Url: https://adrianiainlam.tk/git/?a=commitdiff_plain;h=8a7cc60e98491e33ffc56f16e43cf4a5d8d7d53b;p=dygraphs.git When a module is a pure underlay with no data points, mousemove operations generate errors. --- diff --git a/dygraph.js b/dygraph.js index 16e96f1..6bcb0e2 100644 --- a/dygraph.js +++ b/dygraph.js @@ -1133,6 +1133,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; @@ -1140,7 +1142,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