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

Pie chart default colours so similar!

3 Answers 150 Views
Chart (Obsolete)
This is a migrated thread and some comments may be shown as answers.
Bex
Top achievements
Rank 1
Bex asked on 22 May 2012, 03:39 PM
I have just started using this pie chart and I have 4 series and all the slices are appearing correctly but 2 are shades of blue and 2 are shades of green. My chart has a legend but the greens and blues are so similar it's difficult to tell which is which!
I have checked out the samples and it's the same there.
Surely there is some mistake? Is there some setting to make it change the default colours, rather than having to manually set the colour of each series?

My chart is as follows:
<telerik:radchart id="RadChart1" runat="server" defaulttype="Pie" skin="Vista" charttitle-textblock-text="" OnItemDataBound="RadChart1_ItemDataBound">
<Series
 <telerik:ChartSeries Appearance-LegendDisplayMode="ItemLabels" Type="Pie" DataYColumn="Meters" />
 </Series>
</telerik:radchart>

and I am binding like this:

RadChart1.DataSource =myDS;
RadChart1.DataBind();

Bex

3 Answers, 1 is accepted

Sort by
0
Richard
Top achievements
Rank 1
answered on 24 May 2012, 08:10 PM
nevermind
0
Accepted
Richard
Top achievements
Rank 1
answered on 24 May 2012, 08:35 PM
Bex,

The default palette of the RadChart is defined as part of the skin that you assign to the RadChart.

Probably the best approach for providing a more varied palette is by creating a Custom Palette, either declaratively, as demonstrated in this forum thread: Pie Chart Items , or alternatively, by defining this Custom Palette and assigning it using code behind:

private void SetSeriesColors()
{
    Color[] seriesColors = new[]
                               {
                                   Color.Red,
                                   Color.Yellow,
                                   Color.Black,
                                   Color.Blue,
                                   Color.White,
                                   Color.Green,
                                   Color.MediumPurple,
                                   Color.Brown,
                                   Color.Orange,
                                   Color.Gray
                               };
 
    Palette seriesPalette = new Palette("seriesPalette", seriesColors, true);
    RadChart1.CustomPalettes.Add(seriesPalette);
    RadChart1.SeriesPalette = "seriesPalette";
}

But, in order to have the Custom Palette colors override the default ones, you will need to set RadChart.SkinsOverrideStyles = false;

Hope this helps!
0
Bex
Top achievements
Rank 1
answered on 25 May 2012, 08:38 AM
Jumpstart
Thank you! That works fantastically!
Tags
Chart (Obsolete)
Asked by
Bex
Top achievements
Rank 1
Answers by
Richard
Top achievements
Rank 1
Richard
Top achievements
Rank 1
Bex
Top achievements
Rank 1
Share this question
or