assertEquals(1, results.y2["Y3"]);
assertEquals(1, results.y2["Y4"]);
};
+
+// Test for http://code.google.com/p/dygraphs/issues/detail?id=436
+MultipleAxesTestCase.prototype.testRemovingSecondAxis = function() {
+ var data = MultipleAxesTestCase.getData();
+
+ var results = { y : {}, y2 : {}};
+
+ g = new Dygraph(
+ document.getElementById("graph"),
+ data,
+ {
+ labels: [ 'Date', 'Y1', 'Y2', 'Y3', 'Y4' ],
+ drawPoints : true,
+ pointSize : 3,
+ series : {
+ 'Y4': {
+ axis: 'y2'
+ }
+ },
+ }
+ );
+
+ g.updateOptions({ series : { Y4 : { axis : 'y' } } });
+};
if (valueWindows !== undefined) {
// Restore valueWindow settings.
- for (index = 0; index < valueWindows.length; index++) {
+
+ // When going from two axes back to one, we only restore
+ // one axis.
+ var idxCount = Math.min(valueWindows.length, this.axes_.length);
+
+ for (index = 0; index < idxCount; index++) {
this.axes_[index].valueWindow = valueWindows[index];
}
}