I have an application that I have put together that uses a TGraph. I allocate arrays for the x and y in this 2 dimensional graph. The data come in realtime and per second I update the TGraph, using Draw(“LP”).
Well the TGraph behaves as it should by drawing all the points even
the ones not yet filled. Is there a way I can tell TGraph to draw a subset
of the points allocated to it?
So using drawgraph, do I do the following?
Elsewhere in the code I do a tg = new TGraph(Npoints) with the total number of points I intend to use.
In the update function it appears that I would have to do something like
Double_t *x = tg->GetX();
Double_y *y = tg->GetY();
since there doesn’t appear to be a method without x and y as input or
is it sufficient to put in x and y as null?
This is correct.
In the CVS version, you can call
to draw only the first n points of the graph.
Does point number on your plots only increase
or you wish firstly draw 10 points, then only 5?
There is a thread on a similar issue in the roottalk mail list:
mygraph.DrawGraph(n) creates a new graph thus it is significaly
slower than new TGraph::SetPoint() implementation.
Although a graph with external x-y arrays can be useful.