Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

DigitalWaveform + with time xAxis

Hallo,

I'm the absolut Beginner in NI -programming. 

I've got a question about to add a digitalwaveform graph by using a time xaxis. 

 

xAxis = DigitGraph.XAxis;
xAxis.MajorDivisions.LabelFormat = new FormatString(FormatStringMode.DateTime, "00:dd/M/yyyy HH:mm:ss");
xAxis.Range = new Range(Mh.StartMeasurement, Mh.EndMeasurement)

. Dictionary<double, bool> Dc = Mh.BinaryValues(_values);

// time = key as oadate // binary state as boolean

//for example :
DateTime[] TmLst = Dc.Select(p => DateTime.FromOADate(p.Key)).ToArray();

DigitalWaveform TSeries = new DigitalWaveform(Dc.Count, 1);

 

How I can assign a time stamp to each binary state, I'm not able to find an example.

 

Thank you for help.

 

Andreas

 

 

0 Kudos
Message 1 of 3
(2,155 Views)

To associate a DateTime with each sample in the waveform, you can use the Timing property on the DigitalWaveform.

 

Unfortunately, digital waveforms do not currently support irregular timing, so you cannot directly translate your TmLst array using the WaveformTiming.CreateWithIrregularInterval method. If each DateTime falls on a regular interval, then you can use the WaveformTiming.CreateWithRegularInterval method to set the timing:

TimeSpan interval = TmLst[1] - TmLst[0];
w.Timing = WaveformTiming.CreateWithRegularInterval( interval, TmLst[0] );

 

If you are dealing with irregular timing, then I believe the only way to configure the correct timing on a digital waveform is to de-compress by duplicating samples that fall on the regular interval between each irregular sample.

~ Paul H
0 Kudos
Message 2 of 3
(2,134 Views)

Thank you !!!

I try to figure it out ...

Andreas

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