// @(#)root/graf:$Id$
// Author: Rene Brun, Olivier Couet   12/12/94

/*************************************************************************
 * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
 * All rights reserved.                                                  *
 *                                                                       *
 * For the licensing terms see $ROOTSYS/LICENSE.                         *
 * For the list of contributors see $ROOTSYS/README/CREDITS.             *
 *************************************************************************/

#ifndef ROOT_TGaxis
#define ROOT_TGaxis


//////////////////////////////////////////////////////////////////////////
//                                                                      //
// TGaxis                                                               //
//                                                                      //
// Service class for the graphical representation of axis.              //
// Instances of this class are generated by the histogram classes and   //
// TGraph.                                                              //
//                                                                      //
//////////////////////////////////////////////////////////////////////////

#ifndef ROOT_TNamed
#include "TNamed.h"
#endif
#ifndef ROOT_TLine
#include "TLine.h"
#endif
#ifndef ROOT_TAttText
#include "TAttText.h"
#endif

class TF1;
class TAxis;

class TGaxis : public TLine, public TAttText {

protected:
   Double_t   fWmin;                //Lowest value on the axis
   Double_t   fWmax;                //Highest value on the axis
   Float_t    fGridLength;          //Length of the grid in NDC
   Float_t    fTickSize;            //Size of primary tick mark in NDC
   Float_t    fLabelOffset;         //Offset of label wrt axis
   Float_t    fLabelSize;           //Size of labels in NDC
   Float_t    fTitleOffset;         //Offset of title wrt axis
   Float_t    fTitleSize;           //Size of title in NDC
   Int_t      fNdiv;                //Number of divisions
   Int_t      fLabelColor;          //Color for labels
   Int_t      fLabelFont;           //Font for labels
   TString    fChopt;               //Axis options
   TString    fName;                //axis name
   TString    fTitle;               //axis title
   TString    fTimeFormat;          //Time format, ex: 09/12/99 12:34:00
   TString    fFunctionName;        //name of mapping function pointed by fFunction
   TF1       *fFunction;            //!Pointer to function computing axis values
   TAxis     *fAxis;                //!pointer to original TAxis axis (if any)

   static Int_t fgMaxDigits;        //!Number of digits above which the 10>N notation is used
   static Float_t fXAxisExpXOffset; //!Exponent X offset for the X axis
   static Float_t fXAxisExpYOffset; //!Exponent Y offset for the X axis
   static Float_t fYAxisExpXOffset; //!Exponent X offset for the Y axis
   static Float_t fYAxisExpYOffset; //!Exponent Y offset for the Y axis

   TGaxis(const TGaxis&);
   TGaxis& operator=(const TGaxis&);

public:

   TGaxis();
   TGaxis(Double_t xmin,Double_t ymin,Double_t xmax,Double_t ymax,
          Double_t wmin,Double_t wmax,Int_t ndiv=510, Option_t *chopt="",
          Double_t gridlength = 0);
   TGaxis(Double_t xmin,Double_t ymin,Double_t xmax,Double_t ymax,
          const char *funcname, Int_t ndiv=510, Option_t *chopt="",
          Double_t gridlength = 0);
   virtual ~TGaxis();

   virtual void        AdjustBinSize(Double_t A1,  Double_t A2,  Int_t nold
                                    ,Double_t &BinLow, Double_t &BinHigh, Int_t &nbins, Double_t &BinWidth);
   virtual void        CenterLabels(Bool_t center=kTRUE);
   virtual void        CenterTitle(Bool_t center=kTRUE);
   virtual void        DrawAxis(Double_t xmin,Double_t ymin,Double_t xmax,Double_t ymax,
                                Double_t wmin,Double_t wmax,Int_t ndiv=510, Option_t *chopt="",
                                Double_t gridlength = 0);
   Float_t             GetGridLength() const   {return fGridLength;}
   TF1                *GetFunction() const     {return fFunction;}
   Int_t               GetLabelColor() const   {return fLabelColor;}
   Int_t               GetLabelFont() const    {return fLabelFont;}
   Float_t             GetLabelOffset() const  {return fLabelOffset;}
   Float_t             GetLabelSize() const    {return fLabelSize;}
   Float_t             GetTitleOffset() const  {return fTitleOffset;}
   Float_t             GetTitleSize() const    {return fTitleSize;}
   virtual const char *GetName() const  {return fName.Data();}
   virtual const char *GetOption() const {return fChopt.Data();}
   virtual const char *GetTitle() const {return fTitle.Data();}
   static Int_t        GetMaxDigits();
   Int_t               GetNdiv() const         {return fNdiv;}
   Double_t            GetWmin() const         {return fWmin;}
   Double_t            GetWmax()  const        {return fWmax;}
   Float_t             GetTickSize() const     {return fTickSize;}
   virtual void        ImportAxisAttributes(TAxis *axis);
   void                LabelsLimits(const char *label, Int_t &first, Int_t &last);
   virtual void        Paint(Option_t *chopt="");
   virtual void        PaintAxis(Double_t xmin,Double_t ymin,Double_t xmax,Double_t ymax,
                                 Double_t &wmin,Double_t &wmax,Int_t &ndiv, Option_t *chopt="",
                                 Double_t gridlength = 0, Bool_t drawGridOnly = kFALSE);
   virtual void        Rotate(Double_t X,  Double_t Y,  Double_t CFI, Double_t SFI
                             ,Double_t XT, Double_t YT, Double_t &U,   Double_t &V);
   virtual void        SavePrimitive(std::ostream &out, Option_t *option = "");
   void                SetFunction(const char *funcname="");
   void                SetOption(Option_t *option="");
   void                SetLabelColor(Int_t labelcolor) {fLabelColor = labelcolor;} // *MENU*
   void                SetLabelFont(Int_t labelfont) {fLabelFont = labelfont;} // *MENU*
   void                SetLabelOffset(Float_t labeloffset) {fLabelOffset = labeloffset;} // *MENU*
   void                SetLabelSize(Float_t labelsize) {fLabelSize = labelsize;} // *MENU*
   static void         SetMaxDigits(Int_t maxd=5);
   virtual void        SetName(const char *name); // *MENU*
   virtual void        SetNdivisions(Int_t ndiv) {fNdiv = ndiv;} // *MENU*
   virtual void        SetMoreLogLabels(Bool_t more=kTRUE);  // *MENU*
   virtual void        SetNoExponent(Bool_t noExponent=kTRUE);  // *MENU*
   virtual void        SetDecimals(Bool_t dot=kTRUE);  // *MENU*
   void                SetTickSize(Float_t ticksize) {fTickSize = ticksize;} // *MENU*
   void                SetTickLength(Float_t ticklength) {SetTickSize(ticklength);}
   void                SetGridLength(Float_t gridlength) {fGridLength = gridlength;}
   void                SetTimeFormat(const char *tformat);
   void                SetTimeOffset(Double_t toffset, Option_t *option="local");
   virtual void        SetTitle(const char *title=""); // *MENU*
   void                SetTitleOffset(Float_t titleoffset=1) {fTitleOffset = titleoffset;} // *MENU*
   void                SetTitleSize(Float_t titlesize) {fTitleSize = titlesize;} // *MENU*
   void                SetTitleFont(Int_t titlefont) {SetTextFont(titlefont);} // *MENU*
   void                SetTitleColor(Int_t titlecolor) {SetTextColor(titlecolor);} // *MENU*
   void                SetWmin(Double_t wmin) {fWmin = wmin;}
   void                SetWmax(Double_t wmax) {fWmax = wmax;}
   static void         SetExponentOffset(Float_t xoff=0., Float_t yoff=0., Option_t *axis="xy");

   ClassDef(TGaxis,5)  //Graphics axis
};

#endif


 TGaxis.h:1
 TGaxis.h:2
 TGaxis.h:3
 TGaxis.h:4
 TGaxis.h:5
 TGaxis.h:6
 TGaxis.h:7
 TGaxis.h:8
 TGaxis.h:9
 TGaxis.h:10
 TGaxis.h:11
 TGaxis.h:12
 TGaxis.h:13
 TGaxis.h:14
 TGaxis.h:15
 TGaxis.h:16
 TGaxis.h:17
 TGaxis.h:18
 TGaxis.h:19
 TGaxis.h:20
 TGaxis.h:21
 TGaxis.h:22
 TGaxis.h:23
 TGaxis.h:24
 TGaxis.h:25
 TGaxis.h:26
 TGaxis.h:27
 TGaxis.h:28
 TGaxis.h:29
 TGaxis.h:30
 TGaxis.h:31
 TGaxis.h:32
 TGaxis.h:33
 TGaxis.h:34
 TGaxis.h:35
 TGaxis.h:36
 TGaxis.h:37
 TGaxis.h:38
 TGaxis.h:39
 TGaxis.h:40
 TGaxis.h:41
 TGaxis.h:42
 TGaxis.h:43
 TGaxis.h:44
 TGaxis.h:45
 TGaxis.h:46
 TGaxis.h:47
 TGaxis.h:48
 TGaxis.h:49
 TGaxis.h:50
 TGaxis.h:51
 TGaxis.h:52
 TGaxis.h:53
 TGaxis.h:54
 TGaxis.h:55
 TGaxis.h:56
 TGaxis.h:57
 TGaxis.h:58
 TGaxis.h:59
 TGaxis.h:60
 TGaxis.h:61
 TGaxis.h:62
 TGaxis.h:63
 TGaxis.h:64
 TGaxis.h:65
 TGaxis.h:66
 TGaxis.h:67
 TGaxis.h:68
 TGaxis.h:69
 TGaxis.h:70
 TGaxis.h:71
 TGaxis.h:72
 TGaxis.h:73
 TGaxis.h:74
 TGaxis.h:75
 TGaxis.h:76
 TGaxis.h:77
 TGaxis.h:78
 TGaxis.h:79
 TGaxis.h:80
 TGaxis.h:81
 TGaxis.h:82
 TGaxis.h:83
 TGaxis.h:84
 TGaxis.h:85
 TGaxis.h:86
 TGaxis.h:87
 TGaxis.h:88
 TGaxis.h:89
 TGaxis.h:90
 TGaxis.h:91
 TGaxis.h:92
 TGaxis.h:93
 TGaxis.h:94
 TGaxis.h:95
 TGaxis.h:96
 TGaxis.h:97
 TGaxis.h:98
 TGaxis.h:99
 TGaxis.h:100
 TGaxis.h:101
 TGaxis.h:102
 TGaxis.h:103
 TGaxis.h:104
 TGaxis.h:105
 TGaxis.h:106
 TGaxis.h:107
 TGaxis.h:108
 TGaxis.h:109
 TGaxis.h:110
 TGaxis.h:111
 TGaxis.h:112
 TGaxis.h:113
 TGaxis.h:114
 TGaxis.h:115
 TGaxis.h:116
 TGaxis.h:117
 TGaxis.h:118
 TGaxis.h:119
 TGaxis.h:120
 TGaxis.h:121
 TGaxis.h:122
 TGaxis.h:123
 TGaxis.h:124
 TGaxis.h:125
 TGaxis.h:126
 TGaxis.h:127
 TGaxis.h:128
 TGaxis.h:129
 TGaxis.h:130
 TGaxis.h:131
 TGaxis.h:132
 TGaxis.h:133
 TGaxis.h:134
 TGaxis.h:135
 TGaxis.h:136
 TGaxis.h:137
 TGaxis.h:138
 TGaxis.h:139
 TGaxis.h:140
 TGaxis.h:141
 TGaxis.h:142
 TGaxis.h:143
 TGaxis.h:144