[vtkusers] Chart with individually colored segments

Raine Yeh raine.yeh at gmail.com
Wed Apr 10 22:14:43 EDT 2013


Dear VTK users,

I'm trying to draw a line chart with different colored line segments, but
have been unsuccessful so far. I can get the points to display in different
color (code below), is there a way to color the line segments individually
as well? I'm using vtkChartXY and vtkPlot at the moment.

vtkSmartPointer<vtkChartXY> chart = vtkSmartPointer<vtkChartXY>::New();
vtkPlot *points = chart->AddPlot(vtkChart::LINE);
vtkPlotLine::SafeDownCast(points)->SetInput(table,0,1); //table is some
vtkTable with point data
vtkPlotLine::SafeDownCast(points)->SetScalarVisibility(1);
vtkPlotLine::SafeDownCast(points)->SelectColorArray(1);
vtkPlotLine::SafeDownCast(points)->SetLookupTable(lut);

Thanks
-Raine
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20130410/69fc2fa5/attachment.htm>


More information about the vtkusers mailing list