Skip to content

Commit 0116ec2

Browse files
committed
Build with stats box fix
1 parent 0ef4977 commit 0116ec2

File tree

3 files changed

+33
-7
lines changed

3 files changed

+33
-7
lines changed

build/jsroot.js

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const version_id = '7.5.x',
1111

1212
/** @summary version date
1313
* @desc Release date in format day/month/year like '14/04/2022' */
14-
version_date = '25/10/2023',
14+
version_date = '26/10/2023',
1515

1616
/** @summary version id and date
1717
* @desc Produced by concatenation of {@link version_id} and {@link version_date}
@@ -69172,9 +69172,22 @@ class TPavePainter extends ObjectPainter {
6917269172
// we take statistic from main painter
6917369173
if (main.fillStatistic(this, dostat, dofit)) {
6917469174
// adjust the size of the stats box with the number of lines
69175-
const nlines = pt.fLines?.arr.length || 0;
69176-
if ((nlines > 0) && !this.moved_interactive && ((gStyle.fStatFontSize <= 0) || (gStyle.fStatFont % 10 === 3)))
69177-
pt.fY1NDC = Math.max(0.02, pt.fY2NDC - ((nlines < 8) ? nlines * 0.25 * gStyle.fStatH : nlines * 0.025));
69175+
let nlines = pt.fLines?.arr.length || 0;
69176+
if ((nlines > 0) && !this.moved_interactive) {
69177+
// in ROOT TH2 and TH3 always add full statsh for fit parameters
69178+
const extrah = this._has_fit && (this._fit_dim > 1) ? gStyle.fStatH : 0;
69179+
// but fit parameters not used in full size calculations
69180+
if (extrah) nlines -= this._fit_cnt;
69181+
let stath = gStyle.fStatH, statw = gStyle.fStatW;
69182+
if (this._has_fit)
69183+
statw = 1.8 * gStyle.fStatW;
69184+
if ((gStyle.fStatFontSize <= 0) || (gStyle.fStatFont % 10 === 3))
69185+
stath = nlines * 0.25 * gStyle.fStatH;
69186+
else if (gStyle.fStatFontSize < 1)
69187+
stath = nlines * gStyle.fStatFontSize;
69188+
pt.fX1NDC = Math.max(0.02, pt.fX2NDC - statw);
69189+
pt.fY1NDC = Math.max(0.02, pt.fY2NDC - stath - extrah);
69190+
}
6917869191
}
6917969192
}
6918069193
}
@@ -70150,17 +70163,27 @@ class TPavePainter extends ObjectPainter {
7015070163

7015170164
/** @summary Fill function parameters */
7015270165
fillFunctionStat(f1, dofit, ndim = 1) {
70166+
this._has_fit = false;
70167+
7015370168
if (!dofit || !f1) return false;
7015470169

70170+
this._has_fit = true;
70171+
this._fit_dim = ndim;
70172+
this._fit_cnt = 0;
70173+
7015570174
const print_fval = (ndim === 1) ? dofit % 10 : 1,
7015670175
print_ferrors = (ndim === 1) ? Math.floor(dofit/10) % 10 : 1,
7015770176
print_fchi2 = (ndim === 1) ? Math.floor(dofit/100) % 10 : 1,
7015870177
print_fprob = (ndim === 1) ? Math.floor(dofit/1000) % 10 : 0;
7015970178

70160-
if (print_fchi2)
70179+
if (print_fchi2) {
7016170180
this.addText('#chi^{2} / ndf = ' + this.format(f1.fChisquare, 'fit') + ' / ' + f1.fNDF);
70162-
if (print_fprob)
70181+
this._fit_cnt++;
70182+
}
70183+
if (print_fprob) {
7016370184
this.addText('Prob = ' + this.format(Prob(f1.fChisquare, f1.fNDF)));
70185+
this._fit_cnt++;
70186+
}
7016470187
if (print_fval) {
7016570188
for (let n = 0; n < f1.GetNumPars(); ++n) {
7016670189
const parname = f1.GetParName(n);
@@ -70177,9 +70200,11 @@ class TPavePainter extends ObjectPainter {
7017770200
this.addText(`${parname} = ${parvalue} #pm ${parerr}`);
7017870201
else
7017970202
this.addText(`${parname} = ${parvalue}`);
70203+
this._fit_cnt++;
7018070204
}
7018170205
}
7018270206

70207+
7018370208
return true;
7018470209
}
7018570210

changes.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
1. Fix - proper fit pars display in stats, proper #chi^{2}
55
2. Fix - several bugs in TFormula parsing
66
3. Fix - correctly use saved buffer in TF1/TF2
7+
4. Fix - properly adjust size of stats box
78

89

910
## Changes in 7.5.1

modules/core.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const version_id = '7.5.x',
44

55
/** @summary version date
66
* @desc Release date in format day/month/year like '14/04/2022' */
7-
version_date = '25/10/2023',
7+
version_date = '26/10/2023',
88

99
/** @summary version id and date
1010
* @desc Produced by concatenation of {@link version_id} and {@link version_date}

0 commit comments

Comments
 (0)