<DIV>Hi,</DIV>
<DIV>I am using a vtkXYPlotActor in order to draw curves from scratch. 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> XYplot->RemoveAllInputs()</DIV>
<DIV>and do the same thing, and it crashes. I found that this is because RemoveAllInputs() does not apply on vtkXYplotActor::<FONT size=2>DataObjectInputList.</FONT></DIV>
<DIV>Instead I call</DIV>
<DIV> XYplot->GetDataObjectInputList()->RemoveAllItems();</DIV>
<DIV>and it works well.</DIV>
<DIV>Is it a normal behaviour ?</DIV>
<DIV> </DIV>
<DIV>
<DIV>Here is the interesting code :</DIV>
<DIV> </DIV>
<DIV> vtkFloatArray * Xarray = vtkFloatArray::New();<BR> vtkFloatArray * Yarray = vtkFloatArray::New();</DIV>
<DIV> // fill the arays<BR> for ( size_t i = 0; i < R.size(); ++i )<BR> {<BR> Xarray->InsertNextValue( i );<BR> Yarray->InsertNextValue( R.at( i ) );<BR> }</DIV>
<DIV> // create the data object<BR> vtkFieldData * FieldValues = vtkFieldData::New();<BR> FieldValues->AllocateArrays( 2 );<BR> FieldValues->AddArray( Xarray );<BR> FieldValues->AddArray( Yarray );</DIV>
<DIV> vtkDataObject * Data = vtkDataObject::New();<BR> Data->SetFieldData( FieldValues );</DIV>
<DIV> // add input<BR> this->XYplot->AddDataObjectInput( Data );<BR> int num = this->XYplot->GetDataObjectInputList()->GetNumberOfItems()- 1;<BR> this->XYplot->SetDataObjectYComponent( num, 1 );<BR> this->XYplot->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>