Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
65
Colours pieChart
posted

Is it possible to have two Pie Charts with different styles? I want to have the second one with different colours. What's the solution to this?

  • 1775
    Verified Answer
    posted

    Hi, dreesarjan

    It is possible to have two Pie Charts with different slice colors. This can be achieved by explicitly setting palette of brushes to the control on initialization. This palette will be used to draw the slices instead of the colors defined in the CSS files. To achieve this you need something like the following: 

    1. $('#chart').igPieChart({
    2.     ...
    3.     brushes: ["#CCFF00", "#B300FF", "#00CCFF", "#00FFB3", "#CCFF00", "#FFB300", "#FF004D"],
    4.     ...
    5. });

    You only need to select and specify colors appropriate for your case.

    This can't be done with styles since the two charts are on the same page.

    Cheers, Lazar