128 const char *formatstr =
nullptr;
129 Int_t reasformat = 0;
135 length =
gPad->GetUxmax() -
gPad->GetUxmin();
147 n = ndiv - (ndiv/100)*100;
155 awidth /= 60; reasformat = 2;
158 awidth /=60; reasformat = 3;
161 awidth /= 24; reasformat = 4;
163 if (awidth>=15.218425) {
164 awidth /= 30.43685; reasformat = 5;
167 awidth /= 12; reasformat = 6;
169 awidth /= 12; reasformat = 7;
178 switch (reasformat) {
189 formatstr =
"%d-%Hh";
195 formatstr =
"%d/%m/%y";
198 formatstr =
"%d/%m/%y";
284 gPad->ExecuteEventAxis(
event,px,py,
this);
299 if (
IsAlphanumeric() &&
gDebug)
Info(
"FindBin",
"Numeric query on alphanumeric axis - Sorting the bins or extending the axes / rebinning can alter the correspondence between the label and the bin interval.");
306 }
else if ( !(
x <
fXmax)) {
366 Info(
"FindBin",
"Label %s is not in the list and the axis is not alphanumeric - ignore it",label);
370 Info(
"FindBin",
"Label %s not in the list. It will be added to the histogram",label);
424 }
else if ( !(
x <
fXmax)) {
443 if (bin <= 0 || bin >
fNbins)
return "";
448 if (binid == bin)
return obj->
GetName();
483 return fXmin + (bin-1) * binwidth + 0.5*binwidth;
506 low =
fXmin + (bin-1) * binwidth;
522 return fXmin + (bin-1) * binwidth;
532 return fXmin + bin*binwidth;
542 if (
fNbins <= 0)
return 0;
545 if (bin <1 ) bin = 1;
580 return timeformat.
Data();
616 Warning(
"Sort",
"Cannot sort. No labels");
621 Error(
"Sort",
"Axis has no parent");
667 out<<
" "<<
name<<subname<<
"->SetTitle("<<quote<<t.
Data()<<quote<<
");"<<std::endl;
670 out<<
" "<<
name<<subname<<
"->SetTimeDisplay(1);"<<std::endl;
671 out<<
" "<<
name<<subname<<
"->SetTimeFormat("<<quote<<
GetTimeFormat()<<quote<<
");"<<std::endl;
677 out<<
" "<<
name<<subname<<
"->SetBinLabel("<<obj->
GetUniqueID()<<
","<<quote<<obj->
GetName()<<quote<<
");"<<std::endl;
682 out<<
" "<<
name<<subname<<
"->SetRange("<<
fFirst<<
","<<
fLast<<
");"<<std::endl;
686 out<<
" "<<
name<<subname<<
"->SetBit(TAxis::kLabelsHori);"<<std::endl;
690 out<<
" "<<
name<<subname<<
"->SetBit(TAxis::kLabelsVert);"<<std::endl;
694 out<<
" "<<
name<<subname<<
"->SetBit(TAxis::kLabelsDown);"<<std::endl;
698 out<<
" "<<
name<<subname<<
"->SetBit(TAxis::kLabelsUp);"<<std::endl;
702 out<<
" "<<
name<<subname<<
"->CenterLabels(true);"<<std::endl;
706 out<<
" "<<
name<<subname<<
"->CenterTitle(true);"<<std::endl;
710 out<<
" "<<
name<<subname<<
"->RotateTitle(true);"<<std::endl;
714 out<<
" "<<
name<<subname<<
"->SetDecimals();"<<std::endl;
718 out<<
" "<<
name<<subname<<
"->SetMoreLogLabels();"<<std::endl;
722 out<<
" "<<
name<<subname<<
"->SetNoExponent();"<<std::endl;
748 for (bin=0; bin<=
fNbins; bin++)
750 for (bin=1; bin<=
fNbins; bin++)
752 Error(
"TAxis::Set",
"bins must be in increasing order");
766 for (bin=0; bin<=
fNbins; bin++)
768 for (bin=1; bin<=
fNbins; bin++)
770 Error(
"TAxis::Set",
"bins must be in increasing order");
782 else fBits2 &= ~kAlphanumeric;
794 if (s[0] != 0. &&
gDebug > 0)
795 Info(
"SetAlphanumeric",
"Cannot switch axis %s of histogram %s to alphanumeric: it has non-zero content",
GetName(),
h->GetName());
827 if (bin <= 0 || bin >
fNbins) {
828 Error(
"SetBinLabel",
"Illegal bin number: %d",bin);
926 if (last <
first || (
first < 0 && last < 0) ||
927 (
first > nCells && last > nCells) || (
first == 0 && last == 0)
934 fLast = std::min(last, nCells);
948 if (!strstr(
GetName(),
"xaxis")) {
1024 if (timeformat.
Index(
"%F")>=0 || timeformat.
IsNull()) {
1058 timeoff = (time_t)((
Long_t)(toffset));
1061 utctis = gmtime(&timeoff);
1063 strftime(tmp,20,
"%Y-%m-%d %H:%M:%S",utctis);
1079void TAxis::Streamer(
TBuffer &R__b)
1089 TNamed::Streamer(R__b);
1090 TAttAxis::Streamer(R__b);
1135 Warning(
"TAxis::UnZoom",
"Cannot UnZoom if gPad does not exist. Did you mean to draw the TAxis first?");
1143 if (!strstr(
GetName(),
"xaxis")) {
1146 if (strstr(
GetName(),
"zaxis")) {
1153 if (strcmp(hobj1->
GetName(),
"hframe") == 0 ) {
1168 TIter next(
gPad->GetListOfPrimitives());
1170 while ((obj= next())) {
1173 if (hobj == hobj1)
continue;
1174 if (!strstr(
GetName(),
"xaxis")) {
1176 if (strstr(
GetName(),
"zaxis")) {
1185 if (strcmp(hobj->
GetName(),
"hframe") == 0 ) {
1210 if (factor <= 0) factor = 2;
R__EXTERN TStyle * gStyle
void Copy(TArrayD &array) const
void Set(Int_t n)
Set size of this array to n doubles.
Manages histogram axis attributes.
virtual Color_t GetTitleColor() const
virtual Color_t GetLabelColor() const
virtual Int_t GetNdivisions() const
virtual Color_t GetAxisColor() const
virtual void SetTitleOffset(Float_t offset=1)
Set distance between the axis and the axis title.
virtual Style_t GetTitleFont() const
virtual Float_t GetLabelOffset() const
virtual void SetAxisColor(Color_t color=1, Float_t alpha=1.)
Set color of the line axis and tick marks.
virtual void SetLabelSize(Float_t size=0.04)
Set size of axis labels.
virtual Style_t GetLabelFont() const
virtual void SetTitleFont(Style_t font=62)
Set the title font.
virtual void SetLabelOffset(Float_t offset=0.005)
Set distance between the axis and the labels.
virtual void SetLabelFont(Style_t font=62)
Set labels' font.
virtual void SetTitleSize(Float_t size=0.04)
Set size of axis title.
virtual void SaveAttributes(std::ostream &out, const char *name, const char *subname)
Save axis attributes as C++ statement(s) on output stream out.
virtual void SetTitleColor(Color_t color=1)
Set color of axis title.
virtual Float_t GetTitleSize() const
virtual Float_t GetLabelSize() const
virtual Float_t GetTickLength() const
virtual void ResetAttAxis(Option_t *option="")
Reset axis attributes.
virtual Float_t GetTitleOffset() const
virtual void SetTickLength(Float_t length=0.03)
Set tick mark length.
virtual void SetNdivisions(Int_t n=510, Bool_t optim=kTRUE)
Set the number of divisions for this axis.
void Copy(TAttAxis &attaxis) const
Copy of the object.
virtual void SetLabelColor(Color_t color=1, Float_t alpha=1.)
Set color of labels.
TAxis helper class used to store the modified labels.
void SetColor(Int_t c=-1)
Set modified label color.
void SetSize(Double_t s=-1.)
Set modified label size.
void SetFont(Int_t f=-1)
Set modified label font.
void SetText(TString t="")
Set modified label text.
void SetAlign(Int_t a=-1)
Set modified label alignment.
void SetLabNum(Int_t n=0)
Set modified label number.
void SetAngle(Double_t a=-1.)
Set modified label angle.
Class to manage histogram axis.
virtual void GetCenter(Double_t *center) const
Return an array with the center of all bins.
virtual void SetTimeOffset(Double_t toffset, Option_t *option="local")
Change the time offset If option = "gmt", set display mode to GMT.
virtual void LabelsOption(Option_t *option="h")
Set option(s) to draw axis with labels option can be:
virtual void SetDefaults()
Set axis default values (from TStyle)
virtual void SetBinLabel(Int_t bin, const char *label)
Set label for bin.
Int_t fLast
Last bin to display.
Bool_t IsAlphanumeric() const
virtual void ZoomOut(Double_t factor=0, Double_t offset=0)
Zoom out by a factor of 'factor' (default =2) uses previous zoom factor by default Keep center define...
virtual Double_t GetBinCenter(Int_t bin) const
Return center of bin.
TObject * fParent
! Object owning this axis
Double_t fXmax
Upper edge of last bin.
TArrayD fXbins
Bin edges array in X.
TAxis()
Default constructor.
virtual void UnZoom()
Reset first & last bin to the full range.
THashList * fLabels
List of labels.
void SetCanExtend(Bool_t canExtend)
virtual void SetTicks(Option_t *option="+")
Set ticks orientation.
virtual void SaveAttributes(std::ostream &out, const char *name, const char *subname)
Save axis attributes as C++ statement(s) on output stream out.
@ kCenterLabels
Bit 13 is used by TObject.
virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py)
Execute action corresponding to one event.
Bool_t fTimeDisplay
On/off displaying time values instead of numerics.
TList * fModLabs
List of modified labels.
const char * GetBinLabel(Int_t bin) const
Return label for bin.
virtual Int_t FindBin(Double_t x)
Find bin number corresponding to abscissa x.
virtual Double_t GetBinLowEdge(Int_t bin) const
Return low edge of bin.
Int_t fNbins
Number of bins.
@ kAlphanumeric
Axis is alphanumeric.
Double_t fXmin
Low edge of first bin.
virtual void Set(Int_t nbins, Double_t xmin, Double_t xmax)
Initialize axis with fix bins.
Bool_t HasBinWithoutLabel() const
This helper function checks if there is a bin without a label if all bins have labels,...
virtual Int_t FindFixBin(Double_t x) const
Find bin number corresponding to abscissa x.
const char * ChooseTimeFormat(Double_t axislength=0)
Choose a reasonable time format from the coordinates in the active pad and the number of divisions in...
virtual void Copy(TObject &axis) const
Copy axis structure to another axis.
Int_t GetLast() const
Return last bin on the axis i.e.
virtual void ImportAttributes(const TAxis *axis)
Copy axis attributes to this.
virtual const char * GetTimeFormatOnly() const
Return only the time format from the string fTimeFormat.
virtual Double_t GetBinCenterLog(Int_t bin) const
Return center of bin in log With a log-equidistant binning for a bin with low and up edges,...
void SetAlphanumeric(Bool_t alphanumeric=kTRUE)
Set axis alphanumeric.
virtual Int_t DistancetoPrimitive(Int_t px, Int_t py)
Compute distance from point px,py to an axis.
TAxis & operator=(const TAxis &)
Assignment operator.
virtual void SetRangeUser(Double_t ufirst, Double_t ulast)
Set the viewing range for the axis from ufirst to ulast (in user coordinates, that is,...
virtual const char * GetTimeFormat() const
virtual void GetLowEdge(Double_t *edge) const
Return an array with the low edge of all bins.
const char * GetTitle() const
Returns title of object.
virtual void SetTimeFormat(const char *format="")
Change the format used for time plotting.
virtual ~TAxis()
Destructor.
Bool_t CanBeAlphanumeric()
TString fTimeFormat
Date&time format, ex: 09/12/99 12:34:00.
virtual TObject * GetParent() const
virtual void SetRange(Int_t first=0, Int_t last=0)
Set the viewing range for the axis using bin numbers.
virtual Double_t GetBinWidth(Int_t bin) const
Return bin width.
virtual Double_t GetBinUpEdge(Int_t bin) const
Return up edge of bin.
Int_t GetFirst() const
Return first bin on the axis i.e.
virtual const char * GetTicks() const
Return the ticks option (see SetTicks)
UShort_t fBits2
Second bit status word.
Int_t fFirst
First bin to display.
void ChangeLabel(Int_t labNum=0, Double_t labAngle=-1., Double_t labSize=-1., Int_t labAlign=-1, Int_t labColor=-1, Int_t labFont=-1, TString labText="")
Define new text attributes for the label number "labNum".
Buffer base class used for serializing objects.
virtual Int_t ReadClassBuffer(const TClass *cl, void *pointer, const TClass *onfile_class=0)=0
virtual Version_t ReadVersion(UInt_t *start=0, UInt_t *bcnt=0, const TClass *cl=0)=0
virtual Int_t ReadArray(Bool_t *&b)=0
virtual Int_t CheckByteCount(UInt_t startpos, UInt_t bcnt, const TClass *clss)=0
virtual Int_t WriteClassBuffer(const TClass *cl, void *pointer)=0
virtual Int_t GetEntries() const
virtual Int_t GetSize() const
Return the capacity of the collection, i.e.
TH1 is the base class of all histogram classes in ROOT.
virtual void GetStats(Double_t *stats) const
fill the array stats from the contents of this histogram The array stats must be correctly dimensione...
virtual Int_t GetDimension() const
@ kIsZoomed
Bit set when zooming on Y axis.
TAxis * GetXaxis()
Get the behaviour adopted by the object about the statoverflows. See EStatOverflows for more informat...
virtual Double_t GetMaximum(Double_t maxval=FLT_MAX) const
Return maximum value smaller than maxval of bins in the range, unless the value has been overridden b...
virtual void SetMaximum(Double_t maximum=-1111)
virtual void SetMinimum(Double_t minimum=-1111)
@ kNstat
Size of statistics data (up to TProfile3D)
virtual Double_t GetMinimum(Double_t minval=-FLT_MAX) const
Return minimum value larger than minval of bins in the range, unless the value has been overridden by...
THashList implements a hybrid collection class consisting of a hash table and a list to store TObject...
TObject * FindObject(const char *name) const
Find object using its name.
void Rehash(Int_t newCapacity)
Rehash the hashlist.
void Delete(Option_t *option="")
Remove all objects from the list AND delete all heap based objects.
virtual void Add(TObject *obj)
virtual void Delete(Option_t *option="")
Remove all objects from the list AND delete all heap based objects.
The TNamed class is the base class for all named ROOT classes.
virtual void Copy(TObject &named) const
Copy this to obj.
virtual void SetTitle(const char *title="")
Set the title of the TNamed.
virtual const char * GetName() const
Returns name of object.
Collectable string class.
const char * GetName() const
Returns name of object.
void SetString(const char *s)
Mother of all ROOT objects.
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
virtual UInt_t GetUniqueID() const
Return the unique object id.
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
virtual void SetUniqueID(UInt_t uid)
Set the unique object id.
virtual void Info(const char *method, const char *msgfmt,...) const
Issue info message.
void ToLower()
Change string to lower-case.
const char * Data() const
TString & ReplaceAll(const TString &s1, const TString &s2)
TString & Remove(Ssiz_t pos)
TString & Append(const char *cs)
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
Double_t GetTimeOffset() const
Short_t Max(Short_t a, Short_t b)
Double_t Floor(Double_t x)
Double_t Sqrt(Double_t x)
Long64_t BinarySearch(Long64_t n, const T *array, T value)
const double xbins[xbins_n]