本人正在用2010的Chart控件在开发一个股票走势图由于刚开始了解,加上这方面的文章又很少,现在走势力以基本做好.但现在要做移动平均线,也就是5天平均线10天平均线这些.我有每天的收市价,但不知道在Chart里怎样做移动平均线.那们高手会的请多多指教.附上图片.
问题补充:
附上代码:
string Strsql = "select * from (select top 60 PRO_CODE,CONVERT(varchar(100),date, 111) as Date,[OPEN],HIGH,LOW,[CLOSE] from HLOC order by date desc) as Data order by Date asc";
SQLServerHelp cs = new SQLServerHelp();
DataSet ds = cs.sqlSelectDS(Strsql);
Chart1.DataSource = ds;
Chart1.Series["Series1"].XValueMember = "Date";
Chart1.Series["Series1"].YValueMembers = "HIGH,LOW,OPEN,CLOSE";
Chart1.Series["Series1"].ToolTip = "Date\t= #VALX\nHight\t= #VALY\nLow\t= #VALY2\nOpen\t= #VALY3\nClose\t= #VALY4";
Chart1.DataBind();
string strsql = "select min(LOW) as LOW,max(HIGH) as HIGH from(select top 60 CONVERT(varchar(100),date, 111) as Date,[OPEN],HIGH,LOW,[CLOSE] from HLOC order by date desc) AS Data";
SQLServerHelp CS = new SQLServerHelp();
DataSet DS = CS.sqlSelectDS(strsql);
string Mini = DS.Tables[0].Rows[0]["LOW"].ToString();
double Minimum = Convert.ToDouble(Mini);
string High = DS.Tables[0].Rows[0]["HIGH"].ToString();
double HIGH = Convert.ToDouble(High);
string PName = ds.Tables[0].Rows[0]["PRO_CODE"].ToString();
Chart1.ChartAreas["ChartArea1"].AxisX.Maximum = 61;
Chart1.ChartAreas["ChartArea1"].AxisY.Minimum = Minimum - 30;
Chart1.ChartAreas["ChartArea1"].AxisY.Maximum = HIGH + 30;
Chart1.Titles["Title1"].Text = PName;