Skip to content

Commit 44205bd

Browse files
committed
Fix - update stats which was created by hist painter
Normaly stats created already in TWebCanvas, but not always
1 parent 9a04d7b commit 44205bd

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

modules/hist2d/THistPainter.mjs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1008,7 +1008,7 @@ class FunctionsHandler {
10081008
#painter; // object painter to which functions belongs
10091009
#pad_painter; // pad painter
10101010

1011-
constructor(painter, pp, funcs, statpainter) {
1011+
constructor(painter, pp, funcs, statpainter, update_statpainter) {
10121012
this.#painter = painter;
10131013
this.#pad_painter = pp;
10141014

@@ -1067,6 +1067,8 @@ class FunctionsHandler {
10671067
const indx = painters.indexOf(statpainter);
10681068
if (indx >= 0)
10691069
painters.splice(indx, 1);
1070+
if (update_statpainter && (update_painters.indexOf(statpainter) < 0))
1071+
update_painters.push(statpainter);
10701072
}
10711073

10721074
// remove all function which are not found in new list of functions
@@ -1440,7 +1442,7 @@ class THistPainter extends ObjectPainter {
14401442
histo.fBins = obj.fBins;
14411443

14421444
// remove old functions, update existing, prepare to draw new one
1443-
this.#funcs_handler = new FunctionsHandler(this, pp, obj.fFunctions, statpainter);
1445+
this.#funcs_handler = new FunctionsHandler(this, pp, obj.fFunctions, statpainter, this.create_stats);
14441446

14451447
const changed_opt = (histo.fOption !== obj.fOption);
14461448
histo.fOption = obj.fOption;

0 commit comments

Comments
 (0)