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

Inserting into ChartSeriesCollection doesn't update color

Thread ID:





127940 Dec 20,2016 02:10 PM UTC Dec 22,2016 12:05 PM UTC WPF 3
Tags: SfChart
Matt Jones
Asked On December 20, 2016 02:10 PM UTC

I'm updating a SfChart that has its Series bound to a ChartSeriesCollection, this works fine when I Add() to the collection, but when I choose to Insert() then the colors of the series are not updated correctly.  For example, if I insert a number of new series at index 0 then they all appear in the first color of the palette.

The reason I'm using Insert is that the series data are calculated in multiple threads and can complete in different orders, so I use Insert to ensure they appear in the correct order.  The Add() or Insert() is done inside a Dispatcher.Invoke() and uses locks to ensure this is not a race condition bug.

Is there anything I can do without resetting the entire collection to get this to update correctly?
Many thanks.

Devi Aruna Maharasi Murugan [Syncfusion]
Replied On December 21, 2016 10:54 AM UTC

Hi Matt, 
Thanks for contacting Syncfusion support. 
We have analyzed the reported query. We have achieved your requirement by using GetBrush() of ChartColorModel. We have prepared a demo sample based on your requirement and it can be downloaded from below location, 
Sample: ChartColor 

Matt Jones
Replied On December 21, 2016 11:24 AM UTC

That's great, that solved my problem!
I ended up updating the Interior property for all series in the collection, every time I insert a new series.  This then retained the same colour for each series, regardless of the order they are added/inserted.
Many thanks

Devi Aruna Maharasi Murugan [Syncfusion]
Replied On December 22, 2016 12:05 PM UTC

Hi Matt, 
Thanks for your update. 
Please let us know, if you need any further assistance on this. 


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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

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