I’ve been attempting to display a histogram using jsroot recently, but I’ve encountered the following error:
Uncaught TypeError: Cannot read properties of null (reading 'style')
at En (d3.mjs:2:20700)
at ce.style (d3.mjs:2:27988)
at TCanvasPainter.createCanvasSvg (TPadPainter.mjs:572:24)
at TCanvasPainter.draw (TCanvasPainter.mjs:814:15)
at ensureTCanvas (TCanvasPainter.mjs:844:37)
at THistPainter._drawHist (THistPainter.mjs:2337:14)
at Object.draw [as func] (TH2Painter.mjs:285:27)
at performDraw (draw.mjs:384:38)
at draw.mjs:435:30
at async test3.html:6:4
Here’s my code:
<script type='module'>
import { openFile, draw } from 'https://root.cern/js/latest/modules/main.mjs';
let filename = "http://192.168.0.102/jsroot/ridf2tree/run0029.root";
let file = await openFile(filename);
let obj = await file.readObject("hmadc_0;1");
await draw("drawing", obj, "colz");
</script>
I’ve tried this at http://192.168.0.102/jsroot/test3.html, but the error persists.
I would appreciate any solutions or advice you might have. Thank you very much in advance.