We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Pie Chart Series palette.

Thread ID:

Created:

Updated:

Platform:

Replies:

130080 Apr 20,2017 06:53 AM UTC Apr 21,2017 09:12 AM UTC Angular 1
loading
Tags: ejChart
Alexandru Boboc
Asked On April 20, 2017 06:53 AM UTC

Hi,

I'm trying to get a double pie chart working, as in your example here. It works, but I need to provide custom color palettes to each series.

I saw this sample, where I can provide a custom color palette on the <ej-chart> tag, but that applies to both my series. I need to have different color palettes for the two series.

So is there a similar way to pass palette color arrays to series?

Thanks,

Alex


Dharanidharan Dharmasivam [Syncfusion]
Replied On April 21, 2017 09:12 AM UTC

Hi Alexandru, 

Thanks for contacting Syncfusion support. 

We have analyzed your query. We would like to let you know the behavior of palette property. For multiple pie series, if colors are specified in palette property, then it will be applied to each point in a series. To achieve your requirement, we would suggest you to initialize an array with desired colors and then specify the colors in the seriesRendering event to the fill property in points as highlighted in below code snippet. 

Angular 2:  

<ej-chart (seriesRendering)="seriesRender($event)"> </ej-chart> 
 
TS: 
seriesRender(sender) { 
        let chart = $("#multipie").data("ejChart"); 
 
   //Getting Series index 
        let seriesIndex = $.inArray(sender.data.series, chart.model._visibleSeries); 
        let points = sender.data.series.points; 
        let palette = ['#4286f4', '#00cc00', '#666633']; 
 
        for (let i = 0; i < points.length; i++) { 
            //Based on series index specify the colors 
            sender.data.series.points[i].fill = palette[seriesIndex]; 
        } 
 
    } 

Screenshot: 
 

Sample for reference can be find from below link. 
 
Thanks, 
Dharani. 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;