Skip to content

Commit

Permalink
Build with new TProfile draw options
Browse files Browse the repository at this point in the history
  • Loading branch information
linev committed Jun 19, 2024
1 parent fcdd715 commit 4b11329
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 8 deletions.
40 changes: 34 additions & 6 deletions build/jsroot.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const version_id = 'dev',

/** @summary version date
* @desc Release date in format day/month/year like '14/04/2022' */
version_date = '18/06/2024',
version_date = '19/06/2024',

/** @summary version id and date
* @desc Produced by concatenation of {@link version_id} and {@link version_date}
Expand Down Expand Up @@ -1724,6 +1724,9 @@ function getMethods(typename, obj) {
if (!this.fArray) return 0;
return this.fArray[bin]/this.fBinEntries[bin];
};
m.getBinEntries = function(bin) {
return (bin < 0) || (bin >= this.fNcells) ? 0 : this.fBinEntries[bin];
};
}
m.getBinEffectiveEntries = function(bin) {
if (bin < 0 || bin >= this.fNcells) return 0;
Expand Down Expand Up @@ -72907,7 +72910,7 @@ class THistDrawOptions {
Lego: 0, Surf: 0, Off: 0, Tri: 0, Proj: 0, AxisPos: 0, Ortho: gStyle.fOrthoCamera,
Spec: false, Pie: false, List: false, Zscale: false, Zvert: true, PadPalette: false,
Candle: '', Violin: '', Scaled: null, Circular: 0,
GLBox: 0, GLColor: false, Project: '', Profile2DProj: '', System: kCARTESIAN,
GLBox: 0, GLColor: false, Project: '', ProfileProj: '', Profile2DProj: '', System: kCARTESIAN,
AutoColor: false, NoStat: false, ForceStat: false, PadStats: false, PadTitle: false, AutoZoom: false,
HighRes: 0, Zero: 1, Palette: 0, BaseLine: false, ShowEmpty: false,
Optimize: settings.OptimizeDraw, adjustFrame: false,
Expand Down Expand Up @@ -73244,7 +73247,12 @@ class THistDrawOptions {
this.Project = 'XY' + d.partAsInt(0, 1);
}

if (d.check('PROJX', true)) this.Project = 'X' + d.part;
if (d.check('PROJX', true)) {
if (histo?._typename === clTProfile)
this.ProfileProj = d.part || 'B';
else
this.Project = 'X' + d.part;
}
if (d.check('PROJY', true)) this.Project = 'Y' + d.part;
if (d.check('PROJ')) this.Project = 'Y1';

Expand Down Expand Up @@ -73432,6 +73440,9 @@ class THistDrawOptions {
if (this.is3d() && this.Ortho && is_main_hist)
res += '_ORTHO';

if (this.ProfileProj)
res += '_PROJX' + this.ProfileProj;

if (this.Profile2DProj)
res += '_PROJXY' + this.Profile2DProj;

Expand Down Expand Up @@ -75936,7 +75947,7 @@ let TH2Painter$2 = class TH2Painter extends THistPainter {
this.projection_widthY = widthY;
this.is_projection = ''; // avoid projection handling until area is created

this.provideSpecialDrawArea(new_proj).then(() => { this.is_projection = new_proj; return this.redrawProjection(); });
return this.provideSpecialDrawArea(new_proj).then(() => { this.is_projection = new_proj; return this.redrawProjection(); });
}

/** @summary Redraw projection */
Expand Down Expand Up @@ -76094,7 +76105,7 @@ let TH2Painter$2 = class TH2Painter extends THistPainter {
return this.showInspector(arg);
const oldProject = this.options.Project;
this.decodeOptions(arg);
if (oldProject === this.options.Project)
if ((oldProject === this.options.Project) || this.mode3d)
this.interactiveRedraw('pad', 'drawopt');
else
this.toggleProjection(this.options.Project);
Expand Down Expand Up @@ -80985,6 +80996,23 @@ const PadDrawOptions = ['LOGXY', 'LOGX', 'LOGY', 'LOGZ', 'LOGV', 'LOG', 'LOG2X',

let TH1Painter$2 = class TH1Painter extends THistPainter {

/** @summary Returns histogram
* @desc Also assigns custom getBinContent method for TProfile if PROJX options specified */
getHisto() {
const histo = super.getHisto();
if (histo?._typename === clTProfile) {
if (!histo.$getBinContent)
histo.$getBinContent = histo.getBinContent;
switch (this.options?.ProfileProj) {
case 'B': histo.getBinContent = histo.getBinEntries; break;
case 'C=E': histo.getBinContent = histo.getBinError; break;
case 'W': histo.getBinContent = function(i) { return this.$getBinContent(i) * this.getBinEntries(i); }; break;
default: histo.getBinContent = histo.$getBinContent; break;
}
}
return histo;
}

/** @summary Convert TH1K into normal binned histogram */
convertTH1K() {
const histo = this.getObject();
Expand Down Expand Up @@ -103238,7 +103266,7 @@ drawFuncs = { lst: [
{ name: clTText, sameas: clTLatex },
{ name: clTAnnotation, sameas: clTLatex },
{ name: /^TH1/, icon: 'img_histo1d', class: () => Promise.resolve().then(function () { return TH1Painter$1; }).then(h => h.TH1Painter), opt: ';hist;P;P0;E;E1;E2;E3;E4;E1X0;L;LF2;C;B;B1;A;TEXT;LEGO;same', ctrl: 'l', expand_item: fFunctions, for_derived: true },
{ name: clTProfile, icon: 'img_profile', class: () => Promise.resolve().then(function () { return TH1Painter$1; }).then(h => h.TH1Painter), opt: ';E0;E1;E2;p;AH;hist', expand_item: fFunctions },
{ name: clTProfile, icon: 'img_profile', class: () => Promise.resolve().then(function () { return TH1Painter$1; }).then(h => h.TH1Painter), opt: ';E0;E1;E2;p;AH;hist;projx;projxb;projxc=e;projxw', expand_item: fFunctions },
{ name: clTH2Poly, icon: 'img_histo2d', class: () => Promise.resolve().then(function () { return TH2Painter$1; }).then(h => h.TH2Painter), opt: ';COL;COL0;COLZ;LCOL;LCOL0;LCOLZ;LEGO;TEXT;same', expand_item: 'fBins', theonly: true },
{ name: 'TProfile2Poly', sameas: clTH2Poly },
{ name: 'TH2PolyBin', icon: 'img_histo2d', draw_field: 'fPoly', draw_field_opt: 'L' },
Expand Down
2 changes: 1 addition & 1 deletion changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
2. Support gStyle.fLegendFillStyle
3. Let change histogram min/max values via context menu
4. Support Z-scale zooming with TScatter
5. TProfile2D projections https://github.com/root-project/root/issues/15851
5. TProfile and TProfile2D projections https://github.com/root-project/root/issues/15851
6. Fix - hide empty title on the canvas
7. Fix - properly handle zooming in THStack histogram
8. Fix - properly save zoomed ranges in drawingJSON()
Expand Down
2 changes: 1 addition & 1 deletion modules/core.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const version_id = 'dev',

/** @summary version date
* @desc Release date in format day/month/year like '14/04/2022' */
version_date = '18/06/2024',
version_date = '19/06/2024',

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

0 comments on commit 4b11329

Please sign in to comment.