JSROOT Draw TMultiGraph with opt "SAME" cannot update ymax

I am using JSROOT to provide a web-display of online test-data.

When upgrading to JSROOT version from 4.8.2 to above 5.00
only the first TMultiGraph is shown, but not the ones drawn with
opt “SAME” containing points with x-values beyond the first graph.
In Vs.482 it was sufficient to update main_painter().xmax
before calling RedrawPad(), but since Vs.500 this does not work anymore.

It works also in Vs.500+ if I plot the TGraphs instead of the TMultiGraphs,
but I need the TMultiGraphs.

A workaround would be to loop over all TGraphs to create a new TGraph
concatenating all points and then collect them in a single TMultiGraph
and draw only this one, but maybe there is a better solution ?

A short standalone example is available here - only difference is JSROOT-Vs:
The point at x=9.05 is from the 2nd TMultiGraph.

I hope someone can help,
many thanks in advance,
Thorsten Siedenburg

JSROOT Version: 5.0.0+
Platform: Firefox 58
Compiler: Not Provided

Hi Thorsten,

Why you try to use several TMultiGraph objects?
Can you put all graphs into one TMultiGraph?

As a workaround, you can create histogram for the first multigraph object and configure all limits yourself:

   mg1.fHistogram = JSROOT.CreateTH1(100);
   mg1.fHistogram.fXaxis.fXmax = Xmax;
   mg1.fHistogram.fMinimum = 0;
   mg1.fHistogram.fMaximum = 10;

Full example: http://jsroot.gsi.de/files/tmp/mgtest.htm

This should work for both JSROOT versions.
But again - recommended way is to use single TMultiGraph.


Hi Sergey,

thanks a lot for your quick answer.

So my “workaround” is the recommended way.

I used several TMultiGraphs, because data is available
in daily files containing TGraphs.

Since drawing all daily TMultiGraphs with opt “SAME” worked
I was too lazy to first merge all points into single TGraphs.

Will do this now.

Thanks again


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