535
Xam PIE Chart changes colors everytime.
posted

Hi, I am using the XamPieChart to present a set of data values. I have the following code..

public MainWindow(){

InitializeComponent();

xamPieChart1 .Brushes.Clear();

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>();

values.Add("Red", 50);

values.Add("Green", 100);

values.Add("Gray", 150);

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?

Regards, Shrishail