Hi, I am using the XamPieChart to present a set of data values. I have the following code..
xamPieChart1 .Brushes.Add(new SolidColorBrush(Colors.Red));
xamPieChart1 .Brushes.Add(new SolidColorBrush(Colors.Green));
xamPieChart1 .Brushes.Add(new SolidColorBrush(Colors.LightGray));
private void button1_Click(object sender, RoutedEventArgs e)
Dictionary<string, int> values = new Dictionary<string, int>();
xamPieChart1.itemsource = values;
Also, I have both the values and labels binded to the PIE chart. However, everytime i click on a button, i see the the colors are changing their positions i.e., in place of Red i get Green etc.. How do i solve this?
I think this is because of the values in the dictionary being 0. Is it true that if a first value in the dictionary is 0, the second value gets the 1st color in the PIE? Correct me in case i am wrong here...
Thank you for your post. I have been looking into it and I can say that you are right that if the first non-zero value in the DataSource object gets the first color from the Brushes collection of the XamPieChart.