Home | News | Documentation | Download

Is one canvas per thread possible?

Now TGraph y axes should be updated

You need to update JSROOT - just do git pull in your JSROOT directory.

yes it works now ! - There is one more minor detail that you might want to fix to fully replicate the X11 behavior, which is that graph containers should be unzoomed by default. Even tho the Y axis gets properly updated now, you still have to presss F5 or unzoom the graph with the mouse wheel :

default when you run it:

after F5 or mouse wheel :

edit : note that the x axe is already at position 500 on the second picture, which is the max buffer size, but it was zoomed in before I took the second picture ( too fast to snap it at the same point :slight_smile: )

I cannot reproduce problem with zoomed Y range in the beginning.

As workaround - you can postpone canvas show to the moment when real data set to TGraph object.
Or pre-select Y range by calling:


At any time you can reset selection:

1 Like

Thanks, and not a problem ! I will keep on making tests and post results here and there

Hi Sergei, trying to run this on a server and connect from local network to it …

But obviously we get this :

/usr/bin/xdg-open: 869: x-www-browser: not found
/usr/bin/xdg-open: 869: firefox: not found
/usr/bin/xdg-open: 869: iceweasel: not found
/usr/bin/xdg-open: 869: seamonkey: not found
/usr/bin/xdg-open: 869: mozilla: not found
/usr/bin/xdg-open: 869: epiphany: not found
/usr/bin/xdg-open: 869: konqueror: not found
/usr/bin/xdg-open: 869: chromium: not found
/usr/bin/xdg-open: 869: chromium-browser: not found
/usr/bin/xdg-open: 869: google-chrome: not found
/usr/bin/xdg-open: 869: www-browser: not found
/usr/bin/xdg-open: 869: links2: not found
/usr/bin/xdg-open: 869: elinks: not found
/usr/bin/xdg-open: 869: links: not found
/usr/bin/xdg-open: 869: lynx: not found
/usr/bin/xdg-open: 869: w3m: not found
xdg-open: no method available for opening 'http://localhost:9743/win1/?key=1048305'

Is there a way to run the websocket server without the JS engine trying to open the browser for you ?

Thanks !

Try to run ROOT with root --web=server macro.C.
Or call gROOT->SetWebDisplay("server").
In such mode just window URL will appear in the standard output.


setting this at the main thread doesn’t try to run xdg-open anymore, so this works, but then I get this, if I use canvas->Show(); as I did on the local test, which is at the end of the while loop.

Info in <THttpEngine::Create>: Starting HTTP server on port 9087
sh: 1: server: not found

EDIT never mind this seems to work. I think it did not work because I was drawing an extra panel that was not being updated. Will keep on reporting as I go, thank you Sergei

Hi Sergei, is it possible to set a fixed port instead of getting a dynamically allocated one every time you run the server ? Thanks

See RWebWindowsManager::CreateServer docu. You can specify in .rootrc file following entry: WebGui.HttpPort: 8088

Problem with “server” mode I will investigate on Monday

1 Like

I cannot reproduce problem with “server” mode - for me it does that is expected.

Hi Sergei, I have configured the .rootrc file and it works with fixed port now. Yes, I still get this message from time to time : sh: 1: server: not found every two minutes or so printed on screen, but I don’t know exactly why this happens … I have checked logs on the server system where I’m running the program and I can’t see anything related to this, but it seems that something is trying to run a binary? that is not installed or can’t find it. If you have instructions for me to further debug I’ll be glad to do it and report back

Strange. It is indication that ROOT tries to open “server” browser - which should never happen.

Can you try to identify after which calls to RCanvas you see such message?

RCanvas is instantiated only once in a thread, then from there I instantiate another thread that runs the usual loop. At the end of the while loop I call :


The message doesn’t appear every time the end of the while is reached, since this is many times per second … it’s like once a minute or two, which makes it weirder since the code is fairly simple

This should be called only once. With “server” mode you should get lot of printouts like:

New web window: http://localhost:9781/win1/
New web window: http://localhost:9781/win1/
New web window: http://localhost:9781/win1/


If I call canvas->Show(); before launching the loop thread, the js app is inaccessible

if I call canvas->Show(); before the while loop in the new thread, only the first frame is rendered

if I call canvas->Show(); in the while loop, it works correctly

Note that I am passing the canvas object to the loop thread as a shared_ptr

The ouput is always Info in <THttpEngine::Create>: Starting HTTP server on port 8088 which is correct I believe

Show method should be called only once.

Can you place canvas->Run(); call inside while loop?
It may be required to process events.

placing canvas->Run(); in the while loop and moving canvas->Show(); before the loop doesn’t make a difference. As soon as canvas->Show(); is placed outside the while loop, only the first frame is rendered. If you place it on the main thread, the app won’t run. If it’s placed in the while loop, it works.

Another workaround - try to call canvas->Update(true);.
It called also inside canvas->Show();

But I would like to reproduce problem.
Can you change rcanvas_mt.cxx demo that it reproduces it?

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