Skip to content

Commit

Permalink
Fix - correct Y range selection in TGraph
Browse files Browse the repository at this point in the history
When histogram configured, do not cross 0 line
when extending y range
  • Loading branch information
linev committed Sep 18, 2024
1 parent 16bb077 commit 75e0e92
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion modules/hist2d/TGraphPainter.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,11 @@ class TGraphPainter extends ObjectPainter {
let uxmin = xmin - dx, uxmax = xmax + dx,
minimum = ymin - dy, maximum = ymax + dy;

if ((ymin > 0) && (minimum <= 0))
minimum = (1 - margin) * ymin;
if ((ymax < 0) && (maximum >= 0))
maximum = (1 - margin) * ymax;

if (!this._not_adjust_hrange) {
const pad_logx = this.getPadPainter()?.getPadLog('x');

Expand All @@ -337,7 +342,10 @@ class TGraphPainter extends ObjectPainter {

if (graph.fMinimum !== kNoZoom) minimum = ymin = graph.fMinimum;
if (graph.fMaximum !== kNoZoom) maximum = graph.fMaximum;
if ((minimum < 0) && (ymin >= 0)) minimum = (1 - margin)*ymin;
if ((minimum < 0) && (ymin >= 0))
minimum = (1 - margin)*ymin;
if ((ymax < 0) && (maximum >= 0))
maximum = (1 - margin) * ymax;

setHistogramTitle(histo, this.getObject().fTitle);

Expand Down

0 comments on commit 75e0e92

Please sign in to comment.