Home | News | Documentation | Download

Get plot title from javascript

Is it possible to get the plot title via javascript while using jsroot?

Cheers.

Hi @wturner; I am sure @linev knows the answer to your question.

Cheers,
J.

Hi,

Can you provide more details that you want to do?

Regards,
Sergey

Hi Sergey,

We are displaying a plot from a root file on a website via jsroot. We would like to be able to access the title of said plot to add the text to a button on the website. is this possible?

Cheers

Hi,

It depends that kind of object is drawn.
Typically one draw histogram and see its title.
If in the JS code you have something like:

      JSROOT.openFile("https://root.cern/js/files/hsimple.root")
            .then(file => file.readObject("hpxpy;1"))
            .then(obj => JSROOT.draw("drawing", obj, "colz"));

Then shown title is just obj.fTitle value.
If one displays TCanvas objects, one should do something like canv.fPrimitives.arr[0].fTitle

Regards,
Sergey