[vtkusers] vtkXYPlotActor

Simon Bulman S.D.Bulman at swansea.ac.uk
Thu May 24 07:30:33 EDT 2001


Hi all,

I am still having problems with the vtkXYPlotActor class. I hope somebody can help
me with this.

I create the vtkXYPlotActor, then the user has the ability to add data to the actor
interactively. 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->NumberOfEntries
does 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 help
Simon

--------------------------------------------------------------------------------------------------------------------

    // 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
================================

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


More information about the vtkusers mailing list