Custom Color for Series (and legend)

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

3 Replies

SS Sheik Syed Abthaheer M Syncfusion Team 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



 




DQ Dario Quispe January 15, 2015 06:59 PM UTC

Thanks, it works.


RA Rachel A Syncfusion Team 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



Loader.
Up arrow icon