我不确定我的问题标题是否有意义?但是基本上我要做的是显示图表中每一列的值。
这就是我想要做的:
所以我有2个变量first_AverageOnTime
和second_AverageOnTime
。理想情况下,我希望图表上的M
的标签为第一个,第二个为A
的标签。
所以我使用的代码是
LeChart.Series.Add("Average On Time");
LeChart.Series["Average On Time"].ChartType = SeriesChartType.Column;
LeChart.Series.Add("Average On %");
LeChart.Series["Average On %"].ChartType = SeriesChartType.Column;
LeChart.Series.Add("Average Off %");
LeChart.Series["Average Off %"].ChartType = SeriesChartType.Column;
LeChart.Series.Add("Peak Hour");
LeChart.Series["Peak Hour"].ChartType = SeriesChartType.Column;
LeChart.Series["Average On Time"].Points.AddXY("M", a_AverageLightONTime);
LeChart.Series["Average On Time"].Label = first_AverageLightONTime.ToString();
LeChart.Series["Average On %"].Points.AddXY("M", a_PercentLightOn);
LeChart.Series["Average Off %"].Points.AddXY("M", a_PercentLightOff);
LeChart.Series["Peak Hour"].Points.AddXY("M", a_PeakHour);
LeChart.Series["Average On Time"].Points.AddXY("A", b_AverageLightONTime);
LeChart.Series["Average On Time"].Label = second_AverageLightONTime.ToString();
LeChart.Series["Average On %"].Points.AddXY("A", b_PercentLightOn);
LeChart.Series["Average Off %"].Points.AddXY("A", b_PercentLightOff);
LeChart.Series["Peak Hour"].Points.AddXY("A", b_PeakHour);
a_AverageLightONTime
和b_AverageLightONTime
与first_AverageOnTime
和second_AverageOnTime
具有相同的值
有任何想法吗?另外,我正在使用标准的using System.Windows.Forms.DataVisualization.Charting;
。