I have a pie chart on a WPF user control whose data changes periodically, however I am not instantiating a new chart control each time, just clearing the data in the ItemsSource and then inserting new values.
Each time the values get refreshed, the colour palate continues rolling through its colour selections.
The chart colour selection always starts off with the same colour selections (first is red, then blue etc), I would like to be able to tell the chart to restart its colour selection from scratch each time I reset the data source, instead of getting different colours everytime I clear the and reset the data items.
I tried creating a new instance of the ObservableCollection each time but that did not make any difference.
I’ve got the same problem, and I found another solution. Maybe it’s not the better one, but it works.
I added an int property to my object binding on the PieSeries, who represent the element’s index in the ObservableCollection.
Then I created a ResourceDictionaryCollection which contains all the default colors of the Palette:
I added a converter that returns the color at the specified index of ResourceDictionaryCollection.
And i used all this elements in the Xaml like this:
I hope that answer can help you.