Changing legend item colors

2 posts, 1 answers
  1. Sean
    Sean avatar
    2 posts
    Member since:
    Jun 2010

    Posted 08 Jun 2010 Link to this post

    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
  2. Answer
    Dwight
    Admin
    Dwight avatar
    475 posts

    Posted 14 Jun 2010 Link to this post

    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.
Back to Top