Plotting Current Time on X-Axis Using the Visual Basic Now() FunctionPrimary Software: Measurement Studio>>.NET SupportPrimary Software Version: 7.0 Primary Software Fixed Version: N/A Secondary Software: N/A
Problem: I need to plot measurement data on the Y-axis vs. the measurement time on the X-axis of a ScatterGraph and would like to use Now() to get the time in VB.net. What is the proper procedure for doing so? Solution: The Double to DateTime conversion factor that the Measurement Studio graphs use states that 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 to and from double and DateTime and TimeSpan with this conversion factor. For example, you could do the following: Where MeasData is the data you want to plot. You will also want to make sure that your graph is set up to show the major divisions as a DataTime. You can do this programmatically with the following code: ScatterGraph1.XAxes(0).MajorDivisions.LabelFormat() = New NationalInstruments.UI.FormatString(FormatStringMode.DateTime, "h:mm:ss tt")Related Links: Measurement Studio Support Attachments:
Report Date: 12/12/2005 Last Updated: 12/13/2005 Document ID: 3SBHHJ9F |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
