[vtkusers] vtkXYPlotActor

Jeff Lee jeff at cdnorthamerica.com
Thu May 24 07:53:58 EDT 2001


Simon,
Have you had a look at common/examplesTCL/xyplot.tcl, xyplot2.tcl?  Did
you try not deleting the dataset after you add it to the graph?
-Jeff

Simon Bulman wrote:

> Hi all, I am still having problems with the vtkXYPlotActor class. I
> hope somebody can helpme with this. I create the vtkXYPlotActor, then
> the user has the ability to add data to the actorinteractively. This
> works very well apart from the coloring/labels etc of the lines. Below
> is a snippet of my code. Now when I create the first line of my graph
> the color, name etc are all correct.However, when I add a second set,
> the colour etc of the second line are the defaults.As I pointed out in
> my previous post this is because the
> vtkLegendBoxActor->NumberOfEntriesdoes not seem to be updated. This is
> really important to me now. Does anybody have an idea what is wrong.Is
> the order of adding + setting data important etc???  Thanks for any
> helpSimon
> --------------------------------------------------------------------------------------------------------------------
> // Add the data set to the graph actor.
> _pcGraphActor->AddInput(data_set);
>     data_set->Delete();     // Set the label for curve.     int icurve
> = _pcGraphActor->GetInputList()->GetNumberOfItems();
>     char label[80];     if (node_or_element == 0)
> sprintf(label,"%s%i","Node ",entity_id);
>     else
>       sprintf(label,"%s%i","Element ",entity_id);
> _pcGraphActor->SetPlotLabel(icurve-1,label);     // Map the curve to a
> color, for this we use the color table.     float* rgb =
> _pcColorTable->GetColor(static_cast<float>(icurve-1));
>     _pcGraphActor->SetPlotColor(icurve-1,rgb[0],rgb[1],rgb[2]);     //
> Create the markers for the data points.     vtkSphereSource* marker =
> vtkSphereSource::New();
> _pcGraphActor->SetPlotSymbol(icurve-1,marker->GetOutput());
>     marker->Delete();     // Redraw the
> graph--------------------------------------------------------------------------------------------------------------------
> ================================
> S.D.Bulman.
> Senior Research Officer.
> University of Wales Swansea. S.D.Bulman at swansea.ac.uk (W) +44 (0)1792
> 513179
> (H)  +44 (0)1792 511144
> ================================

--
J.A. Lee


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20010524/ac478edd/attachment.htm>


More information about the vtkusers mailing list