13 void timeSeriesFromCSV()
18 TString dir = gROOT->GetTutorialDir();
19 dir.Append(
"/graphs/");
20 dir.ReplaceAll(
"/./",
"/");
21 FILE *f = fopen(Form(
"%sSWAN2017.dat", dir.Data()),
"r");
24 auto g =
new TGraph();
25 g->SetTitle(
"SWAN Users during July 2017;Time;Number of Sessions");
33 while (fgets(line, 80, f)) {
34 sscanf(&line[20],
"%f", &v);
35 strncpy(dt, line, 18);
37 g->SetPoint(i, TDatime(dt).Convert(), v);
43 auto c =
new TCanvas(
"c",
"c", 950, 500);
44 c->SetLeftMargin(0.07);
45 c->SetRightMargin(0.04);
48 g->SetLineColor(kBlue);
50 g->GetYaxis()->CenterTitle();
53 auto xaxis = g->GetXaxis();
54 xaxis->SetTimeDisplay(1);
56 xaxis->SetTimeFormat(
"%a %d");
57 xaxis->SetTimeOffset(0);
58 xaxis->SetNdivisions(-219);
59 xaxis->SetLimits(TDatime(2017, 7, 3, 0, 0, 0).Convert(), TDatime(2017, 7, 22, 0, 0, 0).Convert());
60 xaxis->SetLabelSize(0.025);
61 xaxis->CenterLabels();