I am wondering how can i change the aspect ratio of the histogram saved in the root file. When I change the size of the div in which the plot is plotted the graphics is just stretched, and not rescaled properly,it looks like this:
If you have custom HTML layout and able to change div size interactively - you have to call resize function. See explanation in the JSROOT documentation
You also can use registerForResize function which automatically updates you drawing when browser window changes its size. See in JSROOT Reference
thanks. Yes, I have quite complicated HTML layout, the plot should be placed inside the table cell while table is placed inside tab structure. Since these elements have some predefined widths and styles I think this causes the problem with resizing. I tried both your suggestion but none of them has any effect. As a workaround in my JS function I created the div, placed it to the outermost part of HTML body, plotted my histo there (with no resizing) and then moved the wholed div to the correct place in the table. It works fine, but it is hacking rather than solving resizing issue…
In some situation JSROOT not able correctly define pixel size of HTML element where drawing is performed. You can also try to call resize(dom, { width: 600, height: 400 }) - where width and height should be reasonable values for you layout.
And if nothing helps - can you provide reproducer that I can check myself?
I prepared the reproducer. I also don’t quite understand why the drawer object inside tab plot is created with display:none, maybe that is also related to this issue. In the example you clearly see that drawing is rescaled properly when produced outside the tab layout, but is only streched in drawing_cov. Thanks for your help.