Skip to content

Commit 12a7b6e

Browse files
committed
Add hpainter.js demo for node
It shows how file can be opened and items are draw
1 parent f8ee010 commit 12a7b6e

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

demo/node/hpainter.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import { version, HierarchyPainter } from 'jsroot';
2+
3+
4+
console.log(`JSROOT version ${version}`);
5+
6+
7+
const hp = new HierarchyPainter('batch', null);
8+
9+
hp.setDrawFunc((dom, obj, opt) => {
10+
console.log(`trying to draw ${obj._typename}`);
11+
return null;
12+
});
13+
14+
await hp.openRootFile('https://root.cern/js/files/hsimple.root');
15+
16+
// display of TH2 histogram
17+
await hp.display('hpxpy');
18+
19+
await hp.expandItem('ntuple');
20+
21+
// invoking TTree::Draw
22+
await hp.display('ntuple/pz');
23+

0 commit comments

Comments
 (0)