The Measurement Studio .NET graphs do not use OLE Automation (the OA in From/ToOADate) dates for the conversion factor between DateTime and double. OA date was natural for the ActiveX controls in Measurement Studio 6.0 since they are COM components, but there is not a precedent in .NET for what the double representation of a DateTime should be other than From/ToOADate, which are really convenience methods for interop with COM interfaces.
The DateTime/double conversion factor that the Measurement Studio graphs use is a double value of 0.0 is equivalent to DateTime.MinValue and a double interval of 1.0 is equivalent to 1 second. The NationalInstruments.DataConverter class will convert from/to double and DateTime and TimeSpan with this conversion factor. F
or example, to convert a DateTime to a double as in your example above, you could do this:
DateTime rtime = Convert.ToDateTime(dRow["result_time"]);
xData[i] = (double)DataConverter.Convert(rtTime, typeof(double));
DataConverter will also convert arrays of DateTime to double, like this:
DataTime[] rtimes;
// Initialize rtimes with an array of DateTime values.
xData = (double[])DataConverter.Convert(rtimes, typeof(double[]));
I will file a suggestion to improve the documentation regarding this conversion and its use with the graph in a future release.
Also, you may want to look at using the WaveformGraph instead of the ScatterGraph. The WaveformGraph and WaveformPlot plot methods have overloads for specifying DateTime and TimeSpan values for the start and increment.
Hope this helps.
- Elton