From 8a7cc60e98491e33ffc56f16e43cf4a5d8d7d53b Mon Sep 17 00:00:00 2001 From: Robert Konigsberg Date: Tue, 9 Nov 2010 18:58:02 -0500 Subject: [PATCH] When a module is a pure underlay with no data points, mousemove operations generate errors. --- dygraph.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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 -- 2.7.4