Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
linev committed Oct 19, 2018
2 parents d667b55 + 71ac2a2 commit 5c59ab0
Show file tree
Hide file tree
Showing 37 changed files with 1,730 additions and 1,043 deletions.
16 changes: 16 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
ddemo/
jsdoc/
/scripts/three.js
/scripts/three.extra.js
/scripts/jquery.mousewheel.js
.settings
.project
.gitattributes
*.root
demo/node/node_modules
demo/node/*.svg
node_modules
openui5/resources/
openui5/*.txt
openui5/*.tar.gz
package-lock.json
24 changes: 11 additions & 13 deletions changes.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
# JSROOT changelog

## Changes in 5.5.2
1. Fix - draw TH2Poly bins outline when no content specified
2. Fix - always set axis interactive handlers (#170)
3. Fix - take into account zaxis properties when drawing color palette (#171)


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


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

Expand Down
3 changes: 1 addition & 2 deletions demo/gulp/bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "Example of building lib.js with gulp for JavaScript ROOT",
"main": "example.htm",
"dependencies": {
"jsroot": "^5.3.0"
"jsroot": "^5.6.0"
},
"overrides": {
"MathJax": {
Expand All @@ -22,7 +22,6 @@
"scripts/JSRootPainter.hist.js",
"scripts/JSRootPainter.hierarchy.js",
"scripts/JSRootPainter.jquery.js",
"scripts/saveSvgAsPng.min.js",
"scripts/JSRoot3DPainter.js",
"scripts/JSRootPainter.hist3d.js",
"scripts/three.extra.min.js",
Expand Down
6 changes: 6 additions & 0 deletions demo/node/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ After this JSROOT functionality can be used from Node.js scripts via:

var jsroot = require("jsroot");

Provided package.json file allows to use demos directly with local jsroot installation:

npm install

Main motivation to use JSROOT from Node.js is creation of SVG files.
Example <makesvg.js> you will find in this directory. Just call it:

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

node tree.js


16 changes: 16 additions & 0 deletions demo/node/geomsvg.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
var jsroot = require("jsroot");
var fs = require("fs");

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

// Use embed into SVG images for drawing
// Required "npm install canvas" package
//
// jsroot.ImageSVG = true;

jsroot.NewHttpRequest("https://root.cern/js/files/geom/simple_alice.json.gz", 'object', function(obj) {
jsroot.MakeSVG( { object: obj, width: 1200, height: 800 }, function(svg) {
console.log('SVG size', svg.length);
fs.writeFileSync("alice_geom.svg", svg);
});
}).send();
5 changes: 5 additions & 0 deletions demo/node/makesvg.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ var fs = require("fs");

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

//Use embed into SVG images for drawing
//Required "npm install canvas" package
//
//jsroot.ImageSVG = true;

jsroot.OpenFile("https://root.cern/js/files/hsimple.root", function(file) {
file.ReadObject("hpx;1", function(obj) {
jsroot.MakeSVG( { object: obj, option: "lego2,pal50", width: 1200, height: 800 }, function(svg) {
Expand Down
10 changes: 10 additions & 0 deletions demo/node/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"name": "jsroot-demo_node",
"description": "JSROOT demos for the Node.js",
"main": "makesvg.js",
"author": "[email protected]",
"license": "MIT",
"dependencies": {
"jsroot": "file:../../"
}
}
81 changes: 50 additions & 31 deletions demo/tooltip.htm
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,44 @@

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

<script type='text/javascript'>
</head>

<body>

<div id="user_tooltip">Place for info</div>

<form action="">
<input type="radio" name="kind" id="btn1" value="Tooltip"> Tooltip
<input type="radio" name="kind" id="btn2" value="Click"> Click
<input type="radio" name="kind" id="btn3" value="Dblclick"> Doubleclk
</form>

<div id="object_draw" style="width:800px; height:600px"></div>

<div id="tooltip_draw" style="width:400px; height:300px"></div>

<script type='text/javascript'>

var cnt = 0;
var cnt = 0, kind = "";

function UserHandler(info) {
if (!info) {
d3.select("#user_tooltip").html("No tooltip");
return false;
}

// set tooltip info
d3.select("#user_tooltip").html("name: " + info.name + " bin: " + info.bin + " cont: " + info.cont);

var h1 = JSROOT.CreateTH1(20);
// copy content from TH2 to TH1
for (var n=0;n<20;n++)
h1.setBinContent(n+1, info.obj.getBinContent(n+1, info.biny));
h1.fName = "tooltip";
h1.fTitle = "Projection of biny=" + info.biny;
JSROOT.redraw("tooltip_draw", h1);
return true; // means event is handled and can be ignored
}

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

JSROOT.redraw('object_draw', histo, "colz", function(painter) {
// in callback call painter object is returned
if ((cnt!==1) || !painter) return;

painter.ConfigureUserTooltipCallback(function(info) {

if (info==null)
return d3.select("#user_tooltip").html("No tooltip");

// set tooltip info
d3.select("#user_tooltip").html("object " + info.name + " bin " + info.bin + " cont " + info.cont);

var h1 = JSROOT.CreateTH1(20);
// copy content from TH2 to TH1
for (var n=0;n<20;n++)
h1.setBinContent(n+1, info.obj.getBinContent(n+1, info.biny));
h1.fName = "tooltip";
h1.fTitle = "Projection of biny=" + info.biny;
JSROOT.redraw("tooltip_draw", h1);
});
if (!painter) return;

var chkd = document.getElementById("btn1").checked;

painter.ConfigureUserTooltipCallback(chkd ? UserHandler : null);

chkd = document.getElementById("btn2").checked;

painter.ConfigureUserClickHandler(chkd ? UserHandler : null);

chkd = document.getElementById("btn3").checked;

painter.ConfigureUserDblclickHandler(chkd ? UserHandler : null);
});
}

Expand All @@ -64,17 +94,6 @@

</script>


</head>

<body>

<div id="user_tooltip">Place for tooltip</div>

<div id="object_draw" style="width:800px; height:600px"></div>

<div id="tooltip_draw" style="width:400px; height:300px"></div>

</body>
</html>

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

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

Expand Down
9 changes: 3 additions & 6 deletions files/canvas.htm
Original file line number Diff line number Diff line change
Expand Up @@ -43,18 +43,15 @@

if (use_openui && !painter.batch_mode) {

painter._configured_socket_kind = args.socket_kind;
painter._window_handle = handle;
painter.use_openui = true;

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

var oData = { canvas_painter: painter };
var oModel = new sap.ui.model.json.JSONModel(oData);
sap.ui.getCore().setModel(oModel, "TopCanvasId--MainPanel");

new JSROOT.sap.ui.xmlview({
id: "TopCanvasId",
viewName: "sap.ui.jsroot.view.Canvas"
viewName: "sap.ui.jsroot.view.Canvas",
viewData: { canvas_painter: painter }
}).placeAt("CanvasDiv");
});
}
Expand Down
9 changes: 3 additions & 6 deletions files/canvas6.htm
Original file line number Diff line number Diff line change
Expand Up @@ -45,17 +45,14 @@

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

painter._configured_socket_kind = args.socket_kind;
painter._window_handle = handle;

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

var oData = { canvas_painter: painter };
var oModel = new sap.ui.model.json.JSONModel(oData);
sap.ui.getCore().setModel(oModel, "TopCanvasId--MainPanel");

new JSROOT.sap.ui.xmlview({
id: "TopCanvasId",
viewName: "sap.ui.jsroot.view.Canvas"
viewName: "sap.ui.jsroot.view.Canvas",
viewData: { canvas_painter: painter }
}).placeAt("CanvasDiv");
});
}
Expand Down
7 changes: 4 additions & 3 deletions libs/build_three_extra.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ tgt=three.extra.js

src=/d/three.js-r86
#src=/home/linev/git/threejs
#src2=/d/three.js-r85
src2=/home/linev/git/threejs
src2=/d/three.js-r86
#src2=/home/linev/git/threejs

rm -rf $tgt
touch $tgt
Expand All @@ -29,8 +29,9 @@ echo "// Content of examples/js/renderers/CanvasRenderer.js" >> $tgt
cat $src/examples/js/renderers/CanvasRenderer.js >> $tgt
echo "" >> $tgt

echo "// Content of examples/js/renderers/SVGRenderer.js" >> $tgt
cat ./three.svg_renderer_header.js >> $tgt
cat $src2/examples/js/renderers/SVGRenderer.js >> $tgt
cat ./three.svg_renderer_footer.js >> $tgt
echo "" >> $tgt

echo "// Content of examples/js/controls/OrbitControls.js" >> $tgt
Expand Down
Loading

0 comments on commit 5c59ab0

Please sign in to comment.