Chartjs-I have a setInterval function that graphs.

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; }

Leave a comment