Custom ChartPalette with more than 8 colors

Thread is closed for posting
2 posts, 0 answers
  1. Raga
    Raga avatar
    4 posts
    Member since:
    Jan 2016

    Posted 18 May 2016 Link to this post


    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?


  2. Victor
    Victor avatar
    1358 posts

    Posted 19 May 2016 Link to this post

    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
    Please write again if you need further assistance.

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