Time display with a TMultigraph?

Hi,

How can I use time display with a TMultigraph?

  1. ROOT ignores my timeoffset, for a TGraph I used to do gStyle->SetTimeOffset(timeoffset); but for TMultigraph it doesn’t work
  2. I want to enable a timedisplay on my x axis, but I get a segmentation violation when I try to. I found on google that I should use gPad->Update(); before using the function GetXaxis(), however this did not work. My temporary solution for this is to use Draw(), then access the axis and then Draw() again…

Thanks!

Here is an example which seems to work:

{
   TMultiGraph* mg = new TMultiGraph;
   TGraph* g = new TGraph;
   for (int i = 0; i < 100; i++) g->SetPoint(i, 1289420808+i, i+2);
   mg->Add(g, "P");
   mg->Draw("AP");
   mg->GetXaxis()->SetTimeDisplay(1);
   gPad->Modified();
   gPad->Update();
}

Thank you, it works now.

One more question, how do I know what the options mean in the Add function? They aren’t described in the manual.

they are the draw options of TGraph

Thanks =)