更新并刷新wpf图表

我正在使用wpf工具包的图表,我无法查看图表的插入数据……这是xaml部分:

   

而cs:宣言

 public partial class MainWindow : Window { ... List<KeyValuePair> valueList = new List<KeyValuePair>(); ... 

当用户选择两个dateTime并按下按钮时调用的模块

 private void refresh_charts(DateTime dtStart, DateTime dtEnd) { valueList.Clear(); using (ModelFoosContainer mc1 = new ModelFoosContainer()) { var res_mea = (from mea in mc1.MeasureSet where (mea.datetime>= dtStart && mea.datetime <= dtEnd) orderby mea.datetime descending select mea).Take(1000); foreach (Measure mea1 in res_mea){ valueList.Add(new KeyValuePair(mea1.datetime, Convert.ToDouble(mea1.depth))); } } profilo_cale_chart.DataContext = valueList; //I've tried with this two but doesn't work.. //profilo_cale_chart.Refresh(); //this.UpdateLayout(); } 

在此之后,图表具有正确而非空的DataContext但不显示值…任何人都知道如何修复它?

尝试为图表系列设置名称:

  

然后,为AreaSeries设置DataContext:

 Example.DataContext = valueList; 

尝试更改xaml中图表的“可见性”

 Visibility="Hidden" 

 Visibility="Visible"