function loadGraphInSeq(startDate,endDate,calcSubStart,calcSubEnd){
var graphName=new Array();
$('section div.graph_box').each(function(){
if ($(this).css('display')=='block') {
graphName.push($(this).attr('id'));
}
});
for (index=0;index<graphName.length;index++) {
switch (graphName[index]) {
case 'allquery':
break;
case 'alwazinc':
alwayzincreasing(calcSubStart,calcSubEnd,startDate,endDate);
break;
case 'segment':
ajaxCallingSegment(startDate,endDate,calcSubStart,calcSubEnd);
break;
case 'answeredresponse':
ajaxCallingSegmentRespDay(startDate,endDate,calcSubStart,calcSubEnd);
break;
case 'segmentresponse':
ajaxCallingSegmentRespHours(startDate,endDate,calcSubStart,calcSubEnd);
break;
case 'lessthanDonut':
ajaxCallinglessthanDonut(startDate,endDate,calcSubStart,calcSubEnd,'total');
ajaxCallinglessthanDonut(startDate,endDate,calcSubStart,calcSubEnd,'latency');
ajaxCallinglessthanDonut(startDate,endDate,calcSubStart,calcSubEnd,'delivery');
break;
case 'carrierPie':
ajaxCallingCarrierPie(startDate,endDate,calcSubStart,calcSubEnd);
break;
}
}
}
Let me explain a bit, I have class .graph_box which shows graphs. the order of those divs changes when I change the date loadGraphInSeq is called and I want to load the graph in sequence i.e until and unless one graph is loaded other function should not be called. The function in switch statements call the function to load the graphs. Currently this function load all the function in one go. The graphName stacks all the graphs(who are not hidden) name that need to be loaded.