From: Mike Smith Date: Thu, 6 Oct 2016 17:02:39 +0000 (-0700) Subject: Clear graph when numAxes goes from 1 -> 2 in updateOptions X-Git-Url: https://adrianiainlam.tk/git/?a=commitdiff_plain;h=da2a028fc41e5573868358b3d9eda9826211d217;p=dygraphs.git Clear graph when numAxes goes from 1 -> 2 in updateOptions --- diff --git a/src/dygraph.js b/src/dygraph.js index 1de4485..4676a2e 100644 --- a/src/dygraph.js +++ b/src/dygraph.js @@ -3103,6 +3103,7 @@ Dygraph.prototype.updateOptions = function(input_attrs, block_redraw) { // copyUserAttrs_ drops the "file" parameter as a convenience to us. var file = input_attrs.file; var attrs = Dygraph.copyUserAttrs_(input_attrs); + var prevNumAxes = this.attributes_.numAxes(); // TODO(danvk): this is a mess. Move these options into attr_. if ('rollPeriod' in attrs) { @@ -3126,6 +3127,7 @@ Dygraph.prototype.updateOptions = function(input_attrs, block_redraw) { this.attributes_.reparseSeries(); + if (prevNumAxes < this.attributes_.numAxes()) this.plotter_.clear(); if (file) { // This event indicates that the data is about to change, but hasn't yet. // TODO(danvk): support cancellation of the update via this event.