Thanks for the quick response!
I understand most of your solution, and it sounds like it could work...
I have another question... after the screen moves over... what would be
the simplest way to make it so i can scroll back to the other data?
On Wed, 2002-06-05 at 16:33, Bill Hibbard wrote:
> Hi Mike,
> > I am attempting to create a simple XY line graph that I can add points
> > to during runtime, so that each time I add a point to it the display
> > will update. I have written a few simple programs to use visAD and I
> > have read through the visAD tutorial and... but I cannot find a clean
> > way to do this...
> > All I would like to do is have time on the x-axis, and plot another
> > quantity on the y-axis...and efficiently update the display each time I
> > add a point.
> > is this do-able? it seems like i would need a function
> > (time->quantity), with an Integer1DSet for time. but the Integer1DSet
> > would have to grow by 1 and so would the container that holds the
> > quantity values, so I would have to create a new Integer1DSet and copy
> > over the array to a new one 1 size bigger everytime I want to add a
> > point? this is the only way I can think of doing it with my beginner
> > visAD knowledge... there has to be a better way? (maybe doing something
> > with an animation?)
> One way to do it is to construct an Integer1DSet with more
> sample points than you need, and initially set the 'quantity'
> values for the unused samples to Float.NaN (missing indicator)
> so they won't be displayed. Then as samples come in call
> FlatField.setSample(i, value) to over-write the NaNs one-by-one.
> > Eventually, I would like to have an XY line graph that always contains a
> > constant number of points, and then it starts scrolling when you add
> > points that don't fit on the graph. for example, the graph could start
> > out with the time scale from 0 to 499 ... with no points plotted... then
> > when you add point 500 the graph would shift and now be showing points 1
> > through 500... then when point 1000 is added points 501 to 1000 are
> > showing... then you can scroll through the points after all the data has
> > been generated?
> You could do this by growing a FlatField as I described above,
> plus repeated calls to setRange() for the ScalarMap to XAxis.
> This is an easy but not very efficient way to handle your
> problem. But if you try it and don't notice delays, go with
> it. If you do notice delays, you can make it more efficient
> 1. Use say 10 FlatFields with 50 samples each, and each
> linked to the DisplayImpl by its own DataReference. When
> you fill up one FlatField, construct a new one (with an
> appropriate Integer1DSet for the next 50 samples) and use
> it to replace the oldest FlatField (replace by passing
> the new FlatField to the setData() method of the
> DataReference of the oldest FlatField).
> 2. Rather than calling setRange() on each sample, call
> ProjectionControl.setMatrix() to move the display slightly.
> You will need to experiment a bit to get the matrix right
> (call getMatrix() and multiply it by a translation matrix).