Dear Sergey (I just guess who can answer this),
I am trying to use the fantastic THttpServer with pyroot for monitoring.
I have managed:
1- to online update TGraphs
2- display them with their actual ranges - but only sometimes
I dont know how to :
3- make (in program) unzoom to continue online display (i must click ?;click TH1F;click “let update zoom”)
3- (re) start the viewer with the older/predefined layout [ every time Imust define the pagelayout ]
4- interact with canvas/pad - e.g. set grids, logy programaticaly [ it is maybe #3]
Would you have an advice? I searched the internet, looked briefly to tutorials…
Thank you in advance,
Jaromir
ROOT Version: 6.14.06 Platform: ubuntu Compiler: Not Provided
Can you describe more precise your problem?
Do you have examples when range selection does not work?
This is more JSROOT problem/feature. Idea behind is following - once user changed zoom selection in the browser, selection remains even when object data updated from the server. And such zoom selection cannot be changed from the server. Only by unzooming actual data range will be displayed. Easiest way to make unzoom - double-click on the frame (place where hisograms/graphs are draw).
Many parameters can be defined with URL syntax (including layout). Like:
You can reproduce create such link, if after drawing all necessary elements activates context menu over most top element (job1 in the example) and select Direct item menu command.
List of all available URL parameters can be found here:
Some of these parameters can be predefined already on the server side (see tutorials/http/httpcontrol.C macro)
Most easy way to restore grid or log settings - register TCanvas to the THttpServer. These settings belongs to TCanvas. But in principle, one could use gridx or logx draw option when drawing histograms. Like:
Dear Sergei,
thank you very much for the information. It is quite dense for me, but SetItemField works great. I am busy these days to prepare a quality followup question on updating TGraph.
I try briefly:
I set a new point of TGraph(s) on every update (5 seconds) g.SetPoint( g1.GetN(), x,vals[0] ) and I try to convince the graph to unzoom to the actual range. Usually I must manually clear and draw panels again to get the Y range expanded:
#pyroot
# this works fine .. x being the time
g.GetXaxis().SetLimits( x-ROOT.TIMEBUFFER, x+10)
# this sometimes yes, rather not much
if mn!=mx:
g.SetMaximum( mx )
g.SetMinimum( mn )
g.GetYaxis().SetLimits( mn,mx )
g.GetHistogram().GetYaxis().SetRangeUser(mn,mx)
Maybe you already have some working example already in your pocket.
Best reagards
Jaromir
Dear Sergey, thanks for the example. Two small but important differences to my case (that introduce more complications):
i start with zero points and every 5s I add one point. And run for days.
i want to see monitored last 1 hour/5minutes/24 hours - depending on user will (I set a global variable for this). And the freedom to go back in time and check what happened 2 days ago.
Best regards, thanks for the effort,
Jaromir
More points should not be a problem.
But automatic selection of last 1 hour is a problem - I never develop/test such functionality in JSROOT.
I will check if something can be done.
But in our DAQ framework I use different approach.
I collect timed data on server side, but never send complete set of points to client - only when they really requested. And normally only last 100 points are seen.
Probably, you could follow same approach. Just create several TGraphs - with points for last 1hour, 5minutes and so on. And select these graphs by name on client side or just replace them on server - by re-registering:
serv->Register("/", appropriate_gr);
One can replace any registered object in THttpServer at any time - there no any “hidden” states.
This will save you data traffic between server and client.
Here TGraph always growing, but configured to show only last 100 points.
If one double-click on the frame (unzoom), all TGraph points will be shown. If double-click second time, range selection will be restored and continue to update.
Code is now only in JSROOT dev version - it configured like:
serv->SetJSROOT("http://jsroot.gsi.de/dev/");
Or you can checkout dev branch from jsroot repository and configure JSROOTSYS location like:
Fantastic. One practical thing would be helpful - to have a possibility to zoom in and see the monitoring. I can (sometimes) manage now with clicking (?)-TH1F-Let update zoom. But it is very deep for a casual user with 5 graphs.
One important point I didnt realize: every (monitoring) update, all objects are re-sent to all clients, are they?
Dear Sergey, I tried to elaborate a bit, I create 3 graphs with different # of points. I use that dev JS you have pointed in your example.
I see two things that might improve the usage a lot:
sometimes on must doubleclick 3 or more times to get the the continuous regime,
when I make zoom on y-axis and I want to have continuous update, I must click (?), click TH1F, click Let Update Zoom. Could this great function be easier accessible somehow? Even for all graphs at once.
Thank you for your help and the improvements you already did.
best regards
Jaromir
In normal situation it should be two double-clicks.
But if update comes in-between, more clicks may be required.
It is very special functionality, which is not very evident for normal user.
Now in “dev” version I tried to put same functionality into “Toggle zoom/unzoom” button.
If you do unzoom with it, range update from server will be allowed.
Please check if fits to you.
Everything is nice, unless I need to “cut” an y-range from a long TGraph and I need to watch it. However, this I can (as you suggested before) overcome by create short (clones of) TGraph, that displays the last 100 points and sets the range there.
“let update zoom” seems still very nice thing but hidden a bit for a user.
Thank you,
enjoying and looking forward your future code,
Jaromir