同一系列的不同标签

时间:2018-07-10 11:14:49

标签: c# charts

我不确定我的问题标题是否有意义?但是基本上我要做的是显示图表中每一列的值。

这就是我想要做的:

enter image description here

所以我有2个变量first_AverageOnTimesecond_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_AverageLightONTimeb_AverageLightONTimefirst_AverageOnTimesecond_AverageOnTime具有相同的值 有任何想法吗?另外,我正在使用标准的using System.Windows.Forms.DataVisualization.Charting;

0 个答案:

没有答案