<DIV>Hi,</DIV>
<DIV>I am using a vtkXYPlotActor in order to draw curves from scratch.&nbsp; To do this, I build a vtkDataObject that I add to my vtkXYPlotActor by calling AddDataObjectInput.</DIV>
<DIV>It works well, the first time. When I want to change the values viewed, I call</DIV>
<DIV>&nbsp;&nbsp;&nbsp; XYplot-&gt;RemoveAllInputs()</DIV>
<DIV>and do the same thing, and it crashes. I&nbsp;found that this is because RemoveAllInputs() does not apply on vtkXYplotActor::<FONT size=2>DataObjectInputList.</FONT></DIV>
<DIV>Instead I call</DIV>
<DIV>&nbsp;&nbsp;&nbsp; XYplot-&gt;GetDataObjectInputList()-&gt;RemoveAllItems();</DIV>
<DIV>and it works well.</DIV>
<DIV>Is it a normal behaviour ?</DIV>
<DIV>&nbsp;</DIV>
<DIV>
<DIV>Here is the interesting code :</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;&nbsp;&nbsp; vtkFloatArray * Xarray = vtkFloatArray::New();<BR>&nbsp;&nbsp;&nbsp; vtkFloatArray * Yarray = vtkFloatArray::New();</DIV>
<DIV>&nbsp;&nbsp;&nbsp; // fill the arays<BR>&nbsp;&nbsp;&nbsp; for ( size_t i = 0; i &lt; R.size(); ++i )<BR>&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Xarray-&gt;InsertNextValue( i );<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Yarray-&gt;InsertNextValue( R.at( i ) );<BR>&nbsp;&nbsp;&nbsp; }</DIV>
<DIV>&nbsp;&nbsp;&nbsp; // create the data object<BR>&nbsp;&nbsp;&nbsp; vtkFieldData * FieldValues = vtkFieldData::New();<BR>&nbsp;&nbsp;&nbsp; FieldValues-&gt;AllocateArrays( 2 );<BR>&nbsp;&nbsp;&nbsp; FieldValues-&gt;AddArray( Xarray );<BR>&nbsp;&nbsp;&nbsp; FieldValues-&gt;AddArray( Yarray );</DIV>
<DIV>&nbsp;&nbsp;&nbsp; vtkDataObject * Data = vtkDataObject::New();<BR>&nbsp;&nbsp;&nbsp; Data-&gt;SetFieldData( FieldValues );</DIV>
<DIV>&nbsp;&nbsp;&nbsp; // add input<BR>&nbsp;&nbsp;&nbsp; this-&gt;XYplot-&gt;AddDataObjectInput( Data );<BR>&nbsp;&nbsp;&nbsp; int num = this-&gt;XYplot-&gt;GetDataObjectInputList()-&gt;GetNumberOfItems()- 1;<BR>&nbsp;&nbsp;&nbsp; this-&gt;XYplot-&gt;SetDataObjectYComponent( num, 1 );<BR>&nbsp;&nbsp;&nbsp; this-&gt;XYplot-&gt;SetPlotColor( num, vtkXYPlot::GetPlotColors( num ) );<BR></DIV>
<DIV>Is there a better way to do the same thing ? (in particular for the 3 last lines).</DIV>
<DIV>Thanks.</DIV></DIV><BR><BR>Aurélien REGAT-BARREL<p>
                <hr size=1>
Yahoo! Mail : votre e-mail personnel et gratuit qui vous suit partout !
<br><a href="http://fr.rd.yahoo.com/mail/taglines/*http://fr.rd.yahoo.com/mail/mail_taglines/default/*http://fr.benefits.yahoo.com/">Créez votre Yahoo! Mail</a>
<br><br>
Dialoguez en direct avec vos amis grâce à <a href="http://fr.rd.yahoo.com/mail/taglines/*http://fr.rd.yahoo.com/messenger/mail_taglines/default/*http://fr.messenger.yahoo.com/">Yahoo! Messenger !</a>