public void ShowChart() { List <Tuple <DateTime, float> > tuples; tuples = DataBaseSolution.GetWeightList(user1.UserId); if (tuples.Count() > 0) { valueList = new List <KeyValuePair <string, double> >(); foreach (Tuple <DateTime, float> item in tuples) { var date = (item.Item1).ToString("MM/dd/yyyy"); var weight = Math.Round(float.Parse(item.Item2.ToString()), 2); valueList.Add(new KeyValuePair <string, double>(date, weight)); } lineChart.DataContext = valueList; } }