Skip to content

Commit 10005e5

Browse files
committed
Fix problem with x label display in TProfile
Reported https://root-forum.cern.ch/t/28965
1 parent 7fd34c7 commit 10005e5

File tree

1 file changed

+9
-13
lines changed

1 file changed

+9
-13
lines changed

scripts/JSRootPainter.hist.js

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3900,30 +3900,26 @@
39003900
histo = this.GetHisto(),
39013901
x1 = histo.fXaxis.GetBinLowEdge(bin+1),
39023902
x2 = histo.fXaxis.GetBinLowEdge(bin+2),
3903-
cont = histo.getBinContent(bin+1);
3903+
cont = histo.getBinContent(bin+1),
3904+
xlbl = "", xnormal = false;
39043905

39053906
if (name.length>0) tips.push(name);
39063907

3908+
if (pmain.x_kind === 'labels') xlbl = pmain.AxisAsText("x", x1); else
3909+
if (pmain.x_kind === 'time') xlbl = pmain.AxisAsText("x", (x1+x2)/2); else
3910+
{ xnormal = true; xlbl = "[" + pmain.AxisAsText("x", x1) + ", " + pmain.AxisAsText("x", x2) + ")"; }
3911+
39073912
if (this.options.Error || this.options.Mark) {
3908-
tips.push("x = " + pmain.AxisAsText("x", (x1+x2)/2));
3913+
tips.push("x = " + xlbl);
39093914
tips.push("y = " + pmain.AxisAsText("y", cont));
39103915
if (this.options.Error) {
3911-
tips.push("error x = " + ((x2 - x1) / 2).toPrecision(4));
3916+
if (xnormal) tips.push("error x = " + ((x2 - x1) / 2).toPrecision(4));
39123917
tips.push("error y = " + histo.getBinError(bin + 1).toPrecision(4));
39133918
}
39143919
} else {
39153920
tips.push("bin = " + (bin+1));
3916-
3917-
if (pmain.x_kind === 'labels')
3918-
tips.push("x = " + pmain.AxisAsText("x", x1));
3919-
else
3920-
if (pmain.x_kind === 'time')
3921-
tips.push("x = " + pmain.AxisAsText("x", (x1+x2)/2));
3922-
else
3923-
tips.push("x = [" + pmain.AxisAsText("x", x1) + ", " + pmain.AxisAsText("x", x2) + ")");
3924-
3921+
tips.push("x = " + xlbl);
39253922
if (histo['$baseh']) cont -= histo['$baseh'].getBinContent(bin+1);
3926-
39273923
if (cont === Math.round(cont))
39283924
tips.push("entries = " + cont);
39293925
else

0 commit comments

Comments
 (0)