string sconstr = "server=.\\sqlexpress;database=account;Trusted_Connection=true;"; SqlConnection sconn = new SqlConnection(sconstr); DataTable dbdt = new DataTable(); SqlDataAdapter da = new SqlDataAdapter("select * from report where year='2010'",sconn); da.Fill(dbdt); dataGridView1.DataSource = dbdt; chart1.DataSource = dbdt; chart1.Series[0].YValueMembers = "traffic_am"; chart1.Series[0].Name = "traffic_am"; chart1.Series[1].YValueMembers = "traffic_pm"; chart1.Series[1].Name = "traffic_pm"; chart1.Series[0].XValueMember = "month"; chart1.DataBind();
怎么另外那条线就变成一条竖线了
要怎么设置呢
是不是再加一句就行了:
chart1.Series[1].XValueMember = "month";
嗯 就是这样的
建议检查一下数据库查询返回的数据
应该不是数据问题,我把2条线数据换下,还是第一条可以出来,第二条还是一条竖线