-
Notifications
You must be signed in to change notification settings - Fork 12k
Description
Sometimes, when I reload or resize the window with a chart included, Chart.js throws the following error:
TypeError: easingFunction is not a function
I could track it down to this line in the current 2.9.3 release render-function:
var easingFunction = helpers.easing.effects[animationObject.easing];
...
chart.draw(easingFunction(stepDecimal), stepDecimal, currentStep);https://github.com/chartjs/Chart.js/blob/release/src/core/core.controller.js#L650
I notices that the upcoming version 3.0.0 has a completely rewritten animation handling.
But this will be a breaking changes release and I hope 2.9. will still receive some bugfixes.
Expected Behavior
Chart.js should not throw and break the complete application,
instead it should catch the error and write an console.error-message.
Possible Solution
Implement a null-check and do not try to execute the easingFunction.
Steps to Reproduce (for bugs)
Render a chart (Pie, Bar, Line) and resize the window wildly.
this.chartOptions = {
responsive: true,
maintainAspectRatio: false,
legend: false,
};I turned off animations globally:
global.animation = {
duration: 0,
};
global.hover = {
animationDuration: 0,
};
global.responsiveAnimationDuration = 0;Environment
- Chart.js version: 2.9.3
- Browser name and version: Firefox Nightly (Mar 2020)