JSRootIO v2.9 & 3.0 don't draw TCanvas?

I’ve attached a sample .root file that has a single TCanvas in it. I’ve found that the JSRootIO v2.1 can display this canvas, but versions 2.9 and 3.0 don’t. All I get in these cases are axes with an invalid range and no data displayed. Should I be able to display this TCanvas in the newer versions of JSRootIO?

I’ve also noticed that the drawing of the canvas feels rather slow. I’m following a similar pattern done from the index.htm sample UI, where the JSRootFile is instantiated, I wait for userCallback(file) to be called, then I call showObject(). Is there something that I could do to speed up the drawing?


canvas.root (44.8 KB)

Hi Tim,

I can reproduce the problem.
I already implement fix, it will be available soon in ROOT repository.

With new JSROOT code you could use link like this:

About performance - could you specify your problem more precisely?
Is it long time to draw canvas for the first time?
Probably, you could speed-up this time by providing “+” at the end of file name (as in my example).
In such case file loaded at once, which could be faster (depending from network, server and file size).

Or it is long reaction time after first drawing - for instance when you zoom-in/zoom-out?



Fix in repository now. It is also included in latest ROOT release.
Code also can be used directly from: http://root.cern.ch/js/3.0/


Thank you for the quick reply. I have it displaying my canvas using v3.0 now.

Though I noticed the axes in your link are much narrower and the dropdown works (mine doesn’t pop-up but rather displays text below). Any idea what might be going on there?

You can see an example with the oddly cropped attachment … I don’t have the canvas’ HTML element sized to get everything fitting on one screen yet.

Thanks again!

I missed noting that the performance is much improved when I went to v3.0 as well :smiley:

I go the axes & context menu to appear normally. I missed including the JSRootPainter.css.

Thanks again!


I recommend to use funktion JSROOT.AssertPrerequisities
It loads all necessary scripts and style files automatically.