//filtering time and change the pie private void filterPie(String filter) { int counter = PieCollection.Count; for (int i = counter; i > 0; i--) { PieCollection.Remove(PieCollection[i - 1]); } string[] _time = filter.Split(' '); String time = _time[1]; // _pieCollection = new ObservableCollection<KeyValuePair<string, int>>(); BE.Component c = new BE.Component(); c = model.SumOfComponents(Id, DateTime.Now, time); //change data in pie according to time and Id PieCollection.Add(new KeyValuePair <string, float>("Energy", c.Iron)); PieCollection.Add(new KeyValuePair <string, float>("Sugar", c.Sugar)); PieCollection.Add(new KeyValuePair <string, float>("Fats", c.Fats)); PieCollection.Add(new KeyValuePair <string, float>("Carbohydrate", c.Carbohydrate)); PieCollection.Add(new KeyValuePair <string, float>("Vitamins", c.Cholesterol)); PieCollection.Add(new KeyValuePair <string, float>("Protien", c.Protien)); PieCollection.Add(new KeyValuePair <string, float>("Fiber", c.Fiber)); //PieCollection.Add(new KeyValuePair<string, float>("Water", c.Water)); }
public MainWindow() { InitializeComponent(); pieCollection1 = new PieCollection(); pieCollection1.Add(new PiePoint { Name = "Mango", Share = 10 }); pieCollection1.Add(new PiePoint { Name = "Banana", Share = 36 }); pieCollection1.Add(new PiePoint { Name = "Grapes", Share = 15 }); pieCollection1.Add(new PiePoint { Name = "Apple", Share = 20 }); Chart1.DataContext = pieCollection1; }