2
我的圖表看起來都挺起勁。首先,x軸上的標籤太多了。對於兩個,它將x軸信息作爲DateTime對象。在這種情況下,我想顯示一天的時間。如何在.net圖表中設置軸屬性?
那麼我該如何讓這些標籤少一些,並讓標籤的內容成爲一個時間而不是日期呢?
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);
}
你是正確的,先生。備份在這裏。 http://stackoverflow.com/questions/5605852/microsoft-chart-controls-and-x-axis-time-scale-format最終得到它與chart.ChartAreas [0] .AxisX.LabelStyle.Format =「HH:毫米「; – user1472219 2012-07-09 04:39:00