From: Dan Vanderkam Date: Sun, 16 Nov 2014 23:47:31 +0000 (-0500) Subject: fix clearChart double-firing X-Git-Tag: v1.1.0~23^2 X-Git-Url: https://adrianiainlam.tk/git/?a=commitdiff_plain;h=c04c8044c2f04d8db1d7987cc5cb181c03f9d7df;p=dygraphs.git fix clearChart double-firing --- diff --git a/auto_tests/tests/plugins.js b/auto_tests/tests/plugins.js index cff1d92..5655585 100644 --- a/auto_tests/tests/plugins.js +++ b/auto_tests/tests/plugins.js @@ -183,9 +183,8 @@ pluginsTestCase.prototype.testEventSequence = function() { events = []; g.updateOptions({series: {Y1: {color: 'blue'}}}); assertEquals([ - "clearChart", "predraw", - "clearChart", // why is clearChart called twice? + "clearChart", "willDrawChart", "didDrawChart" ], events); @@ -207,9 +206,8 @@ pluginsTestCase.prototype.testEventSequence = function() { assertEquals([ "dataWillUpdate", "dataDidUpdate", - "clearChart", "predraw", - "clearChart", // why is clearChart called twice? + "clearChart", "willDrawChart", "didDrawChart" ], events); diff --git a/dygraph.js b/dygraph.js index c8a1ccf..026365b 100644 --- a/dygraph.js +++ b/dygraph.js @@ -2358,12 +2358,6 @@ Dygraph.prototype.predraw_ = function() { // TODO(danvk): move more computations out of drawGraph_ and into here. this.computeYAxes_(); - // Create a new plotter. - if (this.plotter_) { - this.cascadeEvents_('clearChart'); - this.plotter_.clear(); - } - if (!this.is_initial_draw_) { this.canvas_ctx_.restore(); this.hidden_ctx_.restore(); @@ -2372,6 +2366,7 @@ Dygraph.prototype.predraw_ = function() { this.canvas_ctx_.save(); this.hidden_ctx_.save(); + // Create a new plotter. this.plotter_ = new DygraphCanvasRenderer(this, this.hidden_, this.hidden_ctx_,