[Chartjs]-Callback after line chart rendered

20๐Ÿ‘

โœ…

You can use onComplete callback function of animation. This will be called after the chart (animation) is completely rendered.

options: {
   animation: {
      onComplete: function() {
         alert('Line Chart Rendered Completely!');
      }
   },
   ...
}

1๐Ÿ‘

if you want to run your logic only for one time after render,

options: {
   animation: {
      onComplete: function(chart) {
      if(chart.initial){
         alert('do something here only for one time after render');
      }

      }
   },
   ...
}

Leave a comment