Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions graf2d/gpad/src/TPad.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -2371,6 +2371,7 @@ void TPad::ExecuteEventAxis(Int_t event, Int_t px, Int_t py, TAxis *axis)
Int_t nbd, inc, bin1, bin2, first, last;
Double_t temp, xmin,xmax;
Bool_t opaque = gPad->OpaqueMoving();
bool resetAxisRange = false;
static std::unique_ptr<TBox> zoombox;
Double_t zbx1=0,zbx2=0,zby1=0,zby2=0;

Expand Down Expand Up @@ -2524,8 +2525,12 @@ void TPad::ExecuteEventAxis(Int_t event, Int_t px, Int_t py, TAxis *axis)
bin2 = axis->GetLast()+inc;
bin1 = TMath::Max(bin1, 1);
bin2 = TMath::Min(bin2, axis->GetNbins());
resetAxisRange = (bin1 == 1 && axis->GetFirst() == 1 && bin2 == axis->GetNbins() && axis->GetLast() == axis->GetNbins());
if (bin2>bin1) {
axis->SetRange(bin1,bin2);
}
if (resetAxisRange) axis->ResetBit(TAxis::kAxisRange);
if (bin2>bin1) {
gPad->Modified();
gPad->Update();
}
Expand Down
7 changes: 2 additions & 5 deletions hist/hist/src/TAxis.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,7 @@ const char *TAxis::GetBinLabel(Int_t bin) const
////////////////////////////////////////////////////////////////////////////////
/// Return first bin on the axis
/// i.e. 1 if no range defined
/// NOTE: in some cases a zero is returned (see TAxis::SetRange)
/// \note in some cases a zero is returned (see TAxis::SetRange)

Int_t TAxis::GetFirst() const
{
Expand All @@ -468,7 +468,7 @@ Int_t TAxis::GetFirst() const
////////////////////////////////////////////////////////////////////////////////
/// Return last bin on the axis
/// i.e. fNbins if no range defined
/// NOTE: in some cases a zero is returned (see TAxis::SetRange)
/// \note in some cases a zero is returned (see TAxis::SetRange)

Int_t TAxis::GetLast() const
{
Expand Down Expand Up @@ -1017,7 +1017,6 @@ void TAxis::ChangeLabelByValue(Double_t labValue, Double_t labAngle, Double_t la
ml->SetText(labText);
}


////////////////////////////////////////////////////////////////////////////////
/// Set the viewing range for the axis using bin numbers.
///
Expand Down Expand Up @@ -1061,10 +1060,8 @@ void TAxis::SetRange(Int_t first, Int_t last)
fLast = std::min(last, nCells);
SetBit(kAxisRange, true);
}

}


////////////////////////////////////////////////////////////////////////////////
/// Set the viewing range for the axis from `ufirst` to `ulast` (in user coordinates,
/// that is, the "natural" axis coordinates).
Expand Down
4 changes: 4 additions & 0 deletions hist/histpainter/src/THistPainter.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -3641,12 +3641,16 @@ void THistPainter::ExecuteEvent(Int_t event, Int_t px, Int_t py)
bin2 = xaxis->GetLast()+1;
bin1 = TMath::Max(bin1, 1);
bin2 = TMath::Min(bin2, xaxis->GetNbins());
const bool resetXaxisRange = bin1 == 1 && xaxis->GetFirst() == 1 && bin2 == xaxis->GetNbins() && xaxis->GetLast() == xaxis->GetNbins();
if (bin2>bin1) xaxis->SetRange(bin1,bin2);
if (resetXaxisRange) xaxis->ResetBit(TAxis::kAxisRange);
bin1 = yaxis->GetFirst()-1;
bin2 = yaxis->GetLast()+1;
bin1 = TMath::Max(bin1, 1);
bin2 = TMath::Min(bin2, yaxis->GetNbins());
const bool resetYaxisRange = bin1 == 1 && yaxis->GetFirst() == 1 && bin2 == yaxis->GetNbins() && yaxis->GetLast() == yaxis->GetNbins();
if (bin2>bin1) yaxis->SetRange(bin1,bin2);
if (resetYaxisRange) yaxis->ResetBit(TAxis::kAxisRange);
}
gPad->Modified();
gPad->Update();
Expand Down
Loading