Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

Setting the absolute time on a stripchart

Hi,

 

How do I set the absolute start time of a strip chart in measurement studio? In CVI I would do the following....

 

GetCurrentDateTime (&start_time);
 
 SetCtrlAttribute(panel, control, ATTR_XAXIS_GAIN  , gain      );
 SetCtrlAttribute(panel, control, ATTR_XAXIS_OFFSET, start_time);
 

Many thanks

0 Kudos
Message 1 of 4
(6,284 Views)

I am not exactly sure what you want your timestamps to look like, but here is an example that uses some of the methods and properties you will need. I may be able to make a more specific example if you give me some more information.

 

double[] myArray = new double[10];
            for (int i = 0; i < 10; i++)
                myArray[i] = i % 4;

            NationalInstruments.UI.AnalogWaveformPlotOptions plotOptions = new NationalInstruments.UI.AnalogWaveformPlotOptions(
                NationalInstruments.UI.AnalogWaveformPlotDisplayMode.Time, 
                NationalInstruments.UI.AnalogWaveformPlotScaleMode.Scaled, 
                NationalInstruments.UI.AnalogWaveformPlotTimingMode.Auto);
            waveformGraph1.Plots[0].DefaultTiming = NationalInstruments.WaveformTiming.CreateWithRegularInterval(
                TimeSpan.FromSeconds(2), 
                DateTime.Now, 
                TimeSpan.FromSeconds(8));
            NationalInstruments.AnalogWaveform<double> myWaveform = NationalInstruments.AnalogWaveform<double>.FromArray1D(myArray);
            waveformGraph1.PlotWaveform<double>(myWaveform, plotOptions);

 

National Instruments
0 Kudos
Message 2 of 4
(6,279 Views)

Hi,

 

I have a stripchart with multiple traces and would like to display the real time of day along the x-Axis in the format hh:mm:ss. Currently when I run the application, the stripchart start time defaults to 12:00:00 and I would like this to be the actual time of day.

 

As mentioned when I do this in CVI I simply set the offset value to the current time of day but I cannot see how to do this in Measurement Studio.

 

Hope this makes sense.

 

Thanks

0 Kudos
Message 3 of 4
(6,272 Views)
double[] myArray = new double[10];
            for (int i = 0; i < 10; i++)
                myArray[i] = i % 4;

            NationalInstruments.UI.AnalogWaveformPlotOptions plotOptions = new NationalInstruments.UI.AnalogWaveformPlotOptions(
                NationalInstruments.UI.AnalogWaveformPlotDisplayMode.Time,
                NationalInstruments.UI.AnalogWaveformPlotScaleMode.Scaled,
                NationalInstruments.UI.AnalogWaveformPlotTimingMode.Auto);
            waveformGraph1.Plots[0].DefaultTiming = NationalInstruments.WaveformTiming.CreateWithRegularInterval(
                TimeSpan.FromSeconds(1), 
                DateTime.Now, 
                TimeSpan.FromSeconds(0));
            NationalInstruments.AnalogWaveform<double> myWaveform = NationalInstruments.AnalogWaveform<double>.FromArray1D(myArray);
            waveformGraph1.PlotWaveform<double>(myWaveform, plotOptions);

 

 

Plots something that looks like:

 

PlotWithTiming.PNG

 

National Instruments
0 Kudos
Message 4 of 4
(6,266 Views)