Skip to content

Commit 5369574

Browse files
committed
Merge branch 'dev'
2 parents 6c14cb1 + 099d933 commit 5369574

26 files changed

+97442
-1960
lines changed

changes.md

Lines changed: 34 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,31 @@
11
# JSROOT changelog
22

3+
## Changes in 5.1.0
4+
1. New 'float' browser kind overlays with objects drawing
5+
2. Browser can be enabled after drawing with 'nobrowser' mode
6+
3. One can hide browser or switch browser kind at any time
7+
4. New 'horizontal' and 'vertical' layouts for object display.
8+
One could configure several frames, each divided on sub-frames.
9+
Like display=horiz231 will create three horizontal frames,
10+
divided on 2,3 and 1 sub-frames.
11+
5. One could enable status line where current tooltip info will be shown
12+
6. Improve enlarge functionality - now works with all layouts
13+
7. Do not display all canvas tool buttons by default - provide toggle button instead
14+
8. Let move TAxis title, its position now similar to ROOT graphics
15+
9. Support 'col0' option for TH2Poly class to suppress empty bins
16+
10. Implement for TH3 'box2', 'box3', 'glbox2', 'glcol' draw options
17+
11. Support more superscript/subscript letters in normal text output
18+
12. Correctly handle unzoom with logx/logy scales
19+
13. Let disable stamp parameter in file url with "-" sign at the end of file name
20+
14. Let use quotes in the URL parameters to protect complex arguments with special symbols
21+
15. Introduce direct streamers - like TBasket or TRef
22+
Benefit - one can add custom streamers of such kind or reuse existing
23+
16. Handle TMatrixTSym classes in I/O
24+
17. Correctly count TH3 statistic in TTree::Draw
25+
18. Recognize bower installation when "bower_components/jsroot/scripts" string
26+
appears in the script path (#120)
27+
28+
329
## Changes in 5.0.3
430
1. Fix - prevent exception when discover HTML element position (#121)
531
2. Fix - prevent I/O failure when server automatically gzip response (#119)
@@ -41,19 +67,19 @@
4167
- special handling of TBits
4268
- arbitrary math function from JavaScript Math class, some TMath:: function from ROOT
4369
- if branch is object, one could use methods "TMath::Abs(lep1_p4.X()+lep1_p4.Y())"
44-
- interactive player to configure and execute draw expression
70+
- interactive player to configure and execute draw expression
4571
3. Full support of Float16_t and Double32_t types in I/O
46-
4. Drawing of RooPlot objects, I/O support for RooFit classes
72+
4. Drawing of RooPlot objects, I/O support for RooFit classes
4773
5. Many improvements in object inspector
4874
- support of large lists; only first part is shown
4975
- support of large arrays; values group in decades
5076
- allow to call draw function for sub-elements in inspector
5177
6. Canvas or selected sub-pad can be enlarged when double-clicked outside frame (#116)
5278
Complete drawing will be expanded to the visible space.
53-
Not available for flex, tabs and collapsible layouts.
79+
Not available for flex, tabs and collapsible layouts.
5480
7. Support reading of local ROOT files with HTML5 FileReader.
5581
Files can be selected only with interactive dialog.
56-
8. Combine "Ctrl" and "Shift" keys with mouse click on the items:
82+
8. Combine "Ctrl" and "Shift" keys with mouse click on the items:
5783
- with Shift key typically object inspector will be activated
5884
- with Ctrl key alternative draw options will be used (like colz for TH2)
5985
9. Update libraries
@@ -77,19 +103,19 @@
77103
1. Support new JSON format, produced with newest TBufferJSON
78104
- object references stored as {"$ref":12}
79105
- pair objects for std::map marked with "$pair" : "pair<type1,type2>" data member
80-
- old JSON format will be recognized automatically and supported as well
106+
- old JSON format will be recognized automatically and supported as well
81107
2. Fix - better selection of Y range for log scale
82108
3. Provide JSROOT.parse_multi function to correctly parse response of multi.json request,
83-
support it in the JSROOT.NewHttpRequest method as well.
109+
support it in the JSROOT.NewHttpRequest method as well.
84110
4. Fix - correctly calculate integral for TH1
85-
5. Partially support new TFormula with complex C code inside
111+
5. Partially support new TFormula with complex C code inside
86112

87113

88114
## Changes in 4.8.0
89115
1. Many improvements in the I/O part
90116
- support most of STL containers
91117
- support TMap and TClonesArray containers
92-
- all kind of multidimensional arrays
118+
- all kind of multidimensional arrays
93119
- correct treatment of foreign classes
94120
- supports different versions of class in the same file
95121
- support members like ClassName* fField; //[fCnt]

demo/tooltip.htm

Lines changed: 26 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
<title>Use of tooltip callback in JSROOT</title>
99

10-
<script src="../scripts/JSRootCore.js?2d&onload=startGUI" type="text/javascript"></script>
10+
<script src="../scripts/JSRootCore.js" type="text/javascript"></script>
1111

1212
<script type='text/javascript'>
1313

@@ -34,34 +34,33 @@
3434
histo.fName = "generated";
3535
histo.fTitle = "Drawing " + cnt++;
3636

37-
var painter = JSROOT.redraw('object_draw', histo, "colz");
38-
39-
if (cnt==1) painter.ConfigureUserTooltipCallback(function(info) {
40-
if (info==null) {
41-
// one could clear previous draw
42-
// JSROOT.cleanup("tooltip_draw");
43-
d3.select("#user_tooltip").html("No tooltip");
44-
return;
45-
}
46-
// set tooltip info
47-
d3.select("#user_tooltip").html("object " + info.name + " bin " + info.bin + " cont " + info.cont);
48-
49-
var h1 = JSROOT.CreateTH1(20);
50-
// copy content from TH2 to TH1
51-
for (var n=0;n<20;n++)
52-
h1.setBinContent(n+1, info.obj.getBinContent(n+1, info.biny));
53-
h1.fName = "tooltip";
54-
h1.fTitle = "Projection of biny=" + info.biny;
55-
JSROOT.redraw("tooltip_draw", h1);
56-
});
57-
58-
}
59-
60-
function startGUI() {
61-
updateGUI();
62-
setInterval(updateGUI, 3000);
37+
JSROOT.redraw('object_draw', histo, "colz", function(painter) {
38+
// in callback call painter object is returned
39+
if ((cnt!==1) || !painter) return;
40+
41+
painter.ConfigureUserTooltipCallback(function(info) {
42+
43+
if (info==null)
44+
return d3.select("#user_tooltip").html("No tooltip");
45+
46+
// set tooltip info
47+
d3.select("#user_tooltip").html("object " + info.name + " bin " + info.bin + " cont " + info.cont);
48+
49+
var h1 = JSROOT.CreateTH1(20);
50+
// copy content from TH2 to TH1
51+
for (var n=0;n<20;n++)
52+
h1.setBinContent(n+1, info.obj.getBinContent(n+1, info.biny));
53+
h1.fName = "tooltip";
54+
h1.fTitle = "Projection of biny=" + info.biny;
55+
JSROOT.redraw("tooltip_draw", h1);
56+
});
57+
});
6358
}
6459

60+
updateGUI();
61+
62+
// update drawing every 3 sec
63+
setInterval(updateGUI, 3000);
6564

6665
</script>
6766

demo/update_draw.htm

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,11 @@
4141

4242
// redraw histogram at specified frame
4343
JSROOT.redraw(frame, histo, drawopt);
44-
});
44+
});
4545

46-
req.send(null);
46+
req.send(null);
4747

48-
req.cnt = cnt++; // remember counter to find correct frame later
48+
req.cnt = cnt++; // remember counter to find correct frame later
4949
}
5050

5151
function startGUI() {

docs/JSROOT.md

Lines changed: 43 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,15 @@ It is the successor of the JSRootIO project.
77

88
## Installing JSROOT
99

10-
In most practical cases it is not necessary to install JSROOT on the local computer - it can be used directly from project web sites <https://root.cern/js/> and <http://jsroot.gsi.de/>. Developers repository for JSROOT code situated on <https://github.com/linev/jsroot/>.
10+
In most practical cases it is not necessary to install JSROOT - it can be used directly from project web sites <https://root.cern/js/> and <http://jsroot.gsi.de/>.
1111

12-
In rare cases one need to install JSROOT on separate web server - for such case one could use provided packages from <https://github.com/linev/jsroot/releases>.
13-
14-
One could use JSROOT directly from local file system. If source code was unpacked in `/home/user/jsroot/` subfolder, one could just open it in browser with <file:///home/user/jsroot/index.htm> address.
12+
When required, there are following alternatives to install JSROOT on other web servers:
1513

14+
- download and unpack [provided](https://github.com/linev/jsroot/releases) packages (recommended)
15+
- use [bower](https://bower.io/) package manager and invoke `bower install jsroot`
16+
- clone master branch from [repository](https://github.com/linev/jsroot/)
17+
18+
One could use JSROOT directly from local file system. If source code was unpacked/checked-out in `/home/user/jsroot/` subfolder, one could just open it in browser with <file:///home/user/jsroot/index.htm> address.
1619

1720

1821
## Drawing objects in JSROOT
@@ -29,30 +32,47 @@ To automate files loading and objects drawing, one can provide number of URL par
2932
- opt - drawing option for the item
3033
- items - array of items name
3134
- opts - array of drawing options for the items
32-
- layout - can be 'simple', 'flex', 'collapsible', 'tabs' or 'gridNxM' where N and M integer values
33-
- nobrowser - do not display file browser
35+
- layout - can be 'simple', 'flex', 'collapsible', 'tabs', 'gridNxM', 'horizNMK', 'vertNMK'
36+
- browser - layout of the browser 'float', 'fix', 'no', 'off'
37+
- nobrowser - do not display file browser (same as browser=no)
38+
- float - display floating browser (same as browser=float)
39+
- status - configure status line 'no' (default), 'off' (completely disable), 'size'
3440
- load - name of extra JavaScript to load
3541
- optimize - drawing optimization 0:off, 1:only large histograms (default), 2:always
3642
- paltte - id of default color palette, 51..121 - new ROOT6 palette (default 57)
3743
- interactive - enable/disable interactive functions 0-disable all, 1-enable all
3844
- noselect - hide file-selection part in the browser (only when file name is specified)
3945
- mathjax - use MathJax for latex output
40-
- style - name of TStyle object to define global JSROOT style
46+
- style - name of TStyle object to define global JSROOT style
47+
- toolbar - show canvas tool buttons 'off', 'on' and 'popup'
4148

4249
For instance:
4350

4451
- <https://root.cern/js/latest/?file=../files/hsimple.root&item=hpx;1>
4552
- <https://root.cern/js/latest/?file=../files/hsimple.root&nobrowser&item=hpxpy;1&opt=colz>
4653
- <https://root.cern/js/latest/?file=../files/hsimple.root&noselect&layout=grid2x2&item=hprof;1>
4754

55+
Following layouts are supported:
56+
57+
- simple - available space used for single object (default)
58+
- [collapsible](https://root.cern/js/latest/api.htm#url_syntax_collapsible_layout) - fix-sized canvas group behind each other and can be collapsed individually
59+
- [flex](https://root.cern/js/latest/api.htm#url_syntax_flexible_layout) - creates as many frames as necessary, each can be individually moved/enlarged
60+
- [tabs](https://root.cern/js/latest/api.htm#url_syntax_tabs_layout) - tabs widget
61+
- [gridNxM](https://root.cern/js/latest/api.htm#url_syntax_grid_layout) - fixed-size grid with NxM frames
62+
- gridiNxM - grid with NxM frames with possibility to adjust frames sizes
63+
- vertN - N frames sorted in vertical direction (like gridi1xN)
64+
- horizN - N frames sorted in horizontal direction (like gridiNx1)
65+
- [vert121](https://root.cern//js/latest/api.htm#url_syntax_veritcal_layout) - 3 frames sorted in vertical direction, second frame divided on two sub-frames
66+
- [horiz32_12](https://root.cern//js/latest/api.htm#url_syntax_horizontal_layout) - 2 horizontal frames with 3 and 2 subframes, and 1/3 and 2/3 as relative size
67+
4868
When specifying `files`, `items` or `opts` parameters, array of strings could be provided like `files=['file1.root','file2.root']`. One could skip quotes when specifying elements names `items=[file1.root/hpx,file2.root/hpy]` or `opts=['',colz]`.
4969

50-
Many examples of URL string usage can be found on [JSROOT examples](https://root.cern/js/latest/api.htm) page.
70+
Many examples of URL string usage can be found on [JSROOT examples](https://root.cern/js/latest/api.htm) page.
5171

5272
One can very easy integrate JSROOT graphic into arbitrary HTML pages using a __iframe__ tag:
5373

5474
<iframe width="700" height="400"
55-
src="https://root.cern/js/latest/index.htm?nobrowser&file=../files/hsimple.root&item=hpxpy;1&opt=colz">
75+
src="https://root.cern/js/latest/?nobrowser&file=../files/hsimple.root&item=hpxpy&opt=colz">
5676
</iframe>
5777

5878

@@ -238,6 +258,7 @@ Following parameters are supported:
238258
- "maxrange" - maximal number of ranges in single HTTP request
239259
- "accum" - number of accumulated values before creating histogram
240260
- "htype" - last letter in histogram type like "I", "F", "D", "S", "L", "C"
261+
- "hbins" - number of bins on each histogram axis
241262
- "drawopt" - drawing option for produced histogram
242263

243264
Example - [opt=event.fTracks[].fTriggerBits;entries:1000;first:200;maxrange:25](https://root.cern/js/latest/?file=https://root.cern/files/event/event_0.root&item=EventTree&opt=event.fTracks[].fTriggerBits;entries:1000;first:200;maxrange:25)
@@ -352,25 +373,23 @@ To enable CORS on Apache web server, hosting ROOT files, one should add followin
352373

353374
More details about configuring of CORS headers can be found [here](https://developer.mozilla.org/en/http_access_control).
354375

355-
Other solution - copy all JSROOT files to the location where the data files are located.
356-
In such case one could use the server with its default settings.
376+
Alternative - enable CORS requests in the browser. It can be easily done with [CORS Everywhere plugin](https://addons.mozilla.org/de/firefox/addon/cors-everywhere/) for the Firefox browser or [Allow CORS plugin](https://chrome.google.com/webstore/detail/allow-control-allow-origi/nlfbmbojpeacfghkpbjhddihlkkiljbi?hl=en) for the Chrome browser.
377+
357378

358-
A simple case is to copy only the top index.htm file on the server and specify the full path to JSRootCore.js script like:
379+
Next solution - install JSROOT on the server hosting ROOT files. In such configuration JSROOT does not issue CORS requests, therefore server and browsers can be used with their default settings. A simplified variant of such solution - copy only the top index.htm file from JSROOT package and specify the full path to JSRootCore.js script like:
359380

360381
...
361382
<script type="text/javascript" src="https://root.cern/js/latest/scripts/JSRootCore.js?gui"></script>
362383
...
363384

364-
In such case one can also specify a custom files list:
385+
In the `<div>` element with "simpleGUI" id one can specify many custom parameters, which are allowed in the URL string:
365386

366387
...
367-
<div id="simpleGUI" path="files/subdir" files="userfile1.root;subdir/usefile2.root">
388+
<div id="simpleGUI" path="files/path" files="userfile1.root;subdir/usefile2.root">
368389
loading scripts ...
369390
</div>
370391
...
371392

372-
In such `<div>` element one could put most parameters which are allowed in the URL string (like item, file, opt and so on)
373-
374393

375394
## Reading local ROOT files
376395

@@ -502,7 +521,14 @@ For instance, to load functionality with normal 2D graphics and binary ROOT file
502521

503522
<script type="text/javascript" src="https://root.cern/js/latest/scripts/JSRootCore.min.js?2d&io"></script>
504523

505-
One could use minified version of all scripts (as shown in example) - this reduce page loading time significantly.
524+
One could use minified version of all scripts (as shown in example) - this reduce page loading time significantly.
525+
526+
When JSROOT installed with bower package manager, one could re-use basic libraries like `d3.js` or `three.js` from bower itself. For that one should add `bower` into URL:
527+
528+
<script type="text/javascript" src="vendor/jsroot/scripts/JSRootCore.js?bower&2d&io"></script>
529+
530+
Bower support will be automatically enabled when script path conatin "bower_components/jsroot/" string.
531+
506532

507533

508534
### Use of JSON

docs/api.htm

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,12 +137,16 @@ <h1 id="version"><a href=".." style="color:green">JSROOT</a></h1>
137137
var examples = {
138138
'URL syntax': [
139139
{ name: "Open file", url: "?file=" + filepath + "hsimple.root", title: "Open ROOT file with the JSROOT" },
140-
{ name: "Display item", url: "?file=" + filepath + "hsimple.root&item=hpxpy;1&opt=colz", title: "Open ROOT file and display item" },
141-
{ name: "Hide browser", url: "?nobrowser&file=" + filepath + "hsimple.root&item=hprof;1", title: "Do not show file hierarchy - only display item" },
140+
{ name: "Display item", url: "?file=" + filepath + "hsimple.root&item=hpxpy;1&opt=colz", title: "Open ROOT file and display item" },
141+
{ name: "Enable status", url: "?status&file=" + filepath + "hsimple.root&item=hpxpy;1&opt=colz", title: "Show tooltip information in special status line" },
142+
{ name: "Hide browser", url: "?nobrowser&file=" + filepath + "hsimple.root&item=hprof;1", title: "Hide browser - only display items, browser can be activated later" },
143+
{ name: "Float browser", url: "?float&file=" + filepath + "hsimple.root&item=ntuple;1&opt=px:pz", title: "Display floating browser, which overlays objects drawings" },
142144
{ name: "Flexible layout", url: "?file=" + filepath + "hsimple.root&layout=flex&items=[hpx;1,hpxpy;1,hprof;1]&opts=[hist,colz,e1]", title: "Display several items with flexible layout" },
143-
{ name: "Grid layout", url: "?path=" + filepath + "&layout=grid2x2&files=[hsimple.root,glbox.root]&items=[hsimple.root/hpx;1,hsimple.root/hpxpy;1,hsimple.root/hprof;1,glbox.root/h31;1]&opt=[hist,lego,e1,box1]", title: "Example of grid layout with 2D and 3D drawings" },
145+
{ name: "Grid layout", url: "?path=" + filepath + "&layout=grid2x2&files=[hsimple.root,glbox.root]&items=[hsimple.root/hpx;1,hsimple.root/hpxpy;1,hsimple.root/hprof;1,glbox.root/h31;1]&opts=[hist,lego20,e1,box2]", title: "Example of grid layout with 2D and 3D drawings" },
144146
{ name: "Tabs layout", url: "?file=" + filepath + "hsimple.root&layout=tabs&items=[hpx;1,hpxpy;1,hprof;1]&opts=[hist,colz,e1]", title: "Example of tabs layout" },
145147
{ name: "Collapsible layout", url: "?file=" + filepath + "hsimple.root&layout=collapsible&items=[hpx;1,hpxpy;1,hprof;1]&opts=[hist,colz,e1]", title: "Example of collapsible layout (JSROOT roots)" },
148+
{ name: "Veritcal layout", url: "?file=" + filepath + "hsimple.root&layout=vert121&items=[hpx;1,hpxpy;1,ntuple;1,hprof;1]&opts=[hist,colz,px:pz,e1]", title: "Display several items in vertical layout" },
149+
{ name: "Horizontal layout", url: "?file=" + filepath + "hsimple.root&layout=horiz32_12&items=[ntuple,ntuple,ntuple,hpx,hpxpy]&opts=[px:py,px:pz,py:pz,hist,lego2]", title: "Display several items in horizontal layout, adjust size ratio" },
146150
{ name: "Inspector", url: "?file=" + filepath + "hsimple.root&item=hpx;1&opt=inspect", title: "Show objects data memebers" },
147151
{ name: "Use JSON", url: "?nobrowser&json=" + filepath + "danilo6.json", title: "Read and display data from JSON file, produced with TBufferJSON class" },
148152
{ name: "Superimpose", url: "?file=" + filepath + "fillrandom.root&item=h1f;1+sqroot;1", title: "Superimpose histogram and function" },

0 commit comments

Comments
 (0)