日期:2014-05-18  浏览次数:21233 次

动态添加Chart控件,不能够显示图像
我在VS2008添入了Chart控件,然后在Winform窗体中使用拖拉添加没有问题,可以绑定数据正常显示,但是动态添加Chart控件却不能够显示图像;
下面是我动态添加的代码:
Chart chartcol = new Chart();
  Series ries = new Series();
  chartcol.Series.Add(ries);
  this.tabPage1.Controls.Add(chartcol);
  chartcol.Series[0].ChartType = SeriesChartType.Line;
  chartcol.DataSource = datatable;
  chartcol.Series[0].XValueMember = "时间";
  chartcol.Series[0].YValueMembers = "温度";
  chartcol.DataBind();

------解决方案--------------------

在检查一下,应该是少设置了某一些属性,好像没有添加ChartArea