[vtkusers] vtkChartLegend SetOpacity not working

Eric E. Monson emonson at cs.duke.edu
Wed Jul 6 15:00:32 EDT 2011


Hey Joseph,

It looks like SetOpacity is inherited by vtkChartLegend from vtkContextItem, but not really used. 

It happens that you can change the background of the legend through GetBrush(), then set a color with a lower alpha, and change the outline through the GetPen() method, then change the opacity to a non-unity value.

Hopefully this accomplishes what you want,
-Eric

P.S. I don't know if it makes any difference, but just so you know, you can also turn on the legend using chart->SetShowLegend(true);

· · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · ·
Eric E Monson
Duke Visualization Technology Group


On Jul 6, 2011, at 2:29 PM, Joseph Melnyk wrote:

> I'm attempting to use vtkChartLegend's SetOpacity function and it doesn't appear to be working, neither in my code nor if I modify the test examples.  For example, modifying the code at http://www.vtk.org/Wiki/VTK/Examples/Cxx/Plotting/LinePlot to include the following lines has no effect:
> 
>  chart->GetLegend()->SetVisible(true);
>  chart->GetLegend()->SetOpacity(.5);
> 
> Am I missing something or is this broken?  I'm using a 5.6.1 version of VTK from the nightly (built in late January).
> 
> Thanks!
> 
> __Scanned by MessageLabs
> _______________________________________________
> Powered by www.kitware.com
> 
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
> 
> Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
> 
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers




More information about the vtkusers mailing list