Skip to content

Commit

Permalink
Clear graph when numAxes goes from 1 -> 2 in updateOptions
Browse files Browse the repository at this point in the history
  • Loading branch information
neurot1k authored and danvk committed May 6, 2018
1 parent 6611837 commit da2a028
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/dygraph.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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.
Expand Down

0 comments on commit da2a028

Please sign in to comment.