116 const char *formatstr =
nullptr;
117 Int_t reasformat = 0;
123 length =
gPad->GetUxmax() -
gPad->GetUxmin();
135 n = ndiv - (ndiv/100)*100;
143 awidth /= 60; reasformat = 2;
146 awidth /=60; reasformat = 3;
149 awidth /= 24; reasformat = 4;
151 if (awidth>=15.218425) {
152 awidth /= 30.43685; reasformat = 5;
155 awidth /= 12; reasformat = 6;
157 awidth /= 12; reasformat = 7;
166 switch (reasformat) {
177 formatstr =
"%d-%Hh";
183 formatstr =
"%d/%m/%y";
186 formatstr =
"%d/%m/%y";
255 gPad->ExecuteEventAxis(event,px,py,
this);
270 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.");
277 }
else if ( !(x < fXmax)) {
285 bin = 1 + int (fNbins*(x-fXmin)/(fXmax-fXmin) );
321 if (fXmax <= fXmin) {
337 Info(
"FindBin",
"Label %s is not in the list and the axis is not alphanumeric - ignore it",label);
341 Info(
"FindBin",
"Label %s not in the list. It will be added to the histogram",label);
395 }
else if ( !(x < fXmax)) {
399 bin = 1 + int (fNbins*(x-fXmin)/(fXmax-fXmin) );
414 if (bin <= 0 || bin > fNbins)
return "";
419 if (binid == bin)
return obj->
GetName();
452 if (!
fXbins.
fN || bin<1 || bin>fNbins) {
454 return fXmin + (bin-1) * binwidth + 0.5*binwidth;
475 if (!
fXbins.
fN || bin<1 || bin>fNbins) {
477 low = fXmin + (bin-1) * binwidth;
493 return fXmin + (bin-1) * binwidth;
501 if (!
fXbins.
fN || bin < 1 || bin>fNbins) {
503 return fXmin + bin*binwidth;
513 if (fNbins <= 0)
return 0;
515 if (bin >fNbins) bin =
fNbins;
516 if (bin <1 ) bin = 1;
551 return timeformat.
Data();
586 Warning(
"Sort",
"Cannot sort. No labels");
591 Error(
"Sort",
"Axis has no parent");
637 out<<
" "<<name<<subname<<
"->SetTitle("<<quote<<t.
Data()<<quote<<
");"<<std::endl;
640 out<<
" "<<name<<subname<<
"->SetTimeDisplay(1);"<<std::endl;
641 out<<
" "<<name<<subname<<
"->SetTimeFormat("<<quote<<
GetTimeFormat()<<quote<<
");"<<std::endl;
647 out<<
" "<<name<<subname<<
"->SetBinLabel("<<obj->
GetUniqueID()<<
","<<quote<<obj->
GetName()<<quote<<
");"<<std::endl;
651 if (fFirst || fLast) {
652 out<<
" "<<name<<subname<<
"->SetRange("<<fFirst<<
","<<fLast<<
");"<<std::endl;
656 out<<
" "<<name<<subname<<
"->SetBit(TAxis::kLabelsHori);"<<std::endl;
660 out<<
" "<<name<<subname<<
"->SetBit(TAxis::kLabelsVert);"<<std::endl;
664 out<<
" "<<name<<subname<<
"->SetBit(TAxis::kLabelsDown);"<<std::endl;
668 out<<
" "<<name<<subname<<
"->SetBit(TAxis::kLabelsUp);"<<std::endl;
672 out<<
" "<<name<<subname<<
"->CenterLabels(true);"<<std::endl;
676 out<<
" "<<name<<subname<<
"->CenterTitle(true);"<<std::endl;
680 out<<
" "<<name<<subname<<
"->RotateTitle(true);"<<std::endl;
684 out<<
" "<<name<<subname<<
"->SetDecimals();"<<std::endl;
688 out<<
" "<<name<<subname<<
"->SetMoreLogLabels();"<<std::endl;
692 out<<
" "<<name<<subname<<
"->SetNoExponent();"<<std::endl;
718 for (bin=0; bin<=
fNbins; bin++)
722 Error(
"TAxis::Set",
"bins must be in increasing order");
736 for (bin=0; bin<=
fNbins; bin++)
740 Error(
"TAxis::Set",
"bins must be in increasing order");
764 if (s[0] != 0. &&
gDebug > 0)
765 Info(
"SetAlphanumeric",
"Histogram %s is set alphanumeric but has non-zero content",
GetName());
797 if (bin <= 0 || bin > fNbins) {
798 Error(
"SetBinLabel",
"Illegal bin number: %d",bin);
847 Int_t nCells = fNbins + 1;
850 if (last < first || (first < 0 && last < 0) ||
851 (first > nCells && last > nCells) || (first == 0 && last == 0)
871 if (!strstr(
GetName(),
"xaxis")) {
947 if (timeformat.
Index(
"%F")>=0 || timeformat.
IsNull()) {
981 timeoff = (time_t)((
Long_t)(toffset));
984 utctis = gmtime(&timeoff);
986 strftime(tmp,20,
"%Y-%m-%d %H:%M:%S",utctis);
991 snprintf(tmp,20,
"s%g",ds);
1002 void TAxis::Streamer(
TBuffer &R__b)
1012 TNamed::Streamer(R__b);
1013 TAttAxis::Streamer(R__b);
1033 if (fFirst < 0 || fFirst > fNbins) fFirst = 0;
1034 if (fLast < 0 || fLast > fNbins) fLast = 0;
1035 if (fLast < fFirst) { fFirst = 0; fLast = 0;}
1063 if (!strstr(
GetName(),
"xaxis")) {
1066 if (strstr(
GetName(),
"zaxis")) {
1073 if (strcmp(hobj1->
GetName(),
"hframe") == 0 ) {
1090 while ((obj=
next())) {
1091 if (!obj->InheritsFrom(
TH1::Class()))
continue;
1093 if (hobj == hobj1)
continue;
1094 if (!strstr(
GetName(),
"xaxis")) {
1096 if (strstr(
GetName(),
"zaxis")) {
1105 if (strcmp(hobj->
GetName(),
"hframe") == 0 ) {
1128 if (factor <= 0) factor = 2;
const char * GetName() const
Returns name of object.
virtual Int_t DistancetoPrimitive(Int_t px, Int_t py)
Compute distance from point px,py to an axis.
Int_t GetFirst() const
Return first bin on the axis i.e.
virtual void SetTitleOffset(Float_t offset=1)
Set distance between the axis and the axis title Offset is a correction factor with respect to the "s...
virtual Int_t GetEntries() const
virtual Color_t GetAxisColor() const
virtual void SaveAttributes(std::ostream &out, const char *name, const char *subname)
Save axis attributes as C++ statement(s) on output stream out.
virtual Int_t WriteClassBuffer(const TClass *cl, void *pointer)=0
virtual Color_t GetLabelColor() const
virtual void GetLowEdge(Double_t *edge) const
Return an array with the lod edge of all bins.
static Vc_ALWAYS_INLINE int_v min(const int_v &x, const int_v &y)
Double_t Floor(Double_t x)
virtual void SetMaximum(Double_t maximum=-1111)
virtual void LabelsOption(Option_t *option="h", Option_t *axis="X")
Set option(s) to draw axis with labels.
virtual void SetTimeFormat(const char *format="")
Change the format used for time plotting.
ClassImp(TSeqCollection) Int_t TSeqCollection TIter next(this)
Return index of object in collection.
Collectable string class.
Double_t GetTimeOffset() const
virtual void GetStats(Double_t *stats) const
fill the array stats from the contents of this histogram The array stats must be correctly dimensione...
const char * GetBinLabel(Int_t bin) const
Return label for bin.
TObject * FindObject(const char *name) const
Find object using its name.
virtual void ResetAttAxis(Option_t *option="")
Reset axis attributes.
TString & ReplaceAll(const TString &s1, const TString &s2)
R__EXTERN TStyle * gStyle
virtual Int_t GetDimension() const
virtual void SetLabelColor(Color_t color=1, Float_t alpha=1.)
Set color of labels.
virtual void Info(const char *method, const char *msgfmt,...) const
Issue info message.
virtual void SetNdivisions(Int_t n=510, Bool_t optim=kTRUE)
Set the number of divisions for this axis.
Buffer base class used for serializing objects.
virtual Double_t GetBinLowEdge(Int_t bin) const
Return low edge of bin.
void Delete(Option_t *option="")
Remove all objects from the list AND delete all heap based objects.
virtual void SetMinimum(Double_t minimum=-1111)
virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py)
Execute action corresponding to one event.
virtual Int_t CheckByteCount(UInt_t startpos, UInt_t bcnt, const TClass *clss)=0
virtual void SetTimeOffset(Double_t toffset, Option_t *option="local")
Change the time offset If option = "gmt", set display mode to GMT.
virtual void SetTitleFont(Style_t font=62)
Set the title font.
void ToLower()
Change string to lower-case.
virtual Color_t GetTitleColor() const
virtual Double_t GetBinWidth(Int_t bin) const
Return bin width.
virtual Style_t GetTitleFont() const
void Copy(TArrayD &array) const
Manages histogram axis attributes.
virtual Float_t GetTitleSize() const
virtual void SetLabelOffset(Float_t offset=0.005)
Set distance between the axis and the labels The distance is expressed in per cent of the pad width...
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
virtual void SetLabelFont(Style_t font=62)
Set labels' font.
const char * Data() const
virtual void SetRangeUser(Double_t ufirst, Double_t ulast)
Set the viewing range for the axis from ufirst to ulast (in user coordinates).
virtual const char * GetTicks() const
Return the ticks option (see SetTicks)
THashList implements a hybrid collection class consisting of a hash table and a list to store TObject...
The TNamed class is the base class for all named ROOT classes.
virtual void Copy(TObject &named) const
Copy this to obj.
virtual void LabelsOption(Option_t *option="h")
Set option(s) to draw axis with labels option = "a" sort by alphabetic order = ">" sort by decreasing...
void Copy(TAttAxis &attaxis) const
Copy of the object.
TString & Append(const char *cs)
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
virtual TObject * GetParent() const
virtual Float_t GetTitleOffset() const
virtual void SetDefaults()
Set axis default values (from TStyle)
virtual void SetUniqueID(UInt_t uid)
Set the unique object id.
virtual void ImportAttributes(const TAxis *axis)
Copy axis attributes to this.
virtual const char * GetTimeFormat() const
virtual const char * GetTimeFormatOnly() const
Return only the time format from the string fTimeFormat.
virtual void SetRange(Int_t first=0, Int_t last=0)
Set the viewing range for the axis from bin first to last.
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...
Double_t length(const TVector2 &v)
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...
Class to manage histogram axis.
virtual Double_t GetBinUpEdge(Int_t bin) const
Return up edge of bin.
virtual ~TAxis()
Destructor.
void SetCanExtend(Bool_t canExtend)
virtual void UnZoom()
Reset first & last bin to the full range.
Bool_t TestBit(UInt_t f) const
virtual const char * GetName() const
Returns name of object.
const char * GetTitle() const
Returns title of object.
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 The size is expressed in per cent of the pad width.
virtual void SetTitleColor(Color_t color=1)
Set color of axis title.
virtual void SetTitleSize(Float_t size=0.04)
Set size of axis title The size is expressed in per cent of the pad width.
void Rehash(Int_t newCapacity)
Rehash the hashlist.
virtual Int_t FindBin(Double_t x)
Find bin number corresponding to abscissa x.
TString & Remove(Ssiz_t pos)
virtual Int_t ReadClassBuffer(const TClass *cl, void *pointer, const TClass *onfile_class=0)=0
virtual void SaveAttributes(std::ostream &out, const char *name, const char *subname)
Save axis attributes as C++ statement(s) on output stream out.
Bool_t CanBeAlphanumeric()
virtual Int_t GetSize() const
virtual void Copy(TObject &axis) const
Copy axis structure to another axis.
virtual Style_t GetLabelFont() const
virtual Int_t GetNdivisions() const
virtual void SetBinLabel(Int_t bin, const char *label)
Set label for bin.
virtual void SetTicks(Option_t *option="+")
Set ticks orientation.
static Vc_ALWAYS_INLINE int_v max(const int_v &x, const int_v &y)
virtual UInt_t GetUniqueID() const
Return the unique object id.
Int_t GetLast() const
Return last bin on the axis i.e.
virtual Double_t GetBinCenter(Int_t bin) const
Return center of bin.
Mother of all ROOT objects.
virtual Float_t GetLabelSize() const
void SetAlphanumeric(Bool_t alphanumeric=kTRUE)
Set axis alphanumeric.
virtual void GetCenter(Double_t *center) const
Return an array with the center of all bins.
virtual Int_t FindFixBin(Double_t x) const
Find bin number corresponding to abscissa x.
virtual void Add(TObject *obj)
Short_t Max(Short_t a, Short_t b)
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
TAxis & operator=(const TAxis &)
Assignment operator.
virtual void SetTickLength(Float_t length=0.03)
Set tick mark length The length is expressed in per cent of the pad width.
Bool_t HasBinWithoutLabel() const
this helper function checks if there is a bin without a label if all bins have labels, the axis can / will become alphanumeric
Double_t Sqrt(Double_t x)
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
virtual void Set(Int_t nbins, Double_t xmin, Double_t xmax)
Initialize axis with fix bins.
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 Float_t GetTickLength() const
void SetString(const char *s)
virtual void SetTitle(const char *title="")
Change (i.e. set) the title of the TNamed.
void Set(Int_t n)
Set size of this array to n doubles.
Long64_t BinarySearch(Long64_t n, const T *array, T value)
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...
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 Version_t ReadVersion(UInt_t *start=0, UInt_t *bcnt=0, const TClass *cl=0)=0
THashList * fLabels
Object owning this axis.
virtual Int_t ReadArray(Bool_t *&b)=0
virtual Float_t GetLabelOffset() const
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.