1👍
I assume you would like something like a fast counter synchronized with chart drawing, can’t you do it with just a for loop refreshing data given to chart.js until you reach their real value ?
No need for a plugin if it’s a that small improvement you need
Example:
final data is [2478,5267,734,784,433]
initial data is [0, 0, 0, 0, 0]
1°) set an interval incrementing data of 1/10 of their value by example, each 200ms
-> after 200ms you now have [247, 526, 73, 78, 43]
2°) cancel interval once you reached final data
You can then play with interval and increment steps (1/100 in stead of 1/10 by example)
Here is a workaround (but I bet you block with chart drawing ?)
const currentData = [0,0,0,0,0];
const finalData = [2478,5267,734,784,433];
const stepTick = 0.1;
let stepNumber = 1;
const redrawingAfter1Step = setInterval(() => {
for(let i = 0; i < currentData.length; i++) {
currentData[i] = stepTick * stepNumber * finalData[i];
}
drawChart(currentData);
if ((stepNumber * stepTick) === 1) {
clearInterval(redrawingAfter1Step);
}
stepNumber++;
}, 500);
Source:stackexchange.com