Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
TGaxis.h
Go to the documentation of this file.
1 // @(#)root/graf:$Id$
2 // Author: Rene Brun, Olivier Couet 12/12/94
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 #ifndef ROOT_TGaxis
13 #define ROOT_TGaxis
14 
15 
16 #include "TNamed.h"
17 #include "TLine.h"
18 #include "TAttText.h"
19 
20 class TF1;
21 class TAxis;
22 class TLatex;
23 
24 class TGaxis : public TLine, public TAttText {
25 
26 protected:
27 
28  Double_t fWmin; ///< Lowest value on the axis
29  Double_t fWmax; ///< Highest value on the axis
30  Float_t fGridLength; ///< Length of the grid in NDC
31  Float_t fTickSize; ///< Size of primary tick mark in NDC
32  Float_t fLabelOffset; ///< Offset of label wrt axis
33  Float_t fLabelSize; ///< Size of labels in NDC
34  Float_t fTitleOffset; ///< Offset of title wrt axis
35  Float_t fTitleSize; ///< Size of title in NDC
36  Int_t fNdiv; ///< Number of divisions
37  Int_t fLabelColor; ///< Color for labels
38  Int_t fLabelFont; ///< Font for labels
39  Int_t fNModLabs; ///< Number of modified labels
40  TString fChopt; ///< Axis options
41  TString fName; ///< Axis name
42  TString fTitle; ///< Axis title
43  TString fTimeFormat; ///< Time format, ex: 09/12/99 12:34:00
44  TString fFunctionName; ///< Name of mapping function pointed by fFunction
45  TF1 *fFunction; ///<! Pointer to function computing axis values
46  TAxis *fAxis; ///<! Pointer to original TAxis axis (if any)
47  TList *fModLabs; ///< List of modified labels.
48 
49  static Int_t fgMaxDigits; ///<! Number of digits above which the 10>N notation is used
50  static Float_t fXAxisExpXOffset; ///<! Exponent X offset for the X axis
51  static Float_t fXAxisExpYOffset; ///<! Exponent Y offset for the X axis
52  static Float_t fYAxisExpXOffset; ///<! Exponent X offset for the Y axis
53  static Float_t fYAxisExpYOffset; ///<! Exponent Y offset for the Y axis
54 
55  TGaxis(const TGaxis&);
56  TGaxis& operator=(const TGaxis&);
57 
58 public:
59 
60  TGaxis();
61  TGaxis(Double_t xmin,Double_t ymin,Double_t xmax,Double_t ymax,
62  Double_t wmin,Double_t wmax,Int_t ndiv=510, Option_t *chopt="",
63  Double_t gridlength = 0);
64  TGaxis(Double_t xmin,Double_t ymin,Double_t xmax,Double_t ymax,
65  const char *funcname, Int_t ndiv=510, Option_t *chopt="",
66  Double_t gridlength = 0);
67  virtual ~TGaxis();
68 
69  virtual void AdjustBinSize(Double_t A1, Double_t A2, Int_t nold
70  ,Double_t &BinLow, Double_t &BinHigh, Int_t &nbins, Double_t &BinWidth);
71  virtual void CenterLabels(Bool_t center=kTRUE);
72  virtual void CenterTitle(Bool_t center=kTRUE);
73  void ChangeLabelAttributes(Int_t i, Int_t nlabels, TLatex* t, char* c);
74  virtual void DrawAxis(Double_t xmin,Double_t ymin,Double_t xmax,Double_t ymax,
75  Double_t wmin,Double_t wmax,Int_t ndiv=510, Option_t *chopt="",
76  Double_t gridlength = 0);
77  Float_t GetGridLength() const {return fGridLength;}
78  TF1 *GetFunction() const {return fFunction;}
79  Int_t GetLabelColor() const {return fLabelColor;}
80  Int_t GetLabelFont() const {return fLabelFont;}
81  Float_t GetLabelOffset() const {return fLabelOffset;}
82  Float_t GetLabelSize() const {return fLabelSize;}
83  Float_t GetTitleOffset() const {return fTitleOffset;}
84  Float_t GetTitleSize() const {return fTitleSize;}
85  virtual const char *GetName() const {return fName.Data();}
86  virtual const char *GetOption() const {return fChopt.Data();}
87  virtual const char *GetTitle() const {return fTitle.Data();}
88  static Int_t GetMaxDigits();
89  Int_t GetNdiv() const {return fNdiv;}
90  Double_t GetWmin() const {return fWmin;}
91  Double_t GetWmax() const {return fWmax;}
92  Float_t GetTickSize() const {return fTickSize;}
93  virtual void ImportAxisAttributes(TAxis *axis);
94  void LabelsLimits(const char *label, Int_t &first, Int_t &last);
95  virtual void Paint(Option_t *chopt="");
96  virtual void PaintAxis(Double_t xmin,Double_t ymin,Double_t xmax,Double_t ymax,
97  Double_t &wmin,Double_t &wmax,Int_t &ndiv, Option_t *chopt="",
98  Double_t gridlength = 0, Bool_t drawGridOnly = kFALSE);
99  virtual void Rotate(Double_t X, Double_t Y, Double_t CFI, Double_t SFI
100  ,Double_t XT, Double_t YT, Double_t &U, Double_t &V);
101  void ResetLabelAttributes(TLatex* t);
102  virtual void SavePrimitive(std::ostream &out, Option_t *option = "");
103  void SetFunction(const char *funcname="");
104  void SetOption(Option_t *option="");
105  void SetLabelColor(Int_t labelcolor) {fLabelColor = labelcolor;} // *MENU*
106  void SetLabelFont(Int_t labelfont) {fLabelFont = labelfont;} // *MENU*
107  void SetLabelOffset(Float_t labeloffset) {fLabelOffset = labeloffset;} // *MENU*
108  void SetLabelSize(Float_t labelsize) {fLabelSize = labelsize;} // *MENU*
109  void ChangeLabel(Int_t labNum=0, Double_t labAngle = -1.,
110  Double_t labSize = -1., Int_t labAlign = -1,
111  Int_t labColor = -1 , Int_t labFont = -1,
112  TString labText = ""); // *MENU*
113  static void SetMaxDigits(Int_t maxd=5);
114  virtual void SetName(const char *name); // *MENU*
115  virtual void SetNdivisions(Int_t ndiv) {fNdiv = ndiv;} // *MENU*
116  virtual void SetMoreLogLabels(Bool_t more=kTRUE); // *MENU*
117  virtual void SetNoExponent(Bool_t noExponent=kTRUE); // *MENU*
118  virtual void SetDecimals(Bool_t dot=kTRUE); // *MENU*
119  void SetTickSize(Float_t ticksize) {fTickSize = ticksize;} // *MENU*
120  void SetTickLength(Float_t ticklength) {SetTickSize(ticklength);}
121  void SetGridLength(Float_t gridlength) {fGridLength = gridlength;}
122  void SetTimeFormat(const char *tformat);
123  void SetTimeOffset(Double_t toffset, Option_t *option="local");
124  virtual void SetTitle(const char *title=""); // *MENU*
125  void SetTitleOffset(Float_t titleoffset=1) {fTitleOffset = titleoffset;} // *MENU*
126  void SetTitleSize(Float_t titlesize) {fTitleSize = titlesize;} // *MENU*
127  void SetTitleFont(Int_t titlefont) {SetTextFont(titlefont);} // *MENU*
128  void SetTitleColor(Int_t titlecolor) {SetTextColor(titlecolor);} // *MENU*
129  void SetWmin(Double_t wmin) {fWmin = wmin;}
130  void SetWmax(Double_t wmax) {fWmax = wmax;}
131  static void SetExponentOffset(Float_t xoff=0., Float_t yoff=0., Option_t *axis="xy");
132 
133  ClassDef(TGaxis,6) //Graphics axis
134 };
135 
136 #endif