<DIV>
<DIV>Hi,</DIV>
<DIV>I have a problem with <FONT size=2>vtkXYPlotActor on the X axis : I want to draw a curve in X range [ 20, 330 ], it works, but the X axis range is from 20 to 420 (look at the screenshot).</FONT></DIV>
<DIV>I tried to call SetXRange( 20, 330 ), or to change the number of X labels with SetNumberOfXLabels( 10 ) but nothing change (there are still 5 X labels).</DIV>
<DIV>What's wrong ?</DIV>
<DIV> </DIV>
<DIV>#include <vtkRenderWindow.h><BR>#include <vtkRenderWindowInteractor.h><BR>#include <vtkRenderer.h><BR>#include <vtkXYPlotActor.h><BR>#include <vtkFloatArray.h><BR>#include <vtkFieldData.h><BR>#include <vtkDataObject.h></DIV>
<DIV> </DIV>
<DIV>int main()<BR>{<BR> // rendering stuff<BR> vtkRenderWindow * renWin = vtkRenderWindow::New();<BR> vtkRenderWindowInteractor * Iter = vtkRenderWindowInteractor::New();<BR> renWin->SetInteractor( Iter );<BR> vtkRenderer * ren = vtkRenderer::New();<BR> renWin->AddRenderer( ren );</DIV>
<DIV> </DIV>
<DIV> // plot actor<BR> vtkXYPlotActor * xyplot = vtkXYPlotActor::New(); <BR> xyplot->SetWidth( 1 );<BR> xyplot->SetHeight( 1 );<BR> xyplot->SetPosition( 0, 0 );<BR> ren->AddActor2D( xyplot );</DIV>
<DIV> </DIV>
<DIV> // simple line x = [ 20, 330 ]<BR> vtkFloatArray * xarray = vtkFloatArray::New();<BR> vtkFloatArray * yarray = vtkFloatArray::New();</DIV>
<DIV> const int start = 20;<BR> const int end = 330;<BR> for ( int i = start; i <= end; ++i )<BR> {<BR> xarray->InsertNextValue( i );<BR> yarray->InsertNextValue( 100 );<BR> }<BR> //xyplot->SetXRange( start, end );<BR> //xyplot->SetNumberOfXLabels( 10 );</DIV>
<DIV> </DIV>
<DIV> // add the line<BR> vtkFieldData * values = vtkFieldData::New();<BR> values->AllocateArrays( 2 );<BR> values->AddArray( xarray );<BR> values->AddArray( yarray );<BR> <BR> vtkDataObject * data = vtkDataObject::New();<BR> data->SetFieldData( values );</DIV>
<DIV> xyplot->AddDataObjectInput( data );<BR> xyplot->SetXValuesToValue();<BR> xyplot->SetDataObjectYComponent( 0, 1 );<BR> <BR> // render<BR> renWin->SetSize( 500, 500 );<BR> renWin->Render();<BR> Iter->Initialize();<BR> Iter->Start();<BR>}</DIV>
<DIV> </DIV>
<DIV> </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>