如何在winforms和刷新图表中将数据绑定到图表?

时间:2013-01-15 21:41:21

标签: c# winforms charts controls

我尝试将图表绑定到generatedSequence类型的List<float>。如何在绑定后更新图表控件?

我试过这个但没有运气:

chart1.DataSource = new BindingList<float>(chartSequence);
chart1.DataBind();

chart1.Update();

1 个答案:

答案 0 :(得分:7)

不要忘记在图表属性中设置Series的DataSource属性。

enter image description here

从代码中设置XValueMemberYValueMembers

chart1.Series.First().XValueMember = "X";
chart1.Series.First().YValueMembers = "Y";

Tutorial: Creating a Basic Chart