[vtkusers] alternative to vtkTable for use with vtkChartXY

Marcus D. Hanwell marcus.hanwell at kitware.com
Thu Sep 29 10:04:12 EDT 2011


On Mon, Sep 26, 2011 at 2:21 PM, Luke <hazelnusse at gmail.com> wrote:
> I'm making a simple GUI application to plot in quasi-realtime about 12
> time signals that are being measured and transmitted to my laptop via
> a serial connection. I was looking at the QChartTable example, and it
> seems more or less fine, but I realized that in order to have a
> "window" of data, so that N samples are shown in the vtkChartXY, I
> will need to delete rows from the top of the vtkTable once it has more
> than N rows.  I looked at the RemoveRow() method, and this will do
> what I want, but I noticed that this is implemented in a way that
> makes copies of each row and shifts them up, one at a time.  This
> seems really inefficient.  Also, there seems to be now way to remove
> more than one row at a time.   I had intended on updating the plot at
> much lower frequency than the data sample rate, so ideally I would
> remove somewhere around the top 10 rows, and then at 10 new rows to
> the bottom, which would result in 10 RowRemove() calls.
>
> Is there something more like an STL queue that I can use instead of
> vtkTable?  Or is vtkTable the only way to connect data to a
> vtkChartXY?  Are there any options to It would be nice to have
> something that I could push new data into the back and pop old data
> off the front, and feed this to vtkChartXY.
>
Not at present, but it was always my intention to allow something a
little lower level through for those who need performance. I was
considering a fast path that allowed users to give the vtkPlot objects
a well packed float with x1, y1, x2, y2. We could then either use the
data in place, or perform a single copy operation.

We haven't had any use cases concerned with real time data plotting so
far, but this is an area I used to work in during some of my Ph.D.
research.

Marcus



More information about the vtkusers mailing list