X-Git-Url: https://adrianiainlam.tk/git/?a=blobdiff_plain;f=dygraph.js;h=38c1d05474d2d36d2b30a071c075142a4ff30269;hb=152b74a7864b92596a22a532ddfc535918049781;hp=abd297396150d67d14251e74517376ddebc3757e;hpb=f4b87da223beb6c042a39746b813880f4a465b63;p=dygraphs.git diff --git a/dygraph.js b/dygraph.js index abd2973..38c1d05 100644 --- a/dygraph.js +++ b/dygraph.js @@ -2102,7 +2102,10 @@ Dygraph.prototype.predraw_ = function() { this.computeYAxes_(); // Create a new plotter. - if (this.plotter_) this.plotter_.clear(); + if (this.plotter_) { + this.cascadeEvents_('clearChart'); + this.plotter_.clear(); + } this.plotter_ = new DygraphCanvasRenderer(this, this.hidden_, this.hidden_ctx_, @@ -2330,8 +2333,13 @@ Dygraph.prototype.drawGraph_ = function() { * @private */ Dygraph.prototype.renderGraph_ = function(is_initial_draw) { + this.cascadeEvents_('clearChart'); this.plotter_.clear(); + this.plotter_.render(); + + // TODO(danvk): is this a performance bottleneck when panning? + // The interaction canvas should already be empty in that situation. this.canvas_.getContext('2d').clearRect(0, 0, this.canvas_.width, this.canvas_.height);