Gap between the first X datetime value and the Y a

2019-09-19 01:47发布

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:

enter image description here

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条回答
Anthone
2楼-- · 2019-09-19 02:30

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
查看更多
登录 后发表回答