Amr*_*mal 2 c# bar-chart winforms visual-studio-2015
当我尝试结果时,我需要在图表中显示点值
但我想要它像
我的代码是
SqlCommand territorycommand = new SqlCommand("select Terriotry,TotalAcheivmentVol,Forecast from ForecastTotal where Year = '" + DateTime.Now.Year.ToString() + "' and Terriotry = '" + territory + "' and month = '"+Month+"'", conn);
try
{
conn.Open();
mydatareader = territorycommand.ExecuteReader();
while (mydatareader.Read())
{
chart1.Series["TotalAchievment"].Points.AddXY(mydatareader.GetString(0), mydatareader.GetInt32(1));
chart1.Series["Forecast"].Points.AddY(mydatareader.GetInt32(2));
chart1.ChartAreas[0].AxisX.LabelStyle.Interval = 1;
chart1.ChartAreas[0].AxisX.Interval = 1;
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
conn.Close();
Run Code Online (Sandbox Code Playgroud)
这可能吗 ?
小智 6
您可以将标签中的系列值显示为:
chart1.Series["TotalAchievment"].IsValueShownAsLabel = true
chart1.Series["Forecast"].IsValueShownAsLabel = true
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
8848 次 |
| 最近记录: |