#include void macro_ex() { TCanvas *c1 = new TCanvas("c1","A Simple Graph Example",200,10,700,500); c1->SetFillColor(42); c1->SetGrid(); TStopwatch sw; sw.Start(); const Int_t max = 10; Double_t x[max]; Double_t y[max]; Double_t c=0; x[0]=0; y[0]=0; gr = new TGraph(1,x, y); gr->SetMarkerStyle(21); gr->SetTitle("Time graph"); gr->GetXaxis()->SetTitle("X title"); gr->GetYaxis()->SetTitle("Y title"); c1->Update(); c1->Clear(); Int_t i =0; while(1){ sw.Stop(); c=sw.RealTime(); sw.Continue(); x[i] = c; if (i%2 == 0) // only to draw triangles y[i] = 2000; else y[i] = 2; gr->SetPoint(i,x[i],y[i]); gr->Draw("AL"); c1->Update(); gSystem->Sleep(1000); i= i+1; if (i==max) i=0; } }