Skip to content

Commit 5c59ab0

Browse files
committed
Merge branch 'dev'
2 parents d667b55 + 71ac2a2 commit 5c59ab0

37 files changed

+1730
-1043
lines changed

.gitignore

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
ddemo/
2+
jsdoc/
3+
/scripts/three.js
4+
/scripts/three.extra.js
5+
/scripts/jquery.mousewheel.js
6+
.settings
7+
.project
8+
.gitattributes
9+
*.root
10+
demo/node/node_modules
11+
demo/node/*.svg
12+
node_modules
13+
openui5/resources/
14+
openui5/*.txt
15+
openui5/*.tar.gz
16+
package-lock.json

changes.md

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
11
# JSROOT changelog
22

3-
## Changes in 5.5.2
4-
1. Fix - draw TH2Poly bins outline when no content specified
5-
2. Fix - always set axis interactive handlers (#170)
6-
3. Fix - take into account zaxis properties when drawing color palette (#171)
7-
8-
9-
## Changes in 5.5.1
10-
1. Fix - adjust v7 part to new class naming convention, started with R
11-
2. Fix - show RCanvas title
12-
3. New - implement 'nocache' option for JSROOT scripts loading. When specified in URL with
13-
JSRootCore.js script, tries to avoid scripts caching problem by adding stamp parameter to all URLs
14-
4. New - provide simple drawing for TObjString (#164)
3+
## Changes in 5.6.0
4+
1. By drawing outline speed up (factor 10) canvas with many small sub-pads
5+
2. Let configure user click and double-click handlers, extend tooltip.htm example
6+
3. Implement workaround for standard THREE.SVGRenderer - no need for patched version
7+
4. When producing 3D graphical images in batch, use normal THREE.CanvasRenderer
8+
5. Use WebGL renderer in Chrome headless mode for 3D images generation
9+
6. Provide possibility to create SVG files for canvas or frame (#172)
10+
7. Support text drawing with TH1 bar option
11+
8. Fix - when drawing text, reserve extra y range to show it correctly
12+
9. Migrate to Node.js 8, do not support older versions
1513

1614

1715
## Changes in 5.5.0
@@ -24,7 +22,7 @@
2422
6. Implement "optstat1001" and "optfit101" draw options for histograms
2523
7. Remove "autocol" options - standard "plc" should be used instead
2624
8. Provide drawing of artificial "$legend" item - it creates TLegend for all primitives in pad
27-
Can be used when several histograms or several graphs superimposed.
25+
Can be used when several histograms or several graphs superimposed
2826
9. Let configure "&toolbar=vert" in URL to change orientation of tool buttons
2927
10. Improve markers and error bars drawing for TH1/TProfile
3028

demo/gulp/bower.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"description": "Example of building lib.js with gulp for JavaScript ROOT",
55
"main": "example.htm",
66
"dependencies": {
7-
"jsroot": "^5.3.0"
7+
"jsroot": "^5.6.0"
88
},
99
"overrides": {
1010
"MathJax": {
@@ -22,7 +22,6 @@
2222
"scripts/JSRootPainter.hist.js",
2323
"scripts/JSRootPainter.hierarchy.js",
2424
"scripts/JSRootPainter.jquery.js",
25-
"scripts/saveSvgAsPng.min.js",
2625
"scripts/JSRoot3DPainter.js",
2726
"scripts/JSRootPainter.hist3d.js",
2827
"scripts/three.extra.min.js",

demo/node/Readme.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ After this JSROOT functionality can be used from Node.js scripts via:
88

99
var jsroot = require("jsroot");
1010

11+
Provided package.json file allows to use demos directly with local jsroot installation:
12+
13+
npm install
14+
1115
Main motivation to use JSROOT from Node.js is creation of SVG files.
1216
Example <makesvg.js> you will find in this directory. Just call it:
1317

@@ -17,3 +21,5 @@ JSROOT also provides possibility to read arbitrary TTree data without involving
1721
any peace of native ROOT code. <tree.js> demonstrate such example:
1822

1923
node tree.js
24+
25+

demo/node/geomsvg.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
var jsroot = require("jsroot");
2+
var fs = require("fs");
3+
4+
console.log('JSROOT version', jsroot.version);
5+
6+
// Use embed into SVG images for drawing
7+
// Required "npm install canvas" package
8+
//
9+
// jsroot.ImageSVG = true;
10+
11+
jsroot.NewHttpRequest("https://root.cern/js/files/geom/simple_alice.json.gz", 'object', function(obj) {
12+
jsroot.MakeSVG( { object: obj, width: 1200, height: 800 }, function(svg) {
13+
console.log('SVG size', svg.length);
14+
fs.writeFileSync("alice_geom.svg", svg);
15+
});
16+
}).send();

demo/node/makesvg.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@ var fs = require("fs");
33

44
console.log('JSROOT version', jsroot.version);
55

6+
//Use embed into SVG images for drawing
7+
//Required "npm install canvas" package
8+
//
9+
//jsroot.ImageSVG = true;
10+
611
jsroot.OpenFile("https://root.cern/js/files/hsimple.root", function(file) {
712
file.ReadObject("hpx;1", function(obj) {
813
jsroot.MakeSVG( { object: obj, option: "lego2,pal50", width: 1200, height: 800 }, function(svg) {

demo/node/package.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"name": "jsroot-demo_node",
3+
"description": "JSROOT demos for the Node.js",
4+
"main": "makesvg.js",
5+
"author": "[email protected]",
6+
"license": "MIT",
7+
"dependencies": {
8+
"jsroot": "file:../../"
9+
}
10+
}

demo/tooltip.htm

Lines changed: 50 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,44 @@
99

1010
<script src="../scripts/JSRootCore.js" type="text/javascript"></script>
1111

12-
<script type='text/javascript'>
12+
</head>
13+
14+
<body>
15+
16+
<div id="user_tooltip">Place for info</div>
17+
18+
<form action="">
19+
<input type="radio" name="kind" id="btn1" value="Tooltip"> Tooltip
20+
<input type="radio" name="kind" id="btn2" value="Click"> Click
21+
<input type="radio" name="kind" id="btn3" value="Dblclick"> Doubleclk
22+
</form>
23+
24+
<div id="object_draw" style="width:800px; height:600px"></div>
25+
26+
<div id="tooltip_draw" style="width:400px; height:300px"></div>
27+
28+
<script type='text/javascript'>
1329

14-
var cnt = 0;
30+
var cnt = 0, kind = "";
31+
32+
function UserHandler(info) {
33+
if (!info) {
34+
d3.select("#user_tooltip").html("No tooltip");
35+
return false;
36+
}
37+
38+
// set tooltip info
39+
d3.select("#user_tooltip").html("name: " + info.name + " bin: " + info.bin + " cont: " + info.cont);
40+
41+
var h1 = JSROOT.CreateTH1(20);
42+
// copy content from TH2 to TH1
43+
for (var n=0;n<20;n++)
44+
h1.setBinContent(n+1, info.obj.getBinContent(n+1, info.biny));
45+
h1.fName = "tooltip";
46+
h1.fTitle = "Projection of biny=" + info.biny;
47+
JSROOT.redraw("tooltip_draw", h1);
48+
return true; // means event is handled and can be ignored
49+
}
1550

1651
function updateGUI() {
1752
// if getting histogram from THttpServer as JSON string, one should parse it like:
@@ -36,24 +71,19 @@
3671

3772
JSROOT.redraw('object_draw', histo, "colz", function(painter) {
3873
// 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-
});
74+
if (!painter) return;
75+
76+
var chkd = document.getElementById("btn1").checked;
77+
78+
painter.ConfigureUserTooltipCallback(chkd ? UserHandler : null);
79+
80+
chkd = document.getElementById("btn2").checked;
81+
82+
painter.ConfigureUserClickHandler(chkd ? UserHandler : null);
83+
84+
chkd = document.getElementById("btn3").checked;
85+
86+
painter.ConfigureUserDblclickHandler(chkd ? UserHandler : null);
5787
});
5888
}
5989

@@ -64,17 +94,6 @@
6494

6595
</script>
6696

67-
68-
</head>
69-
70-
<body>
71-
72-
<div id="user_tooltip">Place for tooltip</div>
73-
74-
<div id="object_draw" style="width:800px; height:600px"></div>
75-
76-
<div id="tooltip_draw" style="width:400px; height:300px"></div>
77-
7897
</body>
7998
</html>
8099

docs/JSROOT.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -549,6 +549,7 @@ In URL string with JSRootCore.js script one can specify which JSROOT functionali
549549
+ 'gui' default gui for offline/online applications
550550
+ 'load' name of user script(s) to load
551551
+ 'onload' name of function to call when scripts loading completed
552+
+ 'nocache' avoid use of cache for loading of JSROOT scripts
552553

553554
For instance, to load functionality with normal 2D graphics and binary ROOT files support, one should specify:
554555

files/canvas.htm

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,18 +43,15 @@
4343

4444
if (use_openui && !painter.batch_mode) {
4545

46-
painter._configured_socket_kind = args.socket_kind;
46+
painter._window_handle = handle;
4747
painter.use_openui = true;
4848

4949
return JSROOT.AssertPrerequisites('openui5', function() {
5050

51-
var oData = { canvas_painter: painter };
52-
var oModel = new sap.ui.model.json.JSONModel(oData);
53-
sap.ui.getCore().setModel(oModel, "TopCanvasId--MainPanel");
54-
5551
new JSROOT.sap.ui.xmlview({
5652
id: "TopCanvasId",
57-
viewName: "sap.ui.jsroot.view.Canvas"
53+
viewName: "sap.ui.jsroot.view.Canvas",
54+
viewData: { canvas_painter: painter }
5855
}).placeAt("CanvasDiv");
5956
});
6057
}

0 commit comments

Comments
 (0)