https://github.com/root-project/jsroot
JavaScript ROOT
https://github.com/root-project/jsroot
Last synced: 4 months ago
JSON representation
JavaScript ROOT
- Host: GitHub
- URL: https://github.com/root-project/jsroot
- Owner: root-project
- License: mit
- Created: 2015-04-09T08:21:27.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2026-02-16T15:11:52.000Z (4 months ago)
- Last Synced: 2026-02-16T22:50:03.784Z (4 months ago)
- Language: JavaScript
- Homepage:
- Size: 133 MB
- Stars: 210
- Watchers: 16
- Forks: 86
- Open Issues: 4
-
Metadata Files:
- Readme: readme.md
- Changelog: changes.md
- License: LICENSE
Awesome Lists containing this project
README
# JavaScript ROOT
JavaScript ROOT provides interactive ROOT-like graphics in the web browsers and in `node.js`.
Data can be read and displayed from ROOT binary and JSON files.
`JSROOT` implements user interface for THttpServer class.
## Examples
[](https://root.cern/js/latest/?nobrowser&file=https://root.cern/js/files/hsimple.root&item=hpxpy;1&opt=colz) [](https://root.cern/js/latest/?nobrowser&file=https://root.cern/js/files/hsimple.root&item=ntuple;1&opt=px:py::pz%3E4) [](https://root.cern/js/latest/?nobrowser&file=https://root.cern/js/files/histpainter6.root&item=draw_hstack;1) [](https://root.cern/js/latest/?nobrowser&json=https://root.cern/js/files/geom/simple_alice.json.gz&file=https://root.cern/js/files/geom/tracks_hits.root&item=simple_alice.json.gz+tracks_hits.root/tracks;1+tracks_hits.root/hits;1)
### In web browser
```javascript
...
import { openFile, draw } from 'https://root.cern/js/latest/modules/main.mjs';
let file = await openFile('https://root.cern/js/files/hsimple.root');
let obj = await file.readObject('hpxpy;1');
draw('drawing', obj, 'colz');
...
```
### In node.js
```javascript
import { openFile, makeSVG } from 'jsroot';
import { writeFileSync } from 'fs';
let file = await openFile('https://root.cern/js/files/hsimple.root');
let obj = await file.readObject('hpxpy;1');
let svg = await makeSVG({ object: obj, option: 'lego2,pal50', width: 800, height: 600 });
writeFileSync('lego2.svg', svg);
```
### More examples
[Supported classes/options](https://root.cern/js/latest/examples.htm)
[API examples](https://root.cern/js/latest/api.htm)
## Install
```
npm install jsroot
```
For 3D rendering jsroot uses [gl](https://www.npmjs.com/package/gl) package which may have problems
during installation. To use jsroot without `gl` one can omit development packages:
```
npm install jsroot --omit=dev
```
## Documentation
[Tutorial](docs/JSROOT.md)
[THttpServer](docs/HttpServer.md)
[Changelog](changes.md)
[Reference API](https://root.cern/js/latest/jsdoc/global.html)
## Links
[https://root.cern/js/](https://root.cern/js/)
[https://jsroot.gsi.de](https://jsroot.gsi.de/)