[vtkusers] Redraw vtkXYPlotActor with new data
Poseidonius
zug at ivs.cs.uni-magdeburg.de
Wed Dec 7 15:21:27 EST 2011
Hi,
I wrote a small python script visualizing some data with vtkXYPlotActor. But how
can I refresh my diagram after a new set of data was received?
Thank you!
Best wishes
Poseidonius
_x = numpy.array([0.0, 5.0])
_xData = vtk.vtkDataArray.CreateDataArray(vtk.VTK_FLOAT)
_xData.SetNumberOfTuples(len(_x))
_y0 = numpy.array([0, 1.0])
_y0Data = vtk.vtkDataArray.CreateDataArray(vtk.VTK_FLOAT)
_y0Data.SetNumberOfTuples(len(_y0))
for i in range(len(_x)):
_xData.SetTuple1(i,_x[i])
for i in range(len(_x)):
_y0Data.SetTuple1(i,_y0[i])
_fieldData0 = vtk.vtkFieldData()
_fieldData0.AllocateArrays(2)
_fieldData0.AddArray(_xData)
_fieldData0.AddArray(_y0Data)
_dataObject0 = vtk.vtkDataObject()
_dataObject0.SetFieldData(_fieldData0)
plotActor = vtk.vtkXYPlotActor()
...
plotActor.AddDataObjectInput(_dataObject0)
renCamera = vtk.vtkRenderer()
renCamera.SetLayer(0)
renCamera.AddActor(actCamera)
renDiag = vtk.vtkRenderer()
renDiag.AddActor(plotActor)
while(1)
#receive new data
....
renDiag.DrawOn()
More information about the vtkusers
mailing list