This is a migrated thread and some comments may be shown as answers.

Changing legend item colors

1 Answer 81 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Sean
Top achievements
Rank 1
Sean asked on 08 Jun 2010, 04:21 PM
I currently have a line chart with multiple series by using SeriesMappings in the code-behind. I have bound a method to ItemToolTipOpening so that I can change the opacity of all other lines except the one displaying the tooltip. The opacity changes correctly, but the opacity of the legend items stay the same. What is the best way to change the item colors?

When I check RadChart1.DefaultView.ChartLegend.Items or RadChart1.DefaultView.ChartArea.Legend.Items, nothing exists for either (both have 0 items). What is the relation between SeriesMappings and ChartLegend's Items? 

Here is the method that changes the colors/opacity:
private void onSeries(ItemToolTip2D tooltip, ItemToolTipEventArgs e) 
    foreach (DataSeries series in radChart1.DefaultView.ChartArea.DataSeries) 
    { 
        if (!series.Equals(e.DataSeries)) 
        { 
            Color color = ((SolidColorBrush)series.Definition.Appearance.Fill).Color; 
            color.A = 10; 
            series.Definition.Appearance.Stroke = 
            series.Definition.Appearance.Fill = new SolidColorBrush(color); 
        } 
    } 

Thank you,
Sean

1 Answer, 1 is accepted

Sort by
0
Accepted
Dwight
Telerik team
answered on 14 Jun 2010, 09:09 AM
Hi Sean,

Currently it will be hard to change the opacity of the legend items as there is no way to easily obtain reference to the visuals. In the Beta version we added some interaction functionality, wich will be additionally extended for the Q2 2010 release. Please, review the following example.

Kind regards,
Joshua
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
Chart
Asked by
Sean
Top achievements
Rank 1
Answers by
Dwight
Telerik team
Share this question
or