mirror of
https://github.com/chartjs/Chart.js.git
synced 2025-12-08 20:36:08 +00:00
Add in a beforeRender plugin event. Makes it easier to handle things that need to happen once at the start of animation but not on every frame
This commit is contained in:
parent
aac9726f7f
commit
f6f8fe5959
@ -390,6 +390,10 @@ Plugins should derive from Chart.PluginBase and implement the following interfac
|
||||
beforeUpdate: function(chartInstance) { },
|
||||
afterUpdate: function(chartInstance) { },
|
||||
|
||||
// This is called at the start of a render. It is only called once, even if the animation will run for a number of frames. Use beforeDraw or afterDraw
|
||||
// to do something on each animation frame
|
||||
beforeRender: function(chartInstance) { },
|
||||
|
||||
// Easing is for animation
|
||||
beforeDraw: function(chartInstance, easing) { },
|
||||
afterDraw: function(chartInstance, easing) { }
|
||||
|
||||
@ -272,6 +272,7 @@ module.exports = function(Chart) {
|
||||
},
|
||||
|
||||
render: function render(duration, lazy) {
|
||||
Chart.pluginService.notifyPlugins('beforeRender', [this]);
|
||||
|
||||
if (this.options.animation && ((typeof duration !== 'undefined' && duration !== 0) || (typeof duration === 'undefined' && this.options.animation.duration !== 0))) {
|
||||
var animation = new Chart.Animation();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user