How to set Color of Doughnut chart ?

Hi Everyone,

I have some problems setting the color of the doughnut chart. Can anyone share how to color this chart according to the legend text?




1 Reply

NP Nishanthi Panner Selvam Syncfusion Team May 17, 2023 10:38 AM UTC

Hi Agung,


We can set color of doughnut based on legend text using palletes or pointRender event.


We have created an angular application for the same for your reference.


Using Pallete:


<e-accumulation-series-collection>

     <e-accumulation-series name='Project'

             [palettes] = "['Green', 'yellow', 'Red']">

     </e-accumulation-series>

</e-accumulation-series-collection>


Sample : https://stackblitz.com/edit/angular-dqa6ty-mgddf5?file=src%2Fapp.component.ts,src%2Fapp.component.html


Using pointRender event:


public pointRender (args): void {

      let seriesColor = ['Green', "yellow", "Red"];

      args.fill = seriesColor[args.point.index % 10];

    }



Sample: https://stackblitz.com/edit/angular-dqa6ty?file=src%2Fapp.component.ts,src%2Fapp.component.html


Kindly, revert us if you have any concerns.


Regards,

Nishanthi


Loader.
Up arrow icon