var dygraph = this;
- this.mouseMoveHandler = function(e) {
- dygraph.mouseMove_(e);
- };
- this.addEvent(this.mouseEventElement_, 'mousemove', this.mouseMoveHandler);
+ // Don't recreate and register the handlers on subsequent calls.
+ // This happens when the graph is resized.
+ if (!this.mouseMoveHandler_) {
+ this.mouseMoveHandler_ = function(e) {
+ dygraph.mouseMove_(e);
+ };
+ this.addEvent(this.mouseEventElement_, 'mousemove', this.mouseMoveHandler_);
- this.mouseOutHandler = function(e) {
- dygraph.mouseOut_(e);
- };
- this.addEvent(this.mouseEventElement_, 'mouseout', this.mouseOutHandler);
+ this.mouseOutHandler_ = function(e) {
+ dygraph.mouseOut_(e);
+ };
+ this.addEvent(this.mouseEventElement_, 'mouseout', this.mouseOutHandler_);
- if (!this.resizeHandler_) {
this.resizeHandler_ = function(e) {
dygraph.resize();
};
this.registeredEvents_ = [];
// remove mouse event handlers (This may not be necessary anymore)
- Dygraph.removeEvent(this.mouseEventElement_, 'mouseout', this.mouseOutHandler);
- Dygraph.removeEvent(this.mouseEventElement_, 'mousemove', this.mouseMoveHandler);
+ Dygraph.removeEvent(this.mouseEventElement_, 'mouseout', this.mouseOutHandler_);
+ Dygraph.removeEvent(this.mouseEventElement_, 'mousemove', this.mouseMoveHandler_);
Dygraph.removeEvent(this.mouseEventElement_, 'mousemove', this.mouseUpHandler_);
+
+ // remove window handlers
+ Dygraph.removeEvent(window,'resize',this.resizeHandler_);
+ this.resizeHandler_ = null;
+
removeRecursive(this.maindiv_);
var nullOut = function(obj) {
}
}
};
- // remove event handlers
- Dygraph.removeEvent(window,'resize',this.resizeHandler_);
- this.resizeHandler_ = null;
// These may not all be necessary, but it can't hurt...
nullOut(this.layout_);
nullOut(this.plotter_);