Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

How to use Scatter Graph to plot readings vs time

I want to use the Scatter Graph to plot meter readings vs time. The time is the recent time obtained from the real time clock of the PC. I have set the XAxes[0].MajorDivisions.LabelFormat to Time in the property page but cannot show the actual time in x-axes (always shows 12:00 somewhat). Can any one advise me how to do it? Thanks.

 

YC

0 Kudos
Message 1 of 3
(3,972 Views)

Hey YC - 

 

When you call PlotXY(Append), the xData parameter determines the time that shows up on the X-Axis.  If you begin at 0, you will begin at time 0 of the DateTime class - 12:00:00 midnight, January 1, 0001.  Perhaps the easiest way to get the current date and time is to use the NationalInstruments.DataConverter class to get the current date time.  It could look something like this:

 

scatterGraph1.PlotXYAppend(DataConverter.Convert<double>(DateTime.Now), data);

 

Let me know if you have any questions.

 

NickB

National Instruments 

0 Kudos
Message 2 of 3
(3,956 Views)

Dear NickB,

 

Thank you for your advise. Maybe I am using VB, in order to make it works, I need to modify the statement as follows:

 

ScatterGraph1.PlotXYAppend(DataConverter.Convert(DateTime.Now, GetType(Double)), data)

 

YC

0 Kudos
Message 3 of 3
(3,941 Views)