Setting margin for TBasePainter in JSROOT

Hi jsROOT experts!

I didn’t see a jsroot category so I’m posting here.

I’m building an offline data quality monitoring website directly reading from histograms root file on the server, using jsroot. I’m using the JSROOT.draw() jsroot API in javascript to plot some graphs with fixed pixel size.

I can achieve modification of histogram subclasses like axis title, size, by changing the _fxaxis objects, etc. But I really have a hard time to change the left margin so that the axis title is not truncated. I tried to set subclass rootframe attribute x, width, but it doesn’t work. Is there an API to quickly work around this?

Here’s my webpage and source code if necessary.
https://rowang.web.cern.ch/rowang/jsroot.html?plot=hit&filename=inputs/TP0_decoded.root

jsroot_website.zip (7.4 KB)


ROOT Version: Not Provided
Platform: Not Provided
Compiler: Not Provided


Hi

Most easy way to configure margins - use TCanvas object.
It includes many graphics properties, including margings around frame.

c1->SetLeftMargin(0.2)

Just construct TCanvas, add all objects you want to draw, check how it displayed with plain ROOT. And try to draw with JSROOT.

In principle, there are predefined values in JSROOT, which also can be changed.
After JSRootCore.js script is loaded, one can modify default margin:

JSROOT.gStyle.fPadLeftMargin = 0.2

Defined here:

Regards,
Sergey

Thanks a lot Sergey! The second option works!
I agree the first option is very flexible, but just would like to explore the native jsROOT options.

RK

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