Hi to everybody,
I got a problem with drawing lines in divided canvas.
The code is inserted in a function, the function is called with TCanvas* nscanvas as an argument. nscanvas was divided with nscanvas->Divide(1,3) before calling my function.
Here is the code
//before I load data for filling Graphs and Histo
// OFFSET GRAPH
nscanvas->cd(2);
float yoffset_min = -maxoffset*0.1;
float yoffset_max = maxoffset*1.2;
if(yoffset_max<1e-10)yoffset_max=1;
TH2S* foffset = new TH2S("poffset",title,1,ltime[0],ltime[counter-1],1,yoffset_min,yoffset_max);
foffset->SetXTitle("Date");
foffset->SetYTitle("Offset [THRDAC]");
foffset->SetNdivisions(8);
foffset->GetXaxis()->SetTimeDisplay(1);
foffset->GetXaxis()->SetTimeFormat("%m/%y");
foffset->Draw();
//some graphics
TLine line;
TText text;
line.SetLineStyle(3);
line.SetLineWidth(0.3);
line.SetLineColor(15);
TDatime t(2008,1,1,0,0,0);
line.DrawLine(t.Convert(),yoffset_min,t.Convert(),yoffset_max); // start 2008
t.Set(2007,1,1,0,0,0);
line.DrawLine(t.Convert(),yoffset_min,t.Convert(),yoffset_max); // start 2007
t.Set(2006,1,1,0,0,0);
line.DrawLine(t.Convert(),yoffset_min,t.Convert(),yoffset_max); // start 2006
t.Set(2005,1,1,0,0,0);
line.DrawLine(t.Convert(),yoffset_min,t.Convert(),yoffset_max); // start 2005
t.Set(2004,1,1,0,0,0);
line.DrawLine(t.Convert(),yoffset_min,t.Convert(),yoffset_max); // start 2004
t.Set(2003,1,1,0,0,0);
line.DrawLine(t.Convert(),yoffset_min,t.Convert(),yoffset_max); // start 2003
t.Set(2002,1,1,0,0,0);
line.DrawLine(t.Convert(),yoffset_min,t.Convert(),yoffset_max); // start 2002
t.Set(2001,1,1,0,0,0);
line.DrawLine(t.Convert(),yoffset_min,t.Convert(),yoffset_max); // start 2001
t.Set(2000,1,1,0,0,0);
line.DrawLine(t.Convert(),yoffset_min,t.Convert(),yoffset_max); // start 2000
text.SetTextColor(16);
float pos=yoffset_min+(yoffset_max-yoffset_min)*.93;
text.DrawText( 913000000,pos,"1999");
text.DrawText( 948000000,pos,"2000");
text.DrawText( 982000000,pos,"2001");
text.DrawText(1016000000,pos,"2002");
text.DrawText(1047000000,pos,"2003");
text.DrawText(1078000000,pos,"2004");
text.DrawText(1109000000,pos,"2005");
text.DrawText(1140000000,pos,"2006");
text.DrawText(1171000000,pos,"2007");
text.DrawText(1202000000,pos,"2008");
text.SetTextColor(1);
gPad->Update();
for (Int_t chip=0; chip<nchips; chip++) { //offset Graph
if(i==0 && unbdchip_empty[chip])continue;
TGraphErrors* goffset = new TGraphErrors(counter, ltime, offset_act+chip*nentries,0,eoffset_act+chip*nentries);
sprintf(label, "Chip %d", chip);
legend->AddEntry(goffset, label, "p");
goffset->SetMarkerColor(color[chip]);
goffset->SetMarkerStyle(24);
goffset->SetMarkerSize(0.5);
goffset->Draw("p");
goffset->SetLineColor(color[chip]);
}
legend->Draw();
gPad->Update();
The cose runs and draws my graph, but it doesn’t Draw lines and text!
I tried drawing lines without using Datetime, but it draws line on the entire pad, not on first one only.
I thanks in advance everyone who will help me!