[vtkusers] Set the Color of each line in vtkChartParallelCoordinates

Marcus D. Hanwell marcus.hanwell at kitware.com
Tue Nov 22 11:25:20 EST 2011


On Tue, Nov 22, 2011 at 7:21 AM, Jon Payne <jpayne at hgl-dynamics.com> wrote:
> On 21/11/2011 19:35, Matthias Eggert wrote:
>>
>> Hi,
>>
>> I tried your solutions, but I think I still don't get it. When I try:
>>   vtkSmartPointer<vtkLookupTable>  lookupTable =
>> vtkSmartPointer<vtkLookupTable>::New();
>>   lookupTable->SetTableRange(0.0, 10.0);
>>   lookupTable->Build();
>>
>>   vtkPlotPoints* tmp = vtkPlotPoints::SafeDownCast(chart);
>>   tmp->SetLookupTable(lookupTable);
>>   tmp->SelectColorArray("Category_ids");
>>
>> I just get a Run-Time exception. You don't have any c++ example do you?
>>
>> Furthermore, a little different from the original topic, how do I access
>> the
>> lines, that have been selected? I just don't get it. Sorry for my
>> stupidity^^
>>
>> Kind regards,
>> Matthias
>>
>>
> Hi Matthias,
>
> You cannot downcast a chart to a plotplots; they are two different types.
>
> You need to add the points to the chart, and then cast the PlotPlot e.g.
>
>  vtkPlotPoints *tmp = vtkPlotPoints::SafeDownCast(
> chart->AddPlot(vtkChart::POINTS) );
>
As Jon pointed out, you cannot cast between them. There is a Python
example, but I don't think I wrote a C++ test.

if (tmp)
  {
  tmp->DoSomething();
  }

For the parallel coordinates you need vtkPlotParallelCoordinates, not
vtkPlotPoints. I have a new mechanism in the works to reduce the need
to downcast, but can't make any promises on the timeline.

Thanks,

Marcus



More information about the vtkusers mailing list