I have a chart control with a data in it. The x-axis data is of DateTime and the Y-axis is an integer. I'm trying to pull the data out of the graph and export it to excel, but the DateTime values aren't coming out in a way I can understand them or figure out how to decode them.
Example values are as such:
The graph begins at 4/30/2012 and goes to 8/13/2012.
The values show:
{X=41030, Y=16991}
{X=41031, Y=34363}
{X=41032, Y=26744}
{X=41033, Y=28180}
{X=41034, Y=17478}
...intermediate values
{X=41134, Y=1785}
I set the chart x-axis type to date time with
RestartBooksAttempts.Series["Attempts"].XValueType = ChartValueType.DateTime;
RestartBooksAttempts.Series["Books"].XValueType = ChartValueType.DateTime;
and I'm grabbing the values with:
Convert.ToDateTime(chart.Series[s.Name].Points[i].XValue)
double y = chart.Series[s.Name].Points[i].YValues[0];
obviously the x-points are not a DateTime convertable value, does anyone have any idea how to decode these values?
Ok, I found it out.
You have to use DateTime.FromOADate(double) to convert it back.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With