I need to adjust the minimum and maximum values of the X axis of an ASP.NET chart. The axis represents DateTime values. These properties are doubles, and someone on another site suggested to use .ToOADate() to convert the dates:
DateChart.ChartAreas[0].AxisX.Maximum = minDate.ToOADate();
However doing this throws an ArgumentException (“Not a legal OleAut date.”). Is there another way that I can set these values?
Cheers
It turns out that the above code is correct. The exception was being thrown by a different chart on the page which wasn’t configured properly.