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.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Custom Color for Series (and legend)

Thread ID:

Created:

Updated:

Platform:

Replies:

117970 Jan 14,2015 07:07 PM UTC Jan 19,2015 06:58 AM UTC WPF 3
loading
Tags: SfChart
Dario Quispe
Asked On January 14, 2015 07:07 PM UTC

Hi,

By default, color order for each series is blue, brown, green, light green, etc.
I would like to specify the order of colors. For example : Red, Green, Blue, etc.
And obviously, the color of legend have to be in the same order.

I created the function UpdateSeriesDefaultColor in code behind dedicated to change what I want.
I changed the Interior property of the first series but it change all items color (see sample code).

Thanks,

Dario



Attachment: SeriesDefaultColors_74223da4.zip

Sheik Syed Abthaheer M [Syncfusion]
Replied On January 15, 2015 05:47 AM UTC

Hi Dario,

Thanks for using Syncfusion products.

You can achieve your requirement by applying the custom palette for chart series as shown in the below code snippet.

Code Snippet[C#]:

var series = new PieSeries

{

      ItemsSource = BuilModel(),

      XBindingPath = "Country",

      YBindingPath = "Count",

      Palette=ChartColorPalette.Custom,

      ColorModel=new ChartColorModel(){CustomBrushes=GetBrushes()}

};

Please refer the below UG documentation about the SfChart Palette.

Link: http://help.syncfusion.com/ug/wpf/documents/palettes.htm

We have modified the sample based on your requirement. Please find the sample in the below location.

Sample: SeriesPalette.zip

Regards,
M.Sheik



 



Dario Quispe
Replied On January 15, 2015 06:59 PM UTC

Thanks, it works.

Rachel A [Syncfusion]
Replied On January 19, 2015 06:58 AM UTC

Hi Dario,

Thanks for the update.

Please let us know if you require further assistance on this.

Thanks,

Rachel. A



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

;