<!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.7652.24">
<TITLE>2D Plotting</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/plain format -->
<P><FONT SIZE=2>I am writing a custom reader for a client that needs to display an XY Plot for a given time step. I am reading in their data from a text file and outputting a vtkRectilinearGrid data object. I am currently having two issues. <BR>
<BR>
The first issue is that I can not get the plot to use the correct array as the X coordinates. The data has three arrays, stress, strain, and time. I want to plot stress versus strain. Setting the time array as the X Coordinate uses the time values as my x axis, but setting any other array as the X coordinate results in the Y axis array's index being used. <BR>
<BR>
The second issue is that the range of the axes change based off of the range of the data that is currently loaded. I would like the range on the axes to stay constant for every time step. The effect they want is one of the plot being drawn as the time step changes. With the range changing every step the results look confusing. Is there any way to change this behavior?<BR>
<BR>
Any help that can be offered will be greatly appreciated. I am including a code snippet below from the RequestData method of my class showing the code that creates, fills, and uses the arrays.<BR>
<BR>
Thank you,<BR>
Herb<BR>
<BR>
------------------------ Begin code snippet-------------------------------<BR>
output->SetDimensions(this->numberOfTimeSteps, 1, 1);<BR>
<BR>
vtkDoubleArray* stress_data = vtkDoubleArray::New();<BR>
vtkDoubleArray* strain_data = vtkDoubleArray::New();<BR>
vtkDoubleArray* time_data = vtkDoubleArray::New();<BR>
<BR>
vtkPointData* points = output->GetPointData();<BR>
<BR>
stress_data->SetName("Stress");<BR>
stress_data->SetNumberOfComponents(1);<BR>
stress_data->SetNumberOfTuples(requested_time_step);<BR>
<BR>
strain_data->SetName("Strain");<BR>
strain_data->SetNumberOfComponents(1);<BR>
strain_data->SetNumberOfTuples(requested_time_step);<BR>
<BR>
time_data->SetName("Time");<BR>
time_data->SetNumberOfComponents(1);<BR>
time_data->SetNumberOfTuples(requested_time_step);<BR>
<BR>
// Create dummy array for y and z values<BR>
vtkDoubleArray* empty = vtkDoubleArray::New();<BR>
<BR>
empty->SetNumberOfComponents(1);<BR>
empty->SetNumberOfTuples(1);<BR>
empty->SetTuple1(0, 0.0);<BR>
<BR>
output->SetYCoordinates(empty);<BR>
output->SetZCoordinates(empty);<BR>
<BR>
// Fill in the data arrays.<BR>
// Now start processing data and writing it to the vtkDoubleArrays.<BR>
double stress_temp, strain_temp;<BR>
<BR>
for ( int i = 0; i <= requested_time_step; i++ )<BR>
{<BR>
file >> stress_temp >> strain_temp;<BR>
<BR>
time_data->SetTuple1(i, i);<BR>
stress_data->SetTuple1(i, stress_temp);<BR>
strain_data->SetTuple1(i, strain_temp);<BR>
}<BR>
<BR>
points->AddArray(time_data);<BR>
points->AddArray(stress_data);<BR>
points->AddArray(strain_data);<BR>
<BR>
output->SetXCoordinates(stress_data);<BR>
<BR>
time_data->Delete();<BR>
stress_data->Delete();<BR>
strain_data->Delete();<BR>
empty->Delete();<BR>
------------------------ End code snippet---------------------------------<BR>
</FONT>
</P>
</BODY>
</HTML>