Change default draw option in JSROOT.HierarchyPainter

Hello

I have been developing a Web page using JSROOT to read ROOT files and display 2D histograms but I can’t find a way of changing the default draw option for 2D histograms (which is a scatter plot) to something else (I need ‘lego2’). Is there a way of doing this once for all objects in a ROOT file so that all 2D histograms would be displayed with the new option? My web page is based on the File Browser example provided by the JSROOT documentation.

Any hint is appreciated.
Cheers,

@linev can help you.

Hi,

There is no possibility to change default draw option in JSROOT.
You could overwrite display method of HierarchyPainter like:

h._display = h.display;
h.display = function(itemname, opt) {
   if (!opt) opt = "lego2";
   this._display(itemname, opt);
} 

Problem, that such solution will change default option to “lego2” for all classes.
I will provide soon method to specify default draw option.

Regards,
Sergey

Many thanks! This solution does exactly what I need.
Cheers,
Serguei

Hi,

I also implement JSROOT.Painter.setDefaultDrawOpt function.

It can be used like: JSROOT.Painter.setDefaultDrawOpt('TH1', 'text');

See https://jsroot.gsi.de/dev/api.htm#custom_html_file_hierarchy

It is now in master.

Regards,
Sergey

Hi Sergey

Thanks, this is a great improvement. I’ll use it in my Web page.

Cheers,
Serguei

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