fix issue 124
authorDan Vanderkam <dan@dygraphs.com>
Mon, 21 Feb 2011 15:31:23 +0000 (10:31 -0500)
committerDan Vanderkam <dan@dygraphs.com>
Mon, 21 Feb 2011 15:31:23 +0000 (10:31 -0500)
dygraph.js

index 4a1cef2..657a405 100644 (file)
@@ -1401,6 +1401,9 @@ Dygraph.prototype.mouseMove_ = function(event) {
   var canvasx = Dygraph.pageX(event) - Dygraph.findPosX(this.mouseEventElement_);
   var points = this.layout_.points;
 
+  // This prevents JS errors when mousing over the canvas before data loads.
+  if (typeof(points) == 'undefined') return;
+
   var lastx = -1;
   var lasty = -1;