Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
129 changes: 82 additions & 47 deletions js/build/jsroot.js

Large diffs are not rendered by default.

21 changes: 21 additions & 0 deletions js/changes.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,27 @@
# JSROOT changelog

## Changes in 7.3.x
1. Fix - correctly set visibility level for geo drawing
2. Fix - use more factor for number of nodes in geo drawing
3. Fix - add missing Chebyshev0 function
4. Fix - provide Gaus with normalization
5. Fix - call 3D rendering after adding TPolyLine3D
6. Fix - properly add interactive resize elements
7. Fix - drop handling on tabs layout
8. Fix - member-wise streaming of std::map #262
9. Fix - typo in expandItem
10. Fix - add missing import in RPavePainter
11. Fix - prevent drawing of empty TGraph
12. Fix - use semicolon in RH3
13. Fix - prevent zero division when drawing TGraph exclusion
14. Fix - draw th2 col bins with configured y bar
15. Fix - let handle derived classes from TH1/TH2 #269
16. Fix - add support of #mp symbol
17. Fix - support TMath::Sq() function
18. Fix - prevent drawing of empty TGraph


## Changes in 7.3.4
1. Fix - do not allow move float browser too far left/top


Expand Down
1 change: 1 addition & 0 deletions js/modules/base/latex.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ const symbols_map = {
'#downarrow': '\u2193',
'#circ': '\u02C6', // ^
'#pm': '\xB1',
'#mp': '\u2213',
'#doublequote': '\u2033',
'#geq': '\u2265',
'#times': '\xD7',
Expand Down
26 changes: 21 additions & 5 deletions js/modules/base/math.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -1599,10 +1599,20 @@ function Prob(chi2, ndf) {
return chisquared_cdf_c(chi2,ndf,0);
}

/** @summary Square function
* @memberof Math */
function Sq(x) {
return x * x;
}

/** @summary Gaus function
* @memberof Math */
function Gaus(x, mean, sigma) {
return Math.exp(-0.5 * Math.pow((x-mean) / sigma, 2));
function Gaus(x, mean, sigma, norm) {
if (!sigma) return 1e30;
let arg = (x - mean) / sigma;
if (arg < -39 || arg > 39) return 0;
let res = Math.exp(-0.5*arg*arg);
return norm ? res/(2.50662827463100024*sigma) : res; //sqrt(2*Pi)=2.50662827463100024
}

/** @summary BreitWigner function
Expand Down Expand Up @@ -1827,6 +1837,12 @@ function ChebyshevN(n, x, c) {
return x * d1 - d2 + c[0];
}

/** @summary Chebyshev0 function
* @memberof Math */
function Chebyshev0(x, c0) {
return c0;
}

/** @summary Chebyshev1 function
* @memberof Math */
function Chebyshev1(x, c0, c1) {
Expand Down Expand Up @@ -2048,10 +2064,10 @@ export {
tdistribution_cdf_c, tdistribution_cdf, tdistribution_pdf, exponential_cdf_c, exponential_cdf, chisquared_pdf,
Beta, GammaDist, LaplaceDist, LaplaceDistI, LogNormal, Student, StudentI,
gaus, gausn, gausxy, expo,
Prob, Gaus, BreitWigner, BetaDist, BetaDistI, landau, landaun,
Prob, Sq, Gaus, BreitWigner, BetaDist, BetaDistI, landau, landaun,

ChebyshevN, Chebyshev1, Chebyshev2, Chebyshev3, Chebyshev4, Chebyshev5,
Chebyshev6, Chebyshev7, Chebyshev8, Chebyshev9, Chebyshev10,
ChebyshevN, Chebyshev0, Chebyshev1, Chebyshev2, Chebyshev3, Chebyshev4,
Chebyshev5, Chebyshev6, Chebyshev7, Chebyshev8, Chebyshev9, Chebyshev10,

getTEfficiencyBoundaryFunc
};
2 changes: 1 addition & 1 deletion js/modules/core.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ let version_id = '7.3.x';

/** @summary version date
* @desc Release date in format day/month/year like '14/04/2022' */
let version_date = '12/06/2023';
let version_date = '31/10/2023';

/** @summary version id and date
* @desc Produced by concatenation of {@link version_id} and {@link version_date}
Expand Down
4 changes: 2 additions & 2 deletions js/modules/draw.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,12 @@ const drawFuncs = { lst: [
{ name: clTLatex, icon: 'img_text', draw: () => import_more().then(h => h.drawText), direct: true },
{ name: clTMathText, sameas: clTLatex },
{ name: clTText, sameas: clTLatex },
{ name: /^TH1/, icon: 'img_histo1d', class: () => import('./hist/TH1Painter.mjs').then(h => h.TH1Painter), opt: ';hist;P;P0;E;E1;E2;E3;E4;E1X0;L;LF2;B;B1;A;TEXT;LEGO;same', ctrl: 'l' },
{ name: /^TH1/, icon: 'img_histo1d', class: () => import('./hist/TH1Painter.mjs').then(h => h.TH1Painter), opt: ';hist;P;P0;E;E1;E2;E3;E4;E1X0;L;LF2;B;B1;A;TEXT;LEGO;same', ctrl: 'l', for_derived: true },
{ name: clTProfile, icon: 'img_profile', class: () => import('./hist/TH1Painter.mjs').then(h => h.TH1Painter), opt: ';E0;E1;E2;p;AH;hist' },
{ name: clTH2Poly, icon: 'img_histo2d', class: () => import('./hist/TH2Painter.mjs').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' },
{ name: /^TH2/, icon: 'img_histo2d', class: () => import('./hist/TH2Painter.mjs').then(h => h.TH2Painter), dflt: 'col', opt: ';COL;COLZ;COL0;COL1;COL0Z;COL1Z;COLA;BOX;BOX1;PROJ;PROJX1;PROJX2;PROJX3;PROJY1;PROJY2;PROJY3;SCAT;TEXT;TEXTE;TEXTE0;CANDLE;CANDLE1;CANDLE2;CANDLE3;CANDLE4;CANDLE5;CANDLE6;CANDLEY1;CANDLEY2;CANDLEY3;CANDLEY4;CANDLEY5;CANDLEY6;VIOLIN;VIOLIN1;VIOLIN2;VIOLINY1;VIOLINY2;CONT;CONT1;CONT2;CONT3;CONT4;ARR;SURF;SURF1;SURF2;SURF4;SURF6;E;A;LEGO;LEGO0;LEGO1;LEGO2;LEGO3;LEGO4;same', ctrl: 'lego' },
{ name: /^TH2/, icon: 'img_histo2d', class: () => import('./hist/TH2Painter.mjs').then(h => h.TH2Painter), dflt: 'col', opt: ';COL;COLZ;COL0;COL1;COL0Z;COL1Z;COLA;BOX;BOX1;PROJ;PROJX1;PROJX2;PROJX3;PROJY1;PROJY2;PROJY3;SCAT;TEXT;TEXTE;TEXTE0;CANDLE;CANDLE1;CANDLE2;CANDLE3;CANDLE4;CANDLE5;CANDLE6;CANDLEY1;CANDLEY2;CANDLEY3;CANDLEY4;CANDLEY5;CANDLEY6;VIOLIN;VIOLIN1;VIOLIN2;VIOLINY1;VIOLINY2;CONT;CONT1;CONT2;CONT3;CONT4;ARR;SURF;SURF1;SURF2;SURF4;SURF6;E;A;LEGO;LEGO0;LEGO1;LEGO2;LEGO3;LEGO4;same', ctrl: 'lego', for_derived: true },
{ name: clTProfile2D, sameas: clTH2 },
{ name: /^TH3/, icon: 'img_histo3d', class: () => import('./hist/TH3Painter.mjs').then(h => h.TH3Painter), opt: ';SCAT;BOX;BOX2;BOX3;GLBOX1;GLBOX2;GLCOL' },
{ name: 'THStack', icon: 'img_histo1d', class: () => import('./hist/THStackPainter.mjs').then(h => h.THStackPainter), expand_item: 'fHists', opt: 'NOSTACK;HIST;E;PFC;PLC' },
Expand Down
2 changes: 2 additions & 0 deletions js/modules/draw/draw3d.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ async function drawPolyLine3D() {

fp.toplevel.add(lines);

fp.render3D(100);

return true;
}

Expand Down
8 changes: 5 additions & 3 deletions js/modules/geom/TGeoPainter.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -1927,7 +1927,9 @@ class TGeoPainter extends ObjectPainter {
let job = {
collect: this._current_face_limit, // indicator for the command
flags: this._clones.getVisibleFlags(),
matrix: matrix ? matrix.elements : null
matrix: matrix ? matrix.elements : null,
vislevel: this._clones.getVisLevel(),
maxvisnodes: this._clones.getMaxVisNodes()
};

this.submitToWorker(job);
Expand Down Expand Up @@ -3519,7 +3521,7 @@ class TGeoPainter extends ObjectPainter {
maxnodes = this.geo_manager.fMaxVisNodes;
}
this._clones.setVisLevel(lvl);
this._clones.setMaxVisNodes(maxnodes);
this._clones.setMaxVisNodes(maxnodes, this.ctrl.more);

this._clones.name_prefix = name_prefix;

Expand Down Expand Up @@ -4709,7 +4711,7 @@ class TGeoPainter extends ObjectPainter {
painter._main_painter._slave_painters.push(painter);
}

if (is_eve && !painter.ctrl.vislevel || (painter.ctrl.vislevel < 9))
if (is_eve && (!painter.ctrl.vislevel || (painter.ctrl.vislevel < 9)))
painter.ctrl.vislevel = 9;

if (extras) {
Expand Down
4 changes: 3 additions & 1 deletion js/modules/geom/geobase.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2335,8 +2335,10 @@ class ClonedNodes {
}

/** @summary Set maximal number of visible nodes */
setMaxVisNodes(v) {
setMaxVisNodes(v, more) {
this.maxnodes = Number.isFinite(v) ? v : 10000;
if (more && Number.isFinite(more))
this.maxnodes *= more;
}

/** @summary Returns configured maximal number of visible nodes */
Expand Down
2 changes: 1 addition & 1 deletion js/modules/gpad/TFramePainter.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ function addDragHandler(_painter, arg) {
function makeResizeElements(group, handler) {
function addElement(cursor, d) {
let clname = 'js_' + cursor.replace(/[-]/g, '_'),
elem = group.select('.' + clname);
elem = group.selectChild('.' + clname);
if (elem.empty()) elem = group.append('path').classed(clname, true);
elem.style('opacity', 0).style('cursor', cursor).attr('d', d);
if (handler) elem.call(handler);
Expand Down
4 changes: 2 additions & 2 deletions js/modules/gui/HierarchyPainter.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2012,7 +2012,7 @@ class HierarchyPainter extends BasePainter {
}).on('drop', function(ev) {
d3_select(this).classed('jsroot_drag_area', false);
let itemname = ev.dataTransfer.getData('item');
if (itemname) h.dropItem(itemname, this.getAttribute('id'));
if (itemname) h.dropItem(itemname, this);
});
}

Expand Down Expand Up @@ -2392,7 +2392,7 @@ class HierarchyPainter extends BasePainter {
async function doExpandItem(_item, _obj){

if (isStr(_item._expand))
_item._expand = findFunction(item._expand);
_item._expand = findFunction(_item._expand);

if (!isFunc(_item._expand)) {
let handle = getDrawHandle(_item._kind, '::expand');
Expand Down
4 changes: 2 additions & 2 deletions js/modules/hist/RH3Painter.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -440,8 +440,8 @@ class RH3Painter extends RHistPainter {
}

let binx, grx, biny, gry, binz, grz;
xaxis = this.getAxis('x'),
yaxis = this.getAxis('y'),
xaxis = this.getAxis('x');
yaxis = this.getAxis('y');
zaxis = this.getAxis('z');

for (i = i1; i < i2; i += di) {
Expand Down
1 change: 1 addition & 0 deletions js/modules/hist/RPavePainter.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { floatToString } from '../base/BasePainter.mjs';
import { RObjectPainter } from '../base/RObjectPainter.mjs';
import { ensureRCanvas } from '../gpad/RCanvasPainter.mjs';
import { addDragHandler } from '../gpad/TFramePainter.mjs';
import { createMenu } from '../gui/menu.mjs';


const ECorner = { kTopLeft: 1, kTopRight: 2, kBottomLeft: 3, kBottomRight: 4 };
Expand Down
3 changes: 2 additions & 1 deletion js/modules/hist2d/RH1Painter.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,8 @@ class RH1Painter extends RHistPainter {
/** @summary Fill statistic */
fillStatistic(stat, dostat/*, dofit*/) {

let data = this.countStat(),
let histo = this.getHisto(),
data = this.countStat(),
print_name = dostat % 10,
print_entries = Math.floor(dostat / 10) % 10,
print_mean = Math.floor(dostat / 100) % 10,
Expand Down
2 changes: 1 addition & 1 deletion js/modules/hist2d/RHistPainter.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ class RHistPainter extends RObjectPainter {
if ((histo.stepx > 1) || (histo.stepy > 1) || (histo.stepz > 1))
histo.getBin0 = function(x, y, z) { return Math.floor((x-this.dx)/this.stepx) + this.nx/this.stepx*Math.floor((y-this.dy)/this.stepy) + this.nx/this.stepx*this.ny/this.stepy*Math.floor((z-this.dz)/this.stepz); }
else
histo.getBin0 = function(x, y, z) { return (x-this.dx) + this.nx*(y-this.dy) + this.nx*this.ny*(z-dz); }
histo.getBin0 = function(x, y, z) { return (x-this.dx) + this.nx*(y-this.dy) + this.nx*this.ny*(z-this.dz); }

histo.getBinContent = function(x, y, z) { return this.fBinContent[this.getBin0(x, y, z)]; }
histo.getBinError = function(x, y, z) { return Math.sqrt(Math.abs(this.getBinContent(x, y, z))); }
Expand Down
10 changes: 7 additions & 3 deletions js/modules/hist2d/TGraphPainter.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -454,9 +454,11 @@ class TGraphPainter extends ObjectPainter {
for (let n = drawbins.length-1; n >= 0; --n) {
let bin = drawbins[n],
dlen = Math.sqrt(bin.dgrx**2 + bin.dgry**2);
// shift point
bin.grx += excl_width*bin.dgry/dlen;
bin.gry -= excl_width*bin.dgrx/dlen;
if (dlen > 1e-10) {
// shift point
bin.grx += excl_width*bin.dgry/dlen;
bin.gry -= excl_width*bin.dgrx/dlen;
}
extrabins.push(bin);
}

Expand All @@ -474,6 +476,8 @@ class TGraphPainter extends ObjectPainter {
let graph = this.getObject(),
excl_width = 0, drawbins = null;

if (!graph?.fNpoints) return;

if (main_block && lineatt.excl_side) {
excl_width = lineatt.excl_width;
if ((lineatt.width > 0) && !options.Line && !options.Curve) options.Line = 1;
Expand Down
2 changes: 1 addition & 1 deletion js/modules/hist2d/TH2Painter.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,7 @@ class TH2Painter extends THistPainter {
if (can_merge) {
y2 = handle.gry[j+1];
} else {
y2 = Math.round(handle.gry[j+1] + dy*handle.ybar2);
y2 = Math.round(handle.gry[j] - dy*handle.ybar2);
dy = Math.round(dy*(handle.ybar2 - handle.ybar1)) || 1;
}

Expand Down
2 changes: 1 addition & 1 deletion js/modules/hist2d/THistPainter.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,7 @@ class THistDrawOptions {

// flag identifies 3D drawing mode for histogram
if ((this.Lego > 0) || (hdim == 3) ||
((this.Surf > 0) || this.Error && (hdim == 2))) this.Mode3D = true;
(((this.Surf > 0) || this.Error) && (hdim == 2))) this.Mode3D = true;

//if (this.Surf == 15)
// if (this.System == CoordSystem.kPOLAR || this.System == CoordSystem.kCARTESIAN)
Expand Down
9 changes: 8 additions & 1 deletion js/modules/io.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3603,9 +3603,16 @@ function readMapElement(buf) {
}

// due-to member-wise streaming second element read after first is completed
if (this.member_wise)
if (this.member_wise) {
if (buf.remain() >= 6) {
if (buf.ntoi2() === kStreamedMemberWise)
buf.shift(4); // skip checksum
else
buf.shift(-2); // rewind
}
for (i = 0; i < n; ++i)
streamer[1].func(buf, res[i]);
}

return res;
}
Expand Down
2 changes: 1 addition & 1 deletion js/modules/webwindow.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@ class WebWindowHandle {
* @private */
createChannel() {
if (this.master)
return master.createChannel();
return this.master.createChannel();

let channel = new WebWindowHandle('channel', this.credits);
channel.wait_first_recv = true; // first received message via the channel is confirmation of established connection
Expand Down