Sum of TGraphs


I am working with a bunch of TGraph objects, which I draw using TMultiGraph .
I am currenlty at a stage where I need to see a sum of all the data over time, to maybe expose a general behavior (typically the measured current in all channels of a high voltage module).
I couldn’t find a way to do this considering the data isn’t homogeneous in time. The data is very messy.

Anyway I do have a TMultigraph with 16 graphs, so is there a similar option as stacking histograms, but with tgraphs ?

Sorry if any of this is unclear at all.

Thank you in advance.

There is no specific option in TMultiGraph::Paint to do what you are requesting. TMultiGraph::Paint creates a coordinates system wide enough to contain all the graphs and paint them one by one into it. The only way I can think of to do what you want right now, is to create yourself an other graph which is the sum of all the graphs in the multigraph. But, I agree, that might be non trivial if the points along X do not match.

Thank you for the prompt reply.
You pointed my main problem, the data along X (time) do not match, as the current value is recorded not on a rate basis but everytime it goes out of a certain window, so at a given moment, I don’t have a complete set a measurements.
An idea might be to give a series of time intervals containing enough data then compute the sum and an average time for each.
I’ll dig that way.


The function TGraph::Eval(…) should help you a lot in that task.