how to change to color of PieChart Legends

2 posts, 0 answers
  1. Madhan
    Madhan avatar
    19 posts
    Member since:
    Aug 2012

    Posted 16 Jul 2013 Link to this post

    Hi Team,

    I developed a piechart using RadChart control and my PieChart having 14 items by default it specify colors for Legends and in this case 2 or 3 Legends have same colors.

    I would like to specify 14 deffirent colors in code behind file?how can I achieve this?

    I am using following code.

    rcBilledRevenueProductPieChart.ItemsSource = null;

    rcBilledRevenueProductPieChart.DefaultView.ChartArea.DataSeries.Clear();

    rcBilledRevenueProductPieChart.PaletteBrushes.Clear();

    rcBilledRevenueProductPieChart.SeriesMappings.Clear();

    DataSeries series = new DataSeries();

    series.Definition = new PieSeriesDefinition();

    foreach (ContributeMargin obj in e.Result.ToList())

    {

    series.Add(new DataPoint(obj.ContributionMarginBudget) { LegendLabel = obj.ProductName });

    }

    rcBilledRevenueProductPieChart.DefaultView.ChartArea.DataSeries.Add(series);

  2. Petar Kirov
    Admin
    Petar Kirov avatar
    425 posts

    Posted 18 Jul 2013 Link to this post

    Hi Madhan,

    You can use the RadChart.PaletteBrushes (or ChartArea.PaletteBrushes if you have multiple ChartAreas) collection to specify the colors that you want to use for the pie slices and legend items. I have attached a sample project to demonstrate.
     
    Regards,
    Petar Kirov
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
  3. DevCraft banner
Back to Top