Using the following example as a starting point, I have been able to pass in my type float arrays into the class /vtkBarChartActor. Using mostly bits of code
from the example mentioned, I can render the plot as well. My new problem is that
there is nothing plotted, it is just a blank chart with an x and y axis.
The y axis is scaled to fit the data in my arrays. I have checked that by
changing the values stored in a single array and passing only that
array into the /vtkBarChartActor so I know it is connecting properly or at least that is is recognizing the range of data that is being passed through it...I just am not sure how to make it place a bar for each data
point like the example shown does. Here is some relevant code to what I
am doing:<br>
<br><br>//this is inside some for loops and is getting filled with data,
the iterators of the for loops are i and n and are used to tell the
array which cell to put the data in<br> vtkSmartPointer<vtkFloatArray> Angle =<br>
vtkSmartPointer<vtkFloatArray>::New(); <br> Angle->InsertValue( i + (5*n), acos( DotProduct /<br> ( EdgeLength->GetValue( i+(5*n ) <br> * Magnitude_2) ) ) );<br>
<br>//the for loops have now been closed and the array is full of angles ranging from 0.0 to about 3.0<br> vtkSmartPointer<vtkDataObject> DataObject = <br> vtkSmartPointer<vtkDataObject>::New();<br> DataObject->GetFieldData()->AddArray ( Angle );<br>
<br>
vtkSmartPointer<vtkBarChartActor> Chart =<br> vtkSmartPointer<vtkBarChartActor>::New();<br> Chart->SetInput( DataObject );<br> Chart->SetTitle( "Histogram" );<br> Chart->GetPositionCoordinate()->SetValue(0.1,0.1,0.0);<br>
Chart->GetPosition2Coordinate()->SetValue(0.9,0.8,0.0);<br> Chart->GetProperty()->SetColor(1,1,1);<br> Chart->GetLegendActor()->SetNumberOfEntries( DataObject->GetFieldData()-><br>
GetArray(0)->GetNumberOfTuples() );<br>
Chart->LegendVisibilityOn();<br> Chart->LabelVisibilityOn();<br> Chart->SetBarColor( 0,1.0,1.0,1.0 );<br> Chart->SetYTitle( "Angle" );<br><br> // Visualize the histogram(s)<br>
vtkSmartPointer<vtkRenderer> renderer = <br> vtkSmartPointer<vtkRenderer>::New();<br> renderer->AddActor( Chart );<br> <br> vtkSmartPointer<vtkRenderWindow> renderWindow = <br>
vtkSmartPointer<vtkRenderWindow>::New();<br>
renderWindow->AddRenderer( renderer );<br> renderWindow->SetSize(640, 480);<br> <br> vtkSmartPointer<vtkRenderWindowInteractor> interactor =<br> vtkSmartPointer<vtkRenderWindowInteractor>::New();<br>
interactor->SetRenderWindow( renderWindow );<br> <br> // Initialize the event loop and then start it<br> interactor->Initialize();<br> interactor->Start();<br><br><br><br>like
I mentioned, this does not throw any errors or problems, it just
creates a blank plot that has a x axis that is not labeled and a y axis
that is labeled "Angle" and the y axis is always scaled to fit my float array
Angle. Any ideas as to why it is not plotting the data stored in the
array? And thank you for your help and time.<br>
<br>Luke H