From: Evert Timberg Date: Mon, 9 May 2016 22:14:15 +0000 (-0400) Subject: Make the afterUpdate plugin method more useful X-Git-Tag: v2.1.3~11 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=23722a8b2510e739a40cbebf04e3eba85ac23a27;p=thirdparty%2FChart.js.git Make the afterUpdate plugin method more useful --- diff --git a/docs/07-Advanced.md b/docs/07-Advanced.md index 4bedca3e0..02f8f0988 100644 --- a/docs/07-Advanced.md +++ b/docs/07-Advanced.md @@ -377,9 +377,10 @@ Plugins will be called at the following times * Start of initialization * End of initialization * Start of update -* End of update +* End of update (before render occurs) * Start of draw * End of draw +* Before an animation is started Plugins should derive from Chart.PluginBase and implement the following interface ```javascript diff --git a/src/core/core.controller.js b/src/core/core.controller.js index 2548e8734..808c8b934 100644 --- a/src/core/core.controller.js +++ b/src/core/core.controller.js @@ -267,9 +267,10 @@ module.exports = function(Chart) { this.getDatasetMeta(datasetIndex).controller.update(); }, this); - this.render(animationDuration, lazy); - + // Do this before render so that any plugins that need final scale updates can use it Chart.pluginService.notifyPlugins('afterUpdate', [this]); + + this.render(animationDuration, lazy); }, render: function render(duration, lazy) {