Skip to content

Commit 70d6957

Browse files
committed
Fix - use "E" draw options for THStack only when no any other specified
1 parent 567ddb0 commit 70d6957

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

scripts/JSRootPainter.hist.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7973,11 +7973,12 @@
79737973
var nhists = stack.fHists.arr.length;
79747974
if (nhists <= 0) return false;
79757975
var lst = JSROOT.Create("TList");
7976-
lst.Add(JSROOT.clone(stack.fHists.arr[0]));
7976+
lst.Add(JSROOT.clone(stack.fHists.arr[0]), stack.fHists.opt[0]);
79777977
this.haserrors = this.HasErrors(stack.fHists.arr[0]);
79787978
for (var i=1;i<nhists;++i) {
79797979
var hnext = JSROOT.clone(stack.fHists.arr[i]),
7980-
hprev = lst.arr[i-1];
7980+
hnextopt = stack.fHists.opt[i],
7981+
hprev = lst.arr[i-1];
79817982

79827983
if ((hnext.fNbins != hprev.fNbins) ||
79837984
(hnext.fXaxis.fXmin != hprev.fXaxis.fXmin) ||
@@ -7993,7 +7994,7 @@
79937994
for (var n = 0; n < hnext.fArray.length; ++n)
79947995
hnext.fArray[n] += hprev.fArray[n];
79957996

7996-
lst.Add(hnext);
7997+
lst.Add(hnext, hnextopt);
79977998
}
79987999
stack.fStack = lst;
79998000
return true;
@@ -8097,6 +8098,7 @@
80978098
hist = hlst.arr[rindx];
80988099
hopt = hlst.opt[rindx] || hist.fOption || opt;
80998100
if (hopt.toUpperCase().indexOf(opt)<0) hopt += opt;
8101+
if (this.draw_errors && !hopt) hopt = "E";
81008102
hopt += " same";
81018103

81028104
// if there is auto colors assignment, try to provide it
@@ -8141,6 +8143,7 @@
81418143
lsame = d.check("SAME");
81428144

81438145
this.nostack = d.check("NOSTACK");
8146+
if (d.check("STACK")) this.nostack = false;
81448147

81458148
this._pfc = d.check("PFC");
81468149
this._plc = d.check("PLC");
@@ -8155,7 +8158,7 @@
81558158
this.dolego = d.check("LEGO");
81568159

81578160
// if any histogram appears with pre-calculated errors, use E for all histograms
8158-
if (!this.nostack && this.haserrors && !this.dolego && !d.check("HIST")) opt+=" E";
8161+
if (!this.nostack && this.haserrors && !this.dolego && !d.check("HIST")) this.draw_errors = true;
81598162

81608163
// order used to display histograms in stack direct - true, reverse - false
81618164
this.horder = this.nostack || this.dolego;

0 commit comments

Comments
 (0)