我的图表看起来都被抬高了。一方面,沿 x 轴的标签太多。对于两个,它将 x 轴信息作为 DateTime 对象。在这种情况下,我希望显示一天中的时间。
那么我怎样才能减少标签并使标签的内容是时间而不是日期呢?
http://i1120.photobucket.com/albums/l493/powerfulcrunch/chart.png
private void drawMinuteGraph(string data)
{
Chart chart = new Chart();
Series series = new Series("default");
series.ChartType = SeriesChartType.Line;
chart.Series.Add(series);
ChartArea chartArea = new ChartArea();
chart.ChartAreas.Add(chartArea);
Axis x = new Axis(chartArea, AxisName.X);
x.LineWidth = 90;
Axis y = new Axis(chartArea, AxisName.Y);
Data[] _data = data.getHistory("History", data);
List<DateTime> dates = new List<DateTime>();
List<double> values = new List<double>();
foreach (Data __data in _data)
{
dates.Add(__data.timestamp);
values.Add(__data.value);
}
chart.Height = 150;
chart.Width = 150;
chart.Series["default"].Points.DataBindXY(dates, values);
flowLayoutPanel.Controls.Add(chart);
}