You have the wrong condition in the first while loop, try setting
while(t1!=0 && t2!=0){
instead of
while(t1==0 && t2==0){
With the condition you use, you immediatly hop to the 2nd loop and the entire file is put inside the 2nd graph, resulting in uninitialized values in the first one .
Hope this helps..