highlight callback only when selected point changes
authorDan Vanderkam <danvdk@gmail.com>
Fri, 5 Feb 2010 05:36:21 +0000 (21:36 -0800)
committerDan Vanderkam <danvdk@gmail.com>
Fri, 5 Feb 2010 05:36:21 +0000 (21:36 -0800)
dygraph.js

index 8a303a0..d9c0e27 100644 (file)
@@ -782,7 +782,11 @@ Dygraph.prototype.mouseMove_ = function(event) {
   }
 
   if (this.attr_("highlightCallback")) {
-    this.attr_("highlightCallback")(event, lastx, this.selPoints_);
+    var px = this.lastHighlightCallbackX;
+    if (px !== null && lastx != px) {
+      this.attr_("highlightCallback")(event, lastx, this.selPoints_);
+      this.lastHighlightCallbackX = lastx;
+    }
   }
 
   // Clear the previously drawn vertical, if there is one