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

how to change to color of PieChart Legends

1 Answer 96 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Madhan
Top achievements
Rank 1
Madhan asked on 16 Jul 2013, 05:44 PM
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);

1 Answer, 1 is accepted

Sort by
0
Petar Kirov
Telerik team
answered on 18 Jul 2013, 06:42 PM
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 >>
Tags
Chart
Asked by
Madhan
Top achievements
Rank 1
Answers by
Petar Kirov
Telerik team
Share this question
or