<div class="gmail_quote">On Sun, Mar 28, 2010 at 2:03 PM, <span dir="ltr"><<a href="mailto:edoardo.belletti@alice.it" target="_blank">edoardo.belletti@alice.it</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>
<p><font size="2"> Hello,<br>
<br>
I am new to VTK so please sorry if this problem is obvious.<br>
<br>
I am trying to use the XYPlotActor object to create a simply plot of one variable against another.<br>
<br>
I have found a piece of code in a past discussion and I have tried to run it but the problem is that it doesn't found the<br>
vtkFloatScalars.h file<br>
is there anything in particular that I should add in the CMakeLists.txt to include this library?<br>
the code is this:<br>
<br>
int main()<br>
{<br>
int dataSize = 4;<br>
float x[4] = { 0, 1.5, 6.2, 10.2 };<br>
float y[4] = {8, 9.3, 10.9, 27};<br>
vtkRectilinearGrid *curve1 = vtkRectilinearGrid::New();<br>
curve1->SetDimensions(dataSize,1,1);<br>
vtkFloatScalars *dataValues = vtkFloatScalars::New();<br>
vtkFloatScalars *xCoords = vtkFloatScalars::New();<br>
<br>
int w;<br>
for(w=0; w<dataSize; w++)<br>
{<br>
dataValues->InsertScalar(w, y[w]);<br>
xCoords->InsertScalar(w, x[w]);<br>
}<br>
<br>
curve1->SetXCoordinates(xCoords);<br>
curve1->GetPointData()->SetScalars(dataValues);<br>
<br>
vtkXYPlotActor *theXYPlot = vtkXYPlotActor::New();<br>
theXYPlot->SetXValuesToArcLength();<br>
theXYPlot->AddInput(curve1);<br>
return 0;<br>
}<br>
<br>
Thank you very much for the interest<br>
Edoardo</font>
</p><p><font size="2"><br></font></p></div></blockquote><div>There is no file in the current CVS called vtkFloatScalars.h, so I'm assuming that is very old code.</div><div><br></div><div>Marcus Hanwell has been working hard on new charting functionality - there is a simple example here:</div>
<a href="http://www.vtk.org/Wiki/VTK_Examples_Chart_XY" target="_blank">http://www.vtk.org/Wiki/VTK_Examples_Chart_XY</a></div><div class="gmail_quote"><br></div><div class="gmail_quote">You must have the latests CVS version of VTK built to use this new feature.</div>
<div class="gmail_quote"><a href="http://www.vtk.org/Wiki/VTK_Examples_Chart_XY" target="_blank"></a><br clear="all">
Thanks,<br><br>David</div>