Skip to content

Commit 072e387

Browse files
committed
Fix - handle hmin/hmax for not drawn histogram in contour
If contour need to be created for stacked axis histogram, use provided min/max values. Do not handle wrongly configured histogram min/max
1 parent e2f1d4a commit 072e387

File tree

1 file changed

+21
-3
lines changed

1 file changed

+21
-3
lines changed

modules/hist2d/THistPainter.mjs

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,8 @@ class THistDrawOptions {
133133
this.omaximum = false;
134134
this.maximum = histo.fMaximum;
135135
}
136+
if (!this.ominimum && !this.omaximum && this.minimum === this.maximum)
137+
this.minimum = this.maximum = kNoZoom;
136138
if (d.check('HMIN:', true)) {
137139
this.ohmin = true;
138140
this.hmin = parseFloat(d.part);
@@ -1160,8 +1162,10 @@ class THistPainter extends ObjectPainter {
11601162
histo.fMaximum = obj.fMaximum;
11611163
histo.fSumw2 = obj.fSumw2;
11621164

1163-
if (!o.ominimum) o.minimum = histo.fMinimum;
1164-
if (!o.omaximum) o.maximum = histo.fMaximum;
1165+
if (!o.ominimum)
1166+
o.minimum = histo.fMinimum;
1167+
if (!o.omaximum)
1168+
o.maximum = histo.fMaximum;
11651169

11661170
if (this.getDimension() === 1)
11671171
o.decodeSumw2(histo);
@@ -1189,6 +1193,9 @@ class THistPainter extends ObjectPainter {
11891193
if (!o.omaximum)
11901194
o.maximum = histo.fMaximum;
11911195

1196+
if (!o.ominimum && !o.omaximum && o.minimum === o.maximum)
1197+
o.minimum = o.maximum = kNoZoom;
1198+
11921199
if (!fp || !fp.zoomChangedInteractive())
11931200
this.checkPadRange();
11941201

@@ -2031,11 +2038,22 @@ class THistPainter extends ObjectPainter {
20312038
let nlevels = 0, apply_min,
20322039
zmin = src.minbin, zmax = src.maxbin, zminpos = src.minposbin,
20332040
custom_levels;
2034-
if (zmin === zmax) { zmin = src.gminbin; zmax = src.gmaxbin; zminpos = src.gminposbin; }
2041+
if (zmin === zmax) {
2042+
if (this.options.ohmin && this.options.ohmax && this.options.Zscale) {
2043+
zmin = this.options.hmin;
2044+
zmax = this.options.hmax;
2045+
zminpos = Math.max(zmin, zmax * 1e-10);
2046+
} else {
2047+
zmin = src.gminbin;
2048+
zmax = src.gmaxbin;
2049+
zminpos = src.gminposbin;
2050+
}
2051+
}
20352052

20362053
let gzmin = zmin, gzmax = zmax;
20372054
if (this.options.minimum !== kNoZoom) { zmin = this.options.minimum; gzmin = Math.min(gzmin, zmin); apply_min = true; }
20382055
if (this.options.maximum !== kNoZoom) { zmax = this.options.maximum; gzmax = Math.max(gzmax, zmax); apply_min = false; }
2056+
20392057
if (zmin >= zmax) {
20402058
if (apply_min || !zmin)
20412059
zmax = zmin + 1;

0 commit comments

Comments
 (0)