Gap between the first X datetime value and the Y axis

最后都变了- 提交于 2019-12-12 05:39:32

问题


In my application, I use mschart to display data using a x axis with datetime value and an Y axis with numeric (double) values.

However, I have noticed that there is a small gap between the Y axis and the first X value:

Is there a way to force the graph to start exactly on the Y axis?

EDIT: Here is what I use to populate my series:

foreach (AggregatedValue value in line.Value)
{
    series.Points.AddXY(value.TimeStamp.ToLocalTime(), value.Value);
}

Aggregated value is a class containing the 2 x, y properties, TimeStamp (datetime) and Value (double)


回答1:


I found the answer, I had to set manually the Minimum and Maximum value for my x-axis, using

chart.ChartAreas[0].AxisX.Minimum and chart.ChartAreas[0].AxisX.Maximum


来源:https://stackoverflow.com/questions/14841761/gap-between-the-first-x-datetime-value-and-the-y-axis

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!