<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="Generator" CONTENT="MS Exchange Server version 6.5.7655.8">
<TITLE>R: [vtkusers] Plot XY</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/plain format -->
<P><FONT SIZE=2>I don't have the latests CVS version of VTK but VTK 5.4.2 that I have download from www.vtk.org<BR>
and so the code that you suggest me it doesn't work because it don't found these files:<BR>
vtkChartXY, vtkPlot.h.h, vtkContextView.h, vtkContextScene.h<BR>
There is some way to simply have a XYPlot of two vectors with my VTK release?<BR>
<BR>
Thank you<BR>
Edoardo<BR>
<BR>
-----Messaggio originale-----<BR>
Da: daviddoria@gmail.com per conto di David Doria<BR>
Inviato: dom 28/03/2010 20.10<BR>
A: edoardo.belletti@alice.it<BR>
Cc: VTK_forum<BR>
Oggetto: Re: [vtkusers] Plot XY<BR>
<BR>
On Sun, Mar 28, 2010 at 2:03 PM, <edoardo.belletti@alice.it> wrote:<BR>
<BR>
> 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<BR>
> variable against another.<BR>
><BR>
> I have found a piece of code in a past discussion and I have tried to run<BR>
> 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<BR>
> 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<BR>
><BR>
><BR>
> There is no file in the current CVS called vtkFloatScalars.h, so I'm<BR>
assuming that is very old code.<BR>
<BR>
Marcus Hanwell has been working hard on new charting functionality - there<BR>
is a simple example here:<BR>
<A HREF="http://www.vtk.org/Wiki/VTK_Examples_Chart_XY">http://www.vtk.org/Wiki/VTK_Examples_Chart_XY</A><BR>
<BR>
You must have the latests CVS version of VTK built to use this new feature.<BR>
<<A HREF="http://www.vtk.org/Wiki/VTK_Examples_Chart_XY">http://www.vtk.org/Wiki/VTK_Examples_Chart_XY</A>><BR>
Thanks,<BR>
<BR>
David<BR>
<BR>
</FONT>
</P>
</BODY>
</HTML>