Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-16 09:09:27

0001 // @(#)root/graf:$Id$
0002 // Author: Rene Brun, Olivier Couet   12/12/94
0003 
0004 /*************************************************************************
0005  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
0006  * All rights reserved.                                                  *
0007  *                                                                       *
0008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
0009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
0010  *************************************************************************/
0011 
0012 #ifndef ROOT_TGaxis
0013 #define ROOT_TGaxis
0014 
0015 #include "TLine.h"
0016 #include "TAttText.h"
0017 #include "TString.h"
0018 
0019 
0020 class TColorNumber;
0021 class TF1;
0022 class TAxis;
0023 class TLatex;
0024 class TAxisModLab;
0025 
0026 class TGaxis : public TLine, public TAttText {
0027 
0028 protected:
0029 
0030    Double_t   fWmin;                ///< Lowest value on the axis
0031    Double_t   fWmax;                ///< Highest value on the axis
0032    Float_t    fGridLength;          ///< Length of the grid in NDC
0033    Float_t    fTickSize;            ///< Size of primary tick mark in NDC
0034    Float_t    fLabelOffset;         ///< Offset of label wrt axis
0035    Float_t    fLabelSize;           ///< Size of labels in NDC
0036    Float_t    fTitleOffset;         ///< Offset of title wrt axis
0037    Float_t    fTitleSize;           ///< Size of title in NDC
0038    Int_t      fNdiv;                ///< Number of divisions
0039    Int_t      fLabelColor;          ///< Color for labels
0040    Int_t      fLabelFont;           ///< Font for labels
0041    Int_t      fNModLabs;            ///< Number of modified labels
0042    TString    fChopt;               ///< Axis options
0043    TString    fName;                ///< Axis name
0044    TString    fTitle;               ///< Axis title
0045    TString    fTimeFormat;          ///< Time format, ex: 09/12/99 12:34:00
0046    TString    fFunctionName;        ///< Name of mapping function pointed by fFunction
0047    TF1       *fFunction;            ///<! Pointer to function computing axis values
0048    TAxis     *fAxis;                ///<! Pointer to original TAxis axis (if any)
0049    TList     *fModLabs;             ///<  List of modified labels.
0050 
0051    TGaxis(const TGaxis&);
0052    TGaxis& operator=(const TGaxis&);
0053 
0054    Bool_t IsOwnedModLabs() const;
0055    void CleanupModLabs();
0056 
0057    TAxisModLab *FindModLab(Int_t indx, Int_t numlabels = 0, Double_t v = 0., Double_t eps = -1.) const;
0058 
0059 public:
0060 
0061    TGaxis();
0062    TGaxis(Double_t xmin,Double_t ymin,Double_t xmax,Double_t ymax,
0063           Double_t wmin,Double_t wmax,Int_t ndiv=510, Option_t *chopt="",
0064           Double_t gridlength = 0);
0065    TGaxis(Double_t xmin,Double_t ymin,Double_t xmax,Double_t ymax,
0066           const char *funcname, Int_t ndiv=510, Option_t *chopt="",
0067           Double_t gridlength = 0);
0068    ~TGaxis() override;
0069 
0070    virtual void        AdjustBinSize(Double_t A1,  Double_t A2,  Int_t nold
0071                                     ,Double_t &BinLow, Double_t &BinHigh, Int_t &nbins, Double_t &BinWidth);
0072    virtual void        CenterLabels(Bool_t center=kTRUE);
0073    virtual void        CenterTitle(Bool_t center=kTRUE);
0074    void                ChangeLabelAttributes(Int_t i, Int_t nlabels, TLatex* t, char* c, Double_t value = 0., Double_t eps = -1.);
0075    virtual TGaxis     *DrawAxis(Double_t xmin,Double_t ymin,Double_t xmax,Double_t ymax,
0076                                 Double_t wmin,Double_t wmax,Int_t ndiv=510, Option_t *chopt="",
0077                                 Double_t gridlength = 0);
0078    Float_t             GetGridLength() const   {return fGridLength;}
0079    TF1                *GetFunction() const     {return fFunction;}
0080    Int_t               GetLabelColor() const   {return fLabelColor;}
0081    Int_t               GetLabelFont() const    {return fLabelFont;}
0082    Float_t             GetLabelOffset() const  {return fLabelOffset;}
0083    Float_t             GetLabelSize() const    {return fLabelSize;}
0084    Float_t             GetTitleOffset() const  {return fTitleOffset;}
0085    Float_t             GetTitleSize() const    {return fTitleSize;}
0086    const char         *GetName() const  override {return fName.Data();}
0087    const char         *GetOption() const override {return fChopt.Data();}
0088    const char         *GetTitle() const override {return fTitle.Data();}
0089    static Int_t        GetMaxDigits();
0090    Int_t               GetNdiv() const         {return fNdiv;}
0091    Double_t            GetWmin() const         {return fWmin;}
0092    Double_t            GetWmax()  const        {return fWmax;}
0093    Float_t             GetTickSize() const     {return fTickSize;}
0094    virtual void        ImportAxisAttributes(TAxis *axis);
0095    void                LabelsLimits(const char *label, Int_t &first, Int_t &last);
0096    void                Paint(Option_t *chopt="") override;
0097    virtual void        PaintAxis(Double_t xmin,Double_t ymin,Double_t xmax,Double_t ymax,
0098                                  Double_t &wmin,Double_t &wmax,Int_t &ndiv, Option_t *chopt="",
0099                                  Double_t gridlength = 0, Bool_t drawGridOnly = kFALSE);
0100    virtual void        Rotate(Double_t X,  Double_t Y,  Double_t CFI, Double_t SFI
0101                              ,Double_t XT, Double_t YT, Double_t &U,   Double_t &V);
0102    void                ResetLabelAttributes(TLatex* t);
0103    void                SavePrimitive(std::ostream &out, Option_t *option = "") override;
0104    void                SetFunction(const char *funcname="");
0105    void                SetOption(Option_t *option="");
0106    void                SetLabelColor(Int_t labelcolor) {fLabelColor = labelcolor;} // *MENU*
0107    void                SetLabelFont(Int_t labelfont) {fLabelFont = labelfont;} // *MENU*
0108    void                SetLabelOffset(Float_t labeloffset) {fLabelOffset = labeloffset;} // *MENU*
0109    void                SetLabelSize(Float_t labelsize) {fLabelSize = labelsize;} // *MENU*
0110    void                ChangeLabel(Int_t labNum=0, Double_t labAngle = -1.,
0111                                    Double_t labSize = -1., Int_t labAlign = -1,
0112                                    Int_t labColor = -1 , Int_t labFont = -1,
0113                                    const TString &labText = ""); // *MENU*
0114    void                ChangeLabelByValue(Double_t labValue, Double_t labAngle = -1.,
0115                                         Double_t labSize = -1., Int_t labAlign = -1,
0116                                         Int_t labColor = -1 , Int_t labFont = -1,
0117                                         const TString &labText = ""); // *MENU*
0118    static void         SetMaxDigits(Int_t maxd=5);
0119    virtual void        SetName(const char *name); // *MENU*
0120    virtual void        SetNdivisions(Int_t ndiv) {fNdiv = ndiv;} // *MENU*
0121    virtual void        SetMoreLogLabels(Bool_t more=kTRUE);  // *MENU*
0122    virtual void        SetNoExponent(Bool_t noExponent=kTRUE);  // *MENU*
0123    virtual void        SetDecimals(Bool_t dot=kTRUE);  // *MENU*
0124    void                SetTickSize(Float_t ticksize) {fTickSize = ticksize;} // *MENU*
0125    void                SetTickLength(Float_t ticklength) {SetTickSize(ticklength);}
0126    void                SetGridLength(Float_t gridlength) {fGridLength = gridlength;}
0127    void                SetTimeFormat(const char *tformat);
0128    void                SetTimeOffset(Double_t toffset, Option_t *option="local");
0129    virtual void        SetTitle(const char *title=""); // *MENU*
0130    void                SetTitleOffset(Float_t titleoffset=1) {fTitleOffset = titleoffset;} // *MENU*
0131    void                SetTitleSize(Float_t titlesize) {fTitleSize = titlesize;} // *MENU*
0132    void                SetTitleFont(Int_t titlefont) {SetTextFont(titlefont);} // *MENU*
0133    void                SetTitleColor(Int_t titlecolor) {SetTextColor(titlecolor);} // *MENU*
0134    void                SetWmin(Double_t wmin) {fWmin = wmin;}
0135    void                SetWmax(Double_t wmax) {fWmax = wmax;}
0136    static void         SetExponentOffset(Float_t xoff=0., Float_t yoff=0., Option_t *axis="xy");
0137 
0138    void SetLabelColor(TColorNumber lcolor);
0139 
0140    ClassDefOverride(TGaxis,6)  //Graphics axis
0141 };
0142 
0143 #endif