root-project / jsroot

JavaScript ROOT
MIT License
187 stars 80 forks source link

Enable menu by default #295

Closed grzanka closed 6 months ago

grzanka commented 7 months ago

Is there a way to enable by default menu (lowest left circular button) on TH1 plots or TGraphs ?

I have an example described here: https://github.com/yaptide/ui/issues/1557

Here is my code I use for plotting ( I use npm jsroot package in my JS code): https://github.com/yaptide/ui/blob/master/src/JsRoot/components/JsRootGraph1D.tsx

Moreover - what is the best place to raise such questions ? The issues here on github or ROOT forum (https://root-forum.cern.ch/tag/jsroot) ?

linev commented 7 months ago

I am in vacation until mid April

There s url option to let always show tool buttons.like toolbar=on.

See https://github.com/root-project/jsroot/blob/master/docs/JSROOT.md#drawing-objects-in-jsroot

There is corresponding field in 'settings' object

grzanka commented 7 months ago

Thanks ! Have a nice vacation :)

linev commented 6 months ago

One can do:

settings.ToolBar = true;

See comments in source code and in the generated docu.

grzanka commented 6 months ago

One can do:

settings.ToolBar = true;

See comments in source code and in the generated docu.

I've already did it in a similar way:

https://github.com/yaptide/ui/pull/1577/files

At first I though this could be specified as some property of plot or canvas object.

Anyway, using JSROOT in TypeScript React apps seems a bit tricky, you can take a look on the react hook code, needed to properly setup window rescaling: https://github.com/yaptide/ui/blob/master/src/JsRoot/hook/useJsRootCanvas.tsx

linev commented 6 months ago

May be you call JSROOT drawing before HTML element is fully rendered?

Especially when element has width: 100% it can be re-adjusted by browser at any time.

linev commented 6 months ago

Did you resolve your issue?

Maybe you also can use registerResize function of JSROOT? It tries to catch changes in HTML element resize and update JSROOT drawing. Simple example of its usage see here:

https://github.com/root-project/jsroot/blob/master/demo/update_draw.htm#L47

grzanka commented 6 months ago

Thanks for a hint with registerResize ! I will note it down in my own issues. We had to put these developments on hold. But to keep some order in repo I would be in favor of closing this issue. I can come back with new issue or discussion topic when we resume.