日期:2014-05-19  浏览次数:20468 次

急!!!ComponentOne的WebChart
今天业务需要用WebChart,哪位高手指点下这个控件怎么绑定datatable的数据
谢谢了   先

------解决方案--------------------
up
------解决方案--------------------
例如,从DataTable绑定数据到图表

private void Page_Load(object sender, EventArgs e)
{
// get dataset (from db or cache)
DataSet ds = GetDataSet();

// filter the data
DataView dv = new DataView(ds.Tables[ "Sales "]);
dv.RowFilter = "ProductSales > = 40000 ";
dv.Sort = "ProductSales ";

// create an array of data points
PointF[] data = new PointF[dv.Count]
for (int i = 0; i < data.Length; i++)
{
float y = float.Parse(dv[i][ "ProductSales "].ToString());
data[i] = new PointF(i, y);
}
// populate chart data points
ChartDataSeries series = _c1webChart.ChartGroups[0].ChartData.SeriesList[0];
series.PointData.CopyDataIn(data);
}