From da2a028fc41e5573868358b3d9eda9826211d217 Mon Sep 17 00:00:00 2001 From: Mike Smith Date: Thu, 6 Oct 2016 10:02:39 -0700 Subject: [PATCH] Clear graph when numAxes goes from 1 -> 2 in updateOptions --- src/dygraph.js | 2 ++ 1 file changed, 2 insertions(+) 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. -- 2.7.4