0
点赞
收藏
分享

微信扫一扫

DevExpress 图表控件:ChartControl 动态绑定数据


private void BindData(ViewType vt)
{
chartControl1.Series.Clear();
//Series series1 = new Series("日志统计", ViewType.RadarArea);
Series series1 = new Series("日志统计", vt);

chartControl1.Series.Add(series1);
string sSQL = string.Format("select code,baseprice from tRoomType");
DataTable tableMain = SqlLiteHelper.GetDataTable(out sError, sSQL);
tableMain.TableName = "主表";

SeriesPoint point = null;
foreach (DataRow row in tableMain.Rows)
{
if (row["code"] != null)
{
point = new SeriesPoint(row["code"].ToString());
double[] vals = { Convert.ToDouble(row["baseprice"]) };
point.Values = vals;
series1.Points.Add(point);
}
}
}

效果如下:

DevExpress 图表控件:ChartControl 动态绑定数据_taro


 

举报

相关推荐

0 条评论