I am plotting a 2 series graph by taking input from 2 different text files. ipGrah1.txt contains the name of these two input file names. updateChart is the function which takes the input file one after another and plot the graph. Now the graph gets plotted only when the window.alert function is used. If i comment this window.alert function, the graph is not getting plotted. Instead of calling the function updateChart directly, it can be called by invoking setInterval function also after every 1 secs. But, on using setInterval function it increases the browsers(in my case mozilla) CPU consumption. Thereby, in my code I am calling the updateChart function directly and additionally using window.alert function.