while(dataSet.size()>0){
var data = dataSet.dequeue();
intervalId = setInterval(function(){
loadPointsEverySecond(data)}, updateInterval);
}}
The dataset is a Queue of data JSON Objects. This data json object contains different points and they have to access at a particular interval one after the other. But only the last item in the dataset is accessed in loadPointsEverySecond in all the calls