How to bind data to chart in winforms and refresh chart?

孤人 提交于 2019-12-19 06:30:32

问题


I tried to bind chart to generatedSequence of type List<float>. How to update chart control after binding?

I tried this but with no luck:

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

chart1.Update();

回答1:


Don't forget set DataSource property of Series in chart property.

Set XValueMember and YValueMembers from code:

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

Tutorial: Creating a Basic Chart



来源:https://stackoverflow.com/questions/14347454/how-to-bind-data-to-chart-in-winforms-and-refresh-chart

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!