TGaxis.h

Go to the documentation of this file.
00001 // @(#)root/graf:$Id: TGaxis.h 20882 2007-11-19 11:31:26Z rdm $
00002 // Author: Rene Brun, Olivier Couet   12/12/94
00003 
00004 /*************************************************************************
00005  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
00006  * All rights reserved.                                                  *
00007  *                                                                       *
00008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
00009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
00010  *************************************************************************/
00011 
00012 #ifndef ROOT_TGaxis
00013 #define ROOT_TGaxis
00014 
00015 
00016 //////////////////////////////////////////////////////////////////////////
00017 //                                                                      //
00018 // TGaxis                                                               //
00019 //                                                                      //
00020 // Service class for the graphical representation of axis.              //
00021 // Instances of this class are generated by the histogram classes and   //
00022 // TGraph.                                                              //
00023 //                                                                      //
00024 //////////////////////////////////////////////////////////////////////////
00025 
00026 #ifndef ROOT_TNamed
00027 #include "TNamed.h"
00028 #endif
00029 #ifndef ROOT_TLine
00030 #include "TLine.h"
00031 #endif
00032 #ifndef ROOT_TAttText
00033 #include "TAttText.h"
00034 #endif
00035 
00036 class TF1;
00037 class TAxis;
00038 
00039 class TGaxis : public TLine, public TAttText {
00040 
00041 protected:
00042    Double_t   fWmin;                //Lowest value on the axis
00043    Double_t   fWmax;                //Highest value on the axis
00044    Float_t    fGridLength;          //Length of the grid in NDC
00045    Float_t    fTickSize;            //Size of primary tick mark in NDC
00046    Float_t    fLabelOffset;         //Offset of label wrt axis
00047    Float_t    fLabelSize;           //Size of labels in NDC
00048    Float_t    fTitleOffset;         //Offset of title wrt axis
00049    Float_t    fTitleSize;           //Size of title in NDC
00050    Int_t      fNdiv;                //Number of divisions
00051    Int_t      fLabelColor;          //Color for labels
00052    Int_t      fLabelFont;           //Font for labels
00053    TString    fChopt;               //Axis options
00054    TString    fName;                //axis name
00055    TString    fTitle;               //axis title
00056    TString    fTimeFormat;          //Time format, ex: 09/12/99 12:34:00
00057    TString    fFunctionName;        //name of mapping function pointed by fFunction
00058    TF1       *fFunction;            //!Pointer to function computing axis values
00059    TAxis     *fAxis;                //!pointer to original TAxis axis (if any)
00060 
00061    static Int_t fgMaxDigits;        //!Number of digits above which the 10>N notation is used
00062 
00063    TGaxis(const TGaxis&); 
00064    TGaxis& operator=(const TGaxis&);
00065 
00066 public:
00067 
00068    TGaxis();
00069    TGaxis(Double_t xmin,Double_t ymin,Double_t xmax,Double_t ymax,
00070           Double_t wmin,Double_t wmax,Int_t ndiv=510, Option_t *chopt="",
00071           Double_t gridlength = 0);
00072    TGaxis(Double_t xmin,Double_t ymin,Double_t xmax,Double_t ymax,
00073           const char *funcname, Int_t ndiv=510, Option_t *chopt="",
00074           Double_t gridlength = 0);
00075    virtual ~TGaxis();
00076 
00077    virtual void        AdjustBinSize(Double_t A1,  Double_t A2,  Int_t nold
00078                                     ,Double_t &BinLow, Double_t &BinHigh, Int_t &nbins, Double_t &BinWidth);
00079    virtual void        CenterLabels(Bool_t center=kTRUE);
00080    virtual void        CenterTitle(Bool_t center=kTRUE);
00081    virtual void        DrawAxis(Double_t xmin,Double_t ymin,Double_t xmax,Double_t ymax,
00082                                 Double_t wmin,Double_t wmax,Int_t ndiv=510, Option_t *chopt="",
00083                                 Double_t gridlength = 0);
00084    Float_t             GetGridLength() const   {return fGridLength;}
00085    TF1                *GetFunction() const     {return fFunction;}
00086    Int_t               GetLabelColor() const   {return fLabelColor;}
00087    Int_t               GetLabelFont() const    {return fLabelFont;}
00088    Float_t             GetLabelOffset() const  {return fLabelOffset;}
00089    Float_t             GetLabelSize() const    {return fLabelSize;}
00090    Float_t             GetTitleOffset() const  {return fTitleOffset;}
00091    Float_t             GetTitleSize() const    {return fTitleSize;}
00092    virtual const char *GetName() const  {return fName.Data();}
00093    virtual const char *GetOption() const {return fChopt.Data();}
00094    virtual const char *GetTitle() const {return fTitle.Data();}
00095    static Int_t        GetMaxDigits();
00096    Int_t               GetNdiv() const         {return fNdiv;}
00097    Double_t            GetWmin() const         {return fWmin;}
00098    Double_t            GetWmax()  const        {return fWmax;}
00099    Float_t             GetTickSize() const     {return fTickSize;}
00100    virtual void        ImportAxisAttributes(TAxis *axis);
00101    void                LabelsLimits(const char *label, Int_t &first, Int_t &last);
00102    virtual void        Paint(Option_t *chopt="");
00103    virtual void        PaintAxis(Double_t xmin,Double_t ymin,Double_t xmax,Double_t ymax,
00104                                  Double_t &wmin,Double_t &wmax,Int_t &ndiv, Option_t *chopt="",
00105                                  Double_t gridlength = 0, Bool_t drawGridOnly = kFALSE);
00106    virtual void        Rotate(Double_t X,  Double_t Y,  Double_t CFI, Double_t SFI
00107                              ,Double_t XT, Double_t YT, Double_t &U,   Double_t &V);
00108    virtual void        SavePrimitive(ostream &out, Option_t *option = "");
00109    void                SetFunction(const char *funcname="");
00110    void                SetOption(Option_t *option="");
00111    void                SetLabelColor(Int_t labelcolor) {fLabelColor = labelcolor;} // *MENU*
00112    void                SetLabelFont(Int_t labelfont) {fLabelFont = labelfont;} // *MENU*
00113    void                SetLabelOffset(Float_t labeloffset) {fLabelOffset = labeloffset;} // *MENU*
00114    void                SetLabelSize(Float_t labelsize) {fLabelSize = labelsize;} // *MENU*
00115    static void         SetMaxDigits(Int_t maxd=5);
00116    virtual void        SetName(const char *name); // *MENU*
00117    virtual void        SetNdivisions(Int_t ndiv) {fNdiv = ndiv;} // *MENU*
00118    virtual void        SetMoreLogLabels(Bool_t more=kTRUE);  // *MENU*
00119    virtual void        SetNoExponent(Bool_t noExponent=kTRUE);  // *MENU*
00120    virtual void        SetDecimals(Bool_t dot=kTRUE);  // *MENU*
00121    void                SetTickSize(Float_t ticksize) {fTickSize = ticksize;} // *MENU*
00122    void                SetGridLength(Float_t gridlength) {fGridLength = gridlength;}
00123    void                SetTimeFormat(const char *tformat);
00124    void                SetTimeOffset(Double_t toffset, Option_t *option="local");
00125    virtual void        SetTitle(const char *title=""); // *MENU*
00126    void                SetTitleOffset(Float_t titleoffset=1) {fTitleOffset = titleoffset;} // *MENU*
00127    void                SetTitleSize(Float_t titlesize) {fTitleSize = titlesize;} // *MENU*
00128    void                SetTitleFont(Int_t titlefont) {SetTextFont(titlefont);} // *MENU*
00129    void                SetTitleColor(Int_t titlecolor) {SetTextColor(titlecolor);} // *MENU*
00130    void                SetWmin(Double_t wmin) {fWmin = wmin;}
00131    void                SetWmax(Double_t wmax) {fWmax = wmax;}
00132 
00133    ClassDef(TGaxis,5)  //Graphics axis
00134 };
00135 
00136 #endif
00137 
00138 

Generated on Tue Jul 5 14:14:08 2011 for ROOT_528-00b_version by  doxygen 1.5.1