Skip to content

Commit f8d0e50

Browse files
committed
Add example how SVG creation works in the hpainter batch
1 parent 0ec6dcc commit f8d0e50

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

demo/node/hpainter.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
// demo how HierarchyPainter can be used without direct display
2+
// in batch display one just able to create images
3+
4+
15
import { version, HierarchyPainter, draw } from 'jsroot';
26

37

@@ -25,3 +29,14 @@ await hp.expandItem('ntuple');
2529
// invoking TTree::Draw
2630
await hp.display('ntuple/pz');
2731

32+
33+
// should be BatchDisplay
34+
const disp = hp.getDisplay();
35+
36+
for (let id = 0; id < disp.numFrames(); ++id) {
37+
const svg = await disp.makeSVG(id);
38+
console.log(`Frame ${id} create svg size ${svg.length}`);
39+
40+
// one can save svg plain file
41+
// writeFileSync(`frame${id}.svg`, svg);
42+
}

0 commit comments

Comments
 (0)