I'm using a wrapper for Chart.js which allows for an animation callback to determine when the chart is done drawing.
So, my chart options look like this:
public chartOptions: any = {
animation: {
duration: 2000,
onComplete: function () {
//alert('anim complete');
this.chartTestMethod();
}
},
responsive: true
};
and my chartTestMethod() looks like this:
chartTestMethod() {
console.log('chartTestMethod called.');
}
My hope is to have the method chartTestMethod() (which is in the same TypeScript file) called when the chart animation is complete. However, when the animation is complete and that method call line is executed, I get the error:
TypeError: this.chartTestMethod is not a function.
Basically, how can I call that method properly?