| 1 |
// @(#)root/graf:$Name: $:$Id: TMultiGraph.cxx,v 1.6 2002/01/24 11:39:28 rdm Exp $ |
// @(#)root/graf:$Name: $:$Id: TMultiGraph.cxx,v 1.7 2002/01/28 11:51:09 brun Exp $ |
| 2 |
// Author: Rene Brun 12/10/2000 |
// Author: Rene Brun 12/10/2000 |
| 3 |
|
|
| 4 |
/************************************************************************* |
/************************************************************************* |
| 31 |
// TGraph *gr1 = new TGraph(... |
// TGraph *gr1 = new TGraph(... |
| 32 |
// TGraphErrors *gr2 = new TGraphErrors(... |
// TGraphErrors *gr2 = new TGraphErrors(... |
| 33 |
// TMultiGraph *mg = new TMultiGraph(); |
// TMultiGraph *mg = new TMultiGraph(); |
| 34 |
// mg->Add(gr1); |
// mg->Add(gr1,"lp"); |
| 35 |
// mg->Add(gr2); |
// mg->Add(gr2,"cp"); |
| 36 |
// mg->Draw("alp"); |
// mg->Draw("a"); |
| 37 |
|
// |
| 38 |
|
// The drawing option for each TGraph may be specified as an optional |
| 39 |
|
// second argument of the Add function. |
| 40 |
|
// If a draw option is specified, it will be used to draw the graph, |
| 41 |
|
// otherwise the graph will be drawn with the option specified in |
| 42 |
|
// TMultiGraph::Draw |
| 43 |
|
|
| 44 |
//______________________________________________________________________________ |
//______________________________________________________________________________ |
| 45 |
TMultiGraph::TMultiGraph(): TNamed() |
TMultiGraph::TMultiGraph(): TNamed() |
| 78 |
} |
} |
| 79 |
|
|
| 80 |
//______________________________________________________________________________ |
//______________________________________________________________________________ |
| 81 |
void TMultiGraph::Add(TGraph *graph) |
void TMultiGraph::Add(TGraph *graph, Option_t *chopt) |
| 82 |
{ |
{ |
| 83 |
// add a new graph to the list of graphs |
// add a new graph to the list of graphs |
| 84 |
|
|
| 85 |
if (!fGraphs) fGraphs = new TList(); |
if (!fGraphs) fGraphs = new TList(); |
| 86 |
fGraphs->Add(graph); |
fGraphs->Add(graph,chopt); |
| 87 |
} |
} |
| 88 |
|
|
| 89 |
//______________________________________________________________________________ |
//______________________________________________________________________________ |
| 126 |
//*-* ========================================== |
//*-* ========================================== |
| 127 |
// |
// |
| 128 |
// Options to draw a graph are described in TGraph::PainGraph |
// Options to draw a graph are described in TGraph::PainGraph |
| 129 |
|
// |
| 130 |
|
// The drawing option for each TGraph may be specified as an optional |
| 131 |
|
// second argument of the Add function. |
| 132 |
|
// If a draw option is specified, it will be used to draw the graph, |
| 133 |
|
// otherwise the graph will be drawn with the option specified in |
| 134 |
|
// TMultiGraph::Draw |
| 135 |
|
|
| 136 |
AppendPad(option); |
AppendPad(option); |
| 137 |
} |
} |
| 298 |
if (ytitle) {fHistogram->GetYaxis()->SetTitle(ytitle); delete [] ytitle;} |
if (ytitle) {fHistogram->GetYaxis()->SetTitle(ytitle); delete [] ytitle;} |
| 299 |
if (firstx != lastx) fHistogram->GetXaxis()->SetRange(firstx,lastx); |
if (firstx != lastx) fHistogram->GetXaxis()->SetRange(firstx,lastx); |
| 300 |
} |
} |
| 301 |
fHistogram->Paint(); |
fHistogram->Paint("0"); |
| 302 |
} |
} |
| 303 |
|
|
| 304 |
if (fGraphs) { |
if (fGraphs) { |
| 305 |
TIter next(fGraphs); |
TObjOptLink *lnk = (TObjOptLink*)fGraphs->FirstLink(); |
| 306 |
while ((g = (TGraph*) next())) { |
TObject *obj; |
| 307 |
g->Paint(chopt); |
|
| 308 |
|
while (lnk) { |
| 309 |
|
obj = lnk->GetObject(); |
| 310 |
|
if (strlen(lnk->GetOption())) obj->Paint(lnk->GetOption()); |
| 311 |
|
else obj->Paint(chopt); |
| 312 |
|
lnk = (TObjOptLink*)lnk->Next(); |
| 313 |
} |
} |
| 314 |
} |
} |
| 315 |
} |
} |