本文介绍了我们如何将图表绑定到数据列表或中继器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
任何人都可以指导我如何将图表绑定到数据列表吗?
我想将以下内容绑定到数据列表
can any one one guide me that how we can bind chart to datalist
i want to bind following to datalist
private void LoadChartData()
{
string strcon = ConfigurationManager.ConnectionStrings["gallup"].ConnectionString;
//SqlConnection myConnection = new SqlConnection(strcon);
string mystr = "select city, sample from city_breakup";
SqlDataAdapter da = new SqlDataAdapter(mystr, strcon);
DataTable table = new DataTable();
da.Fill(table);
DataView dv = table.DefaultView;
Chart1.Series["Series1"].Points.DataBindXY(dv, "city", dv, "sample");
//Chart2.Series["Series1"].Points.DataBindXY(dv, "city", dv, "sample");
//Chart2.Series["Series1"].ChartType = SeriesChartType.Pie;
//Chart2.Series["Series1"]["PieLabelStyle"] = "outside";
//Chart2.Series[0]["PieStartAngle"] = "190";
//Chart2.Legends.Add("Legend1");
// DataList1.DataSource = dv;
//DataList1.DataBind();
}
推荐答案
这篇关于我们如何将图表绑定到数据列表或中继器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!