0👍
Something like this maybe?
var graphingID = setInterval(function(){
if (itertn == char.length){// is it time to stop? if yes clear interval
clearInterval(graphingID);
}
else{// if not, go on as usual
itertn++;
//Add two random numbers for each dataset
myLiveChart.addData([char[itertn], char[itertn]], ++latestLabel);
// Remove the first point so we dont just add values forever
//updateDaw();
myLiveChart.removeData(2);
}
}, 50);
0👍
Don’t continue when clearing:
if (itertn == char.length){ clearInterval(graphingID); return; }
- Chartjs-ChartJS showing wrong dataset following visibility property toggle
- Chartjs-Chart.js – Uncaught ReferenceError: chart is not defined
Source:stackexchange.com