我希望该值准确显示在从我的ms sql服务器数据库中标记出来的月份。
在图片中看着你。
cn.Open();
cmd = new SqlCommand("Select * from rpt_KUNDE_Usatz_Gesamt Where Jahre='" + button.Text + "'", cn);
dr = cmd.ExecuteReader();
while (dr.Read()) {
Values2019.Add(Convert.ToDouble(dr["SumOfMonat"]));
MonthValue.Add(Convert.ToDouble(dr["Monat"]));
}
SeriesCollection s2019 = new SeriesCollection {
new LineSeries {
Title = DateTime.Now.AddYears(0).Year.ToString(),
Values = new ChartValues<double>(Values2019),
StrokeThickness = 2,
Stroke = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Color.FromRgb( 243, 67, 54)),
Fill = System.Windows.Media.Brushes.Transparent,
LineSmoothness = 0,
PointGeometrySize = 13,
PointForeground = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Color.FromRgb(34, 46, 49)),
StrokeDashArray = new System.Windows.Media.DoubleCollection(20),
DataLabels = true,
Foreground = Brushes.White
}
};
Labels = new[] { Month() };
Formatter = MonthValue => MonthValue.ToString("N");
cartesianChart1.Series = s2019;
cn.Close();
private string Month() {
DateTime now = DateTime.Now;
string month = DateTime.Now.ToString("MMMM");
return month;
}
问题出在哪里?