/// \file /// \ingroup tutorial_http /// This program creates a simple TGraph and updates it regularly /// All objects can be seen in web browser is open url: /// ~~~ /// http://localhost:8080 /// ~~~ /// /// \macro_code /// /// \author Sergey Linev #include #include #include #include #include TGraph *gr = new TGraph(100); int cnt = 0; void update_graph() { for (int n=0;n<100;n++) { gr->SetPoint(n, n+cnt, 10*TMath::Sin((n+cnt)/10.)); } gr->GetXaxis()->SetLimits(cnt - 5, cnt + 105); gr->GetYaxis()->SetLimits(-11, 11); cnt++; } void http_graph() { // Create some histograms, a profile histogram and an ntuple gr->SetName("graph"); gr->SetTitle("Sinus"); update_graph(); // http server with port 8080, use jobname as top-folder name THttpServer* serv = new THttpServer("http:8080"); serv->Register("/", gr); serv->SetItemField("/","_monitoring","100"); serv->SetItemField("/","_layout","simple"); serv->SetItemField("/","_drawitem","graph"); serv->SetItemField("/","_drawopt","AL"); TTimer *tm = new TTimer(100); tm->SetCommand("update_graph()"); tm->TurnOn(); }