<DIV>Hi,</DIV>
<DIV>I am also plotting points from a std::vector<float> with a vtkXYPlotActor.</DIV>
<DIV>My code looks like this :</DIV>
<DIV> </DIV>
<DIV>std::vector<float> values;<BR>/* ... */</DIV>
<DIV>vtkFloatArray * Xarray = vtkFloatArray::New();<BR>vtkFloatArray * Yarray = vtkFloatArray::New();</DIV>
<DIV> </DIV>
<DIV>Xarray->Initialize();<BR>Yarray->Initialize();</DIV>
<DIV>for ( int i = 0; i < values.size(); ++i )<BR>{<BR> Xarray->InsertNextValue( i );<BR> Yarray->InsertNextValue( values[ i ] );<BR>}</DIV>
<DIV>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>vtkXYPlotActor * XYplot = vtkXYPlotActor::New());<BR>XYplot->AddDataObjectInput( Data );<BR>XYplot->SetXValuesToValue();<BR>XYplot->SetDataObjectXComponent( 0, 0 );<BR>XYplot->SetDataObjectYComponent( 0, 1 );</DIV>
<DIV><BR>But I have a problem.</DIV>
<DIV>When I want to change the viewed values, I do the same thing just after a XYplot->RemoveAllInputs(), but it crashes...</DIV>
<DIV> </DIV>
<DIV>Hope this helps.</DIV>
<DIV><BR><B><I>Curtis Cooper <curtis@hindmost.LPL.Arizona.EDU></I></B> wrote:</DIV>
<BLOCKQUOTE class=replbq style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #1010ff 2px solid">Hi,<BR><BR>I am interested in plotting pairs of input X, Y vectors using VTK, with<BR>the ability to set the attributes of each dataset separately, as is done<BR>in the example xyPlot.py.<BR><BR>My vectors start as STL vectors. How do I get that into the dataset<BR>format understood by the vtkXYPlotActor class? For an example C++ usage,<BR>I want to be able to do this:<BR><BR><BR>vector<VTKFLOATINGPOINTTYPE> x, y2, y3;<BR><BR>x.push_back(1); x.push_back(2); x.push_back(3);<BR>x.push_back(4); x.push_back(5); x.push_back(6);<BR><BR>y2.push_back(1); y2.push_back(4); y2.push_back(9);<BR>y2.push_back(16); y2.push_back(25); y2.push_back(36);<BR><BR>y3.push_back(1); y3.push_back(8); y.push_back(27);<BR>y3.push_back(64); y3.push_back(125); y.push_back(216);<BR><BR>QueueVectorPair(x, y2);<BR>QueueVectorPair(x,
y3);<BR><BR>Plot();<BR><BR><BR>Thanks,<BR>Curtis<BR><BR>_______________________________________________<BR>This is the private VTK discussion list. <BR>Please keep messages on-topic. Check the FAQ at: <HTTP: vtkfaq cgi-bin public.kitware.com><BR>Follow this link to subscribe/unsubscribe:<BR>http://www.vtk.org/mailman/listinfo/vtkusers</BLOCKQUOTE><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>