assertTrue(g.isZoomed("x"));
assertTrue(g.isZoomed("y"));
};
+
+
+InteractionModelTestCase.prototype.testCorrectAxisValueRangeAfterUnzoom = function() {
+ var g = new Dygraph(document.getElementById("graph"), data2, {valueRange:[1,50],dateRange:[1,9],animatedZooms:false});
+
+ // Zoom x axis
+ DygraphOps.dispatchMouseDown_Point(g, 10, 10);
+ DygraphOps.dispatchMouseMove_Point(g, 30, 10);
+ DygraphOps.dispatchMouseUp_Point(g, 30, 10);
+
+ // Zoom y axis
+ DygraphOps.dispatchMouseDown_Point(g, 10, 10);
+ DygraphOps.dispatchMouseMove_Point(g, 10, 30);
+ DygraphOps.dispatchMouseUp_Point(g, 10, 30);
+ currentYAxisRange = g.yAxisRange();
+ currentXAxisRange = g.xAxisRange();
+
+ //check that the range for the axis has changed
+ assertNotEquals(1,currentXAxisRange[0]);
+ assertNotEquals(10,currentXAxisRange[1]);
+ assertNotEquals(1,currentYAxisRange[0]);
+ assertNotEquals(50,currentYAxisRange[1]);
+
+ // unzoom by doubleclick
+ DygraphOps.dispatchDoubleClick(g, null);
+
+ // check if range for y-axis was reset to original value
+ // TODO check if range for x-axis is correct.
+ // Currently not possible because dateRange is set to null and extremes are returned
+ newYAxisRange = g.yAxisRange();
+ assertEquals(1,newYAxisRange[0]);
+ assertEquals(50,newYAxisRange[1]);
+};
Dygraph.OPTIONS_REFERENCE[name] = true;
}
// </REMOVE_FOR_COMBINED>
- if (seriesName &&
+ if (this.user_attrs_ !== null && seriesName &&
typeof(this.user_attrs_[seriesName]) != 'undefined' &&
this.user_attrs_[seriesName] !== null &&
typeof(this.user_attrs_[seriesName][name]) != 'undefined') {
return this.user_attrs_[seriesName][name];
- } else if (typeof(this.user_attrs_[name]) != 'undefined') {
+ } else if (this.user_attrs_ !== null && typeof(this.user_attrs_[name]) != 'undefined') {
return this.user_attrs_[name];
- } else if (typeof(this.attrs_[name]) != 'undefined') {
+ } else if (this.attrs_ !== null && typeof(this.attrs_[name]) != 'undefined') {
return this.attrs_[name];
} else {
return null;
}
var dygraph = this;
- Dygraph.addEvent(this.mouseEventElement_, 'mousemove', function(e) {
- dygraph.mouseMove_(e);
- });
- Dygraph.addEvent(this.mouseEventElement_, 'mouseout', function(e) {
- dygraph.mouseOut_(e);
- });
+
+ this.mouseMoveHandler = function(e) {
+ dygraph.mouseMove_(e);
+ };
+ Dygraph.addEvent(this.mouseEventElement_, 'mousemove', this.mouseMoveHandler);
+
+ this.mouseOutHandler = function(e) {
+ dygraph.mouseOut_(e);
+ };
+ Dygraph.addEvent(this.mouseEventElement_, 'mouseout', this.mouseOutHandler);
this.createStatusMessage_();
this.createDragInterface_();
this.resizeHandler = function(e) {
dygraph.resize();
- }
+ };
// Update when the window is resized.
// TODO(danvk): drop frames depending on complexity of the chart.
node.removeChild(node.firstChild);
}
};
+
+ // remove mouse event handlers
+ Dygraph.removeEvent(this.mouseEventElement_, 'mouseout', this.mouseOutHandler);
+ Dygraph.removeEvent(this.mouseEventElement_, 'mousemove', this.mouseMoveHandler);
removeRecursive(this.maindiv_);
var nullOut = function(obj) {
}
for (var i = 0; i < this.axes_.length; i++) {
- if (this.axes_[i].valueWindow !== null) {
+ if (typeof(this.axes_[i].valueWindow) !== 'undefined' && this.axes_[i].valueWindow !== null) {
dirty = true;
dirtyY = true;
}
newValueRanges = [];
for (i = 0; i < this.axes_.length; i++) {
- newValueRanges.push(this.axes_[i].extremeRange);
+ var axis = this.axes_[i];
+ newValueRanges.push(axis.valueRange != null ? axis.valueRange : axis.extremeRange);
}
}