[vtkusers] Clearing vtkPlot object
Marcus D. Hanwell
marcus.hanwell at kitware.com
Fri Dec 19 10:48:41 EST 2014
On Fri, Dec 19, 2014 at 10:12 AM, Maarten Beek via vtkusers
<vtkusers at vtk.org> wrote:
> Hi all,
> Yesterday I started exploring the options to draw 2d graphs in VTK.
> Why does
> not remove the graph from my chart?
That isn't how the API was designed, you can call remove for a plot,
or clear all plots.
> I am currently using
> vtkTable* table = m_pChart->GetPlot(0)->GetInput();
> if( 0 != table )
> while( 0 < table->GetNumberOfRows() )
> m_pChart->GetPlot(0)->GetData()->Modified(); // <- required!
Unless the data is marked as modified then the plot is cached, and it
would be slow to rebuild on every render. This is pretty common in the
VTK API, if an object is not marked as modified it is not surprising.
I guess you might expect SetInputData on the plot to mark that as
modified, which could be a bug in that method.
Hope that makes it clearer, it has been a while since I went through
all of this logic, and it is possible we still have one or two bugs
lurking in there.
More information about the vtkusers