Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
124
rated 0 times [  130] [ 6]  / answers: 1 / hits: 21158  / 9 Years ago, sat, june 27, 2015, 12:00:00

Does the library chart.js support any sort of callbacks on specific events? I'm mostly interested in 'on animation end' event, but would be nice to know any other events if they're supported.

If this is not an option, do you know any workarounds? I'm using jQuery and vue.js and I just need to show some additional text on the page (completely outside of the chart itself) when chart.js finishes the animation of the chart.


More From » html

 Answers
7

There is an onAnimationComplete option you can specify to run stuff once the animation completes. See this section of the documentation.



Example



var ctx = document.getElementById(chart).getContext(2d);
var myLine1 = new Chart(ctx).Line(lineChartData1, {
onAnimationComplete: function() {
alert('animation complete')
}
});


Fiddle - http://jsfiddle.net/4vo72rLd/


[#66027] Thursday, June 25, 2015, 9 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
kalli

Total Points: 589
Total Questions: 105
Total Answers: 97

Location: Rwanda
Member since Thu, Feb 10, 2022
2 Years ago
;