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

Custom ChartPalette with more than 8 colors

1 Answer 92 Views
Chart
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Raga
Top achievements
Rank 1
Raga asked on 18 May 2016, 08:08 PM

Hi, 

To create custom ChartPalettes, you suggest in the doc that we clone an existing default ChartPalette and change the colors from there.

However, the existing default ChartPalettes only have 8 colors. I need to create a palette for my pie chart that has 20 colors. How can I accomplish this?

Thanks!

1 Answer, 1 is accepted

Sort by
0
Victor
Telerik team
answered on 19 May 2016, 08:54 AM
Hi Raga,

Thanks for the question.
Each palette contains multiple palette entry collections where each collection has a palette family. The family can be HorizontalAxis, VerticalAxis, Bar, Line etc. Each of these collections contains palette entries for the for the difference series or data points.
For example, the palette entry collection with a "Bar" family contains 8 palette entries which means 8 different bar series will have their own colors. To add more colors simply add more PaletteEntry objects to the collection.
For example:
ChartPalette palette = chart.getPalette().clone();
PaletteEntryCollection collection = palette.entriesForFamily(ChartPalette.BAR_FAMILY);
collection.add(new PaletteEntry(Color.GREEN, Color.RED));
// Add more entries here
chart.setPalette(palette);
Please write again if you need further assistance.

Regards,
Victor
Telerik
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 Feedback Portal and vote to affect the priority of the items
Tags
Chart
Asked by
Raga
Top achievements
Rank 1
Answers by
Victor
Telerik team
Share this question
or