11-28-2017 08:57 AM
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
11-28-2017 02:11 PM
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.
11-29-2017 08:08 AM
Thank you !!!
I try to figure it out ...
Andreas