JSROOT does not visualize TCanvas

Dear all,

we are trying to visualize TCanvases via JSROOT. However, only a blank canvas is displayed. By right-clicking and save as XY.png the content can actually be visualized in the png file.

I have attached a file that replicates the problem in the JSROOT Read a ROOT file webpage. Read a ROOT file
TObject_1668091361362.root (14 KB)

This looks like a bug to me. Does anyone have an idea why this happens or how we can circumvent this?

Thanks a lot!

Cheers,
Thomas

Welcome to the ROOT Forum!
There is something weird with your file: I tried:

C:\Users\bellenot\rootdev>root -l
root [0] TFile::Open("TObject_1668091361362.root")
(TFile *) 0x6afb470
root [1] .ls
TFile**         TObject_1668091361362.root
 TFile*         TObject_1668091361362.root
  KEY: TCanvas  ccdb_object;1   object title
root [2] ccdb_object->Draw()
root [3]

And the canvas is also blank. How do you draw your objects?

Thank you!

Hm… ok very good point you raise. Indeed if I do the same it is also blank.

Explaining the bigger picture a bit: We have a process running that stores an object as I posted before once per minute. This can then be visualized with JSROOT on a webpage. When the process is started the first object is completely fine. It is displayed in JSROOT and when it is downloaded one can also draw it as you tried. The following objects are then like the file I posted. When the process is restarted, the first object is fine again but the following are not.

So it seems that something strange is happening to the objects after the first one is stored. But tbh I now wonder even more why saving the TPad to png is solving the display problem.

Sorry for making a fuss, I will investigate deeper because the problem could still be on our side. Any hints or ideas on how to debug are of course very welcome.

Cheers,
Thomas

Hi Thomas,

Please check code which generate your canvas.
Provided file has canvas with too many sub-pads inside:

http://root.cern/js/latest/?file=https://root-forum.cern.ch/uploads/short-url/zOnLskZLs7laspUGKaSlyJghRbA.root&expand=ccdb_object

Many of them overlap complete area and hide original drawings.

If you draw only first sub-pad, it looks fine:

https://root.cern/js/latest/?file=https://root-forum.cern.ch/uploads/short-url/zOnLskZLs7laspUGKaSlyJghRbA.root&item=ccdb_object/[0]

Regards,
Sergey

Hi Sergey,

thanks a lot for pointing this out! I guess I am simply missing a call to TCanvas::Clear() before writing to the canvas.

Now I wonder why the following TPads after the first one are empty. They should also contain data. But that is a different topic so don’t be bothered with that.

Thanks again for the quick help!

Cheers,
Thomas

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.