]> git.ipfire.org Git - thirdparty/Chart.js.git/commitdiff
Make the afterUpdate plugin method more useful
authorEvert Timberg <evert.timberg+github@gmail.com>
Mon, 9 May 2016 22:14:15 +0000 (18:14 -0400)
committerTanner Linsley <tannerlinsley@gmail.com>
Mon, 9 May 2016 22:14:15 +0000 (17:14 -0500)
docs/07-Advanced.md
src/core/core.controller.js

index 4bedca3e03e422fb158f24983d58cce4c4735bf3..02f8f09880763ff4a9d2fb3fb83e2e941b0671f2 100644 (file)
@@ -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
index 2548e873435997a6add0c6ff2a23b7c1547ff85d..808c8b934467ad302083e37240f569dd5ad31099 100644 (file)
@@ -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) {