14void timeSeriesFromCSV_TDF()
20 dir.
Append(
"/visualisation/graphs/");
28 auto d = tdf.Define(
"TimeStamp",
"auto s = string(Col0) + ' ' + Col1; return (float) TDatime(s.c_str()).Convert();")
29 .Define(
"Value",
"(float)Col2");
30 auto timeStamps =
d.Take<
float>(
"TimeStamp");
31 auto values =
d.Take<
float>(
"Value");
34 auto g =
new TGraph(values->size(), timeStamps->data(), values->data());
35 g->SetTitle(
"SWAN Users during July 2017;Time;Number of Sessions");
38 auto c =
new TCanvas(
"c",
"c", 950, 500);
39 c->SetLeftMargin(0.07);
40 c->SetRightMargin(0.04);
45 g->GetYaxis()->CenterTitle();
48 auto xaxis =
g->GetXaxis();
49 xaxis->SetTimeDisplay(1);
51 xaxis->SetTimeFormat(
"%a %d");
52 xaxis->SetTimeOffset(0);
53 xaxis->SetNdivisions(-219);
54 xaxis->SetLimits(
TDatime(2017, 7, 3, 0, 0, 0).Convert(),
TDatime(2017, 7, 22, 0, 0, 0).Convert());
55 xaxis->SetLabelSize(0.025);
56 xaxis->CenterLabels();
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
This class stores the date and time with a precision of one second in an unsigned 32 bit word (950130...
A TGraph is an object made of two arrays X and Y with npoints each.
const char * Data() const
TString & ReplaceAll(const TString &s1, const TString &s2)
TString & Append(const char *cs)
RDataFrame FromCSV(std::string_view fileName, const RCsvDS::ROptions &options)
Factory method to create a CSV RDataFrame.