Showing results for 
Search instead for 
Did you mean: 

How to send Date/Time in Seconds to Waveform Graph?

Go to solution

I've seen a how-to from NI on sending date time information to a chart, but not a graph. When I try to build an array with a dbl type and a date/time type, obviously I get an error. 


Can anyone shed some light on such a simple task? Thanks

0 Kudos
Message 1 of 8

Hi, David.

  • Drop an XY Graph on the Front Panel.
  • Hover over it and notice that a Help box pops up saying its argument is a 1D Array of Cluster of two Dbl elements, X and Y.
  • In a For Loop, generate a Time (as a Real), a Value (as a Real), combine them with a Cluster "Bundle" command (Time, then Value), and bring that out of the For Loop through an Indexing Tunnel.  Run this into your XY Graph and you'll be plotting your data.

Bob Schor

0 Kudos
Message 2 of 8
Accepted by topic author David99999

Do you have one time value? If you have one time value t0, one data array [Y], and an explicit or implied time increment dt, you have the essential elements of a waveform datatype. Wire those elements into a build waveform node. Connect the waveform to a waveform graph terminal. Right click on the graph and deselect 'Ignore Timestamp'. 

NI Sound and Vibration
Message 3 of 8
Accepted by topic author David99999

Oops, Doug's answer is "more correct" than mine.  You mentioned explicitly a Waveform Graph in your question.  What I should have said was to drop a Waveform Graph (not an XY Graph) on your Front Panel, hover over it and see that it wants a Waveform (a LabVIEW Cluster with a Starting Time (t0, which can be 0 if you want the Time axis to be "Seconds, starting at 0"), a time interval (dt) representing seconds between the equally-spaced samples, and Y, a 1D Array of Dbl representing the data to be plotted.  The difference between a Chart and a Graph is that Charts plot "a point at a time", and can scroll past, while a Graph plots "all at once", and the only way to update it is to plot another Array, again "all at once".


Bob Schor

Message 4 of 8

So if my loop's timing is set to 10ms, my waveform graph time interval (dt) should be set to 0.01? Which can't be right because my graph is increasing in time way too fast

0 Kudos
Message 5 of 8

@Bob_Schor wrote:

....a time interval (dt) representing seconds between the equally-spaced samples...


Bob Schor

Is the time interval supposed to be at the same rate as the loop speed? I tried this and it increases in time faster than my computer's clock

0 Kudos
Message 6 of 8

Waveforms and waveform graphs are best suited for equally sampled data where you acquire/generate/read/process multiple (N) samples at a time. The loop rate determines the cadence with which you get a new block of N samples; the sample rate determines the sample interval.

DAQmx Snippet to Show Relationships (Fs, N, T).png


In this hardware-timed example, the DAQmx API puts all the timing information (t0 and dt) on the waveform.

NI Sound and Vibration
0 Kudos
Message 7 of 8

The reason there are Charts and Graphs in LabVIEW is they are for different purposes.  Use a Chart when you want to see the data as they are arriving, like an Oscilloscope or a Strip Chart recorder, which show you each point at the rate they are acquired.  On the other hand, you use a Graph when you have all of the points you want to plot and you want to see a "static Image" of all of the data.


In your example of sampling at 100 Hz, that's the rate that each sample occurs.  If you want to plot each sample as it is acquired, you want to use a Waveform Chart and plot every sample at a rate of 100 Hz, or a time delay of 10 ms.  You'll see a graph that increases at 100 points/second.  For this type of Acquisition and Immediate Viewing, you want the acquisition and Viewing to run at the same rate, so you might put the Chart next to the DAQmx Read and take the single acquired Sample and wire it to the Chart input.


On the other hand, if you want to acquire, say, a Waveform of 1000 points (which will take 10 seconds), you could wire it to a Waveform Graph (or, indeed, to a Waveform Chart), and after 10 seconds (required to build the Waveform), you'll see all 10 seconds.  If you are generating the data using DAQmx Reads, the Read will "clock" your While Loop -- if you specify the output to be a Waveform, the DAQmx Read will wait until the Waveform is build (which is why I said it takes 10 seconds).  So if you are simulating a DAQmx Read (say, using a Random Number generator), you need to use a For Loop with 1000 iterations to create the Waveform for the Waveform Graph (otherwise you'd be plotting 1000 Graphs of single points, which is kind of silly).


Bob Schor

Message 8 of 8