[root] / trunk / hist / hist / src / TMultiGraph.cxx Repository:
ViewVC logotype

Diff of /trunk/hist/hist/src/TMultiGraph.cxx

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 3799, Mon Jan 28 11:51:09 2002 UTC revision 4037, Tue Feb 19 17:43:41 2002 UTC
# Line 1  Line 1 
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  /*************************************************************************  /*************************************************************************
# Line 31  Line 31 
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()
# Line 72  Line 78 
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  //______________________________________________________________________________  //______________________________________________________________________________
# Line 120  Line 126 
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  }  }
# Line 286  Line 298 
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  }  }

Legend:
Removed from v.3799  
changed lines
  Added in v.4037

Subversion Admin
ViewVC Help
Powered by ViewVC 1.0.9