File indexing completed on 2025-09-16 09:09:27
0001
0002
0003
0004
0005
0006
0007
0008
0009
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;
0031 Double_t fWmax;
0032 Float_t fGridLength;
0033 Float_t fTickSize;
0034 Float_t fLabelOffset;
0035 Float_t fLabelSize;
0036 Float_t fTitleOffset;
0037 Float_t fTitleSize;
0038 Int_t fNdiv;
0039 Int_t fLabelColor;
0040 Int_t fLabelFont;
0041 Int_t fNModLabs;
0042 TString fChopt;
0043 TString fName;
0044 TString fTitle;
0045 TString fTimeFormat;
0046 TString fFunctionName;
0047 TF1 *fFunction;
0048 TAxis *fAxis;
0049 TList *fModLabs;
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;}
0107 void SetLabelFont(Int_t labelfont) {fLabelFont = labelfont;}
0108 void SetLabelOffset(Float_t labeloffset) {fLabelOffset = labeloffset;}
0109 void SetLabelSize(Float_t labelsize) {fLabelSize = labelsize;}
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 = "");
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 = "");
0118 static void SetMaxDigits(Int_t maxd=5);
0119 virtual void SetName(const char *name);
0120 virtual void SetNdivisions(Int_t ndiv) {fNdiv = ndiv;}
0121 virtual void SetMoreLogLabels(Bool_t more=kTRUE);
0122 virtual void SetNoExponent(Bool_t noExponent=kTRUE);
0123 virtual void SetDecimals(Bool_t dot=kTRUE);
0124 void SetTickSize(Float_t ticksize) {fTickSize = ticksize;}
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="");
0130 void SetTitleOffset(Float_t titleoffset=1) {fTitleOffset = titleoffset;}
0131 void SetTitleSize(Float_t titlesize) {fTitleSize = titlesize;}
0132 void SetTitleFont(Int_t titlefont) {SetTextFont(titlefont);}
0133 void SetTitleColor(Int_t titlecolor) {SetTextColor(titlecolor);}
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)
0141 };
0142
0143 #endif