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

微软Chart的诺干问题
现在有个需求
假如我前台放了几个Series,那么我后台就能画几条线,
Chart1.Series[0].Points.AddXY(strXValue, strSvalue);
Chart1.Series[1].Points.AddXY(strXValue, strSvalue);


但是我现在想动态生成,通过对Series【i】循环 写入数据
不知道哪位牛人有用过这个控件

40分,在线等

------解决方案--------------------
先using System.Web.UI.DataVisualization.Charting;

Series s1 = new Series("s1");
int[] xVal1 = { 1, 2, 3 };
double[] yVal1 = { 3.00, 5.00, 2.12 };
Chart1.Series.Add(s1);
Chart1.Series["s1"].Points.DataBindXY(xVal1, yVal1);
Chart1.Series["s1"].ChartType = SeriesChartType.Line;

Series s2 = new Series("s2");
int[] xVal2 = { 10, 20, 30,40 };
double[] yVal2 = { 13.00, 7.00, 12.12,3.00 };
Chart1.Series.Add(s2);
Chart1.Series["s2"].Points.DataBindXY(xVal2, yVal2);
Chart1.Series["s2"].ChartType = SeriesChartType.Line;