var dygraph = this;
- // 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.mouseMoveHandler_ = function(e) {
+ dygraph.mouseMove_(e);
+ };
- 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_, 'mousemove', this.mouseMoveHandler_);
+ this.addEvent(this.mouseEventElement_, 'mouseout', this.mouseOutHandler_);
+
+ // Don't recreate and register the resize handler on subsequent calls.
+ // This happens when the graph is resized.
+ if (!this.resizeHandler_) {
this.resizeHandler_ = function(e) {
dygraph.resize();
};
bindHandler(interactionModel[eventName]));
}
+ // unregister the handler on subsequent calls.
+ // This happens when the graph is resized.
+ if (this.mouseUpHandler_) {
+ Dygraph.removeEvent(document, 'mouseup', this.mouseUpHandler_);
+ }
+
// If the user releases the mouse button during a drag, but not over the
// canvas, then it doesn't count as a zooming action.
this.mouseUpHandler_ = function(event) {
*/
Dygraph.prototype.computeYAxisRanges_ = function(extremes) {
- var isUnspecifiedLimit = function(num) {
+ var isNullUndefinedOrNaN = function(num) {
return isNaN(parseFloat(num));
};
var series;
} else if (axis.valueRange) {
// This is a user-set value range for this axis.
axis.computedValueRange = [
- isUnspecifiedLimit(axis.valueRange[0]) ? axis.extremeRange[0] : axis.valueRange[0],
- isUnspecifiedLimit(axis.valueRange[1]) ? axis.extremeRange[1] : axis.valueRange[1]
+ isNullUndefinedOrNaN(axis.valueRange[0]) ? axis.extremeRange[0] : axis.valueRange[0],
+ isNullUndefinedOrNaN(axis.valueRange[1]) ? axis.extremeRange[1] : axis.valueRange[1]
];
} else {
axis.computedValueRange = axis.extremeRange;