How Can I Plot My Acquired Data Versus a Timestamp in LabVIEW?

Updated Jan 12, 2018

Reported In

Software

  • LabVIEW Full
  • LabVIEW Base
  • LabVIEW Professional

Operating System

  • Windows

Issue Details

I would like to plot my acquired data against its corresponding timestamp. How can I do this in LabVIEW?
 

Solution

There are two different ways to accomplish this, depending on the datatype of your acquired data:
 
  • Waveform Data

    A waveform data type is a cluster of three elements: the initial time when the first sample of data was acquired (t0), the increment or step between time values (dt), and the array of data collected (Y). If you have acquired your data as a Waveform data type, then you can wire it directly to a Waveform Chart or Graph. Refer to this KnowledgeBase Article for steps on incorporating timestamp information as the x-axis for Waveform Charts and Graphs.
  • Non-Waveform Data

    If the data you are acquiring is raw data with no time information, you will need to create timestamps for each data point. Refer to the example LabVIEW VI (Timestamp.vi) below in the Attachments and follow the steps below:
    1. Use the Get Date/Time In Seconds VI located in the Functions»Programming»Timing palette. Be careful NOT to use the Get Date/Time String function. Place this Get Date/Time In Seconds node inside the loop where you are accumulating your data.
    2. Within the loop, use the Bundle function to combine each data point and its corresponding timestamp. The output of the Bundle function will be a cluster of a data point and a timestamp.
      Note: You need to wire the timestamp data to the first input of the bundle function (x-axis value) and the data point to the second input of the bundle function (y-axis value).
    3. Place an XY Graph on the Front Panel. Then on the block diagram wire the output of the Bundle function to the XY Graph terminal. Make sure to enable indexing on this cluster wire at the loop boundary. (Right-click the wire tunnel at the border of the loop and select Enable Indexing.)
    4. Right-click on the XY Graph in the front panel and navigate to and click on X Scale»Formatting.
    5. From the Format drop-down menu, select Time (X-Axis).
    6. Complete the desired formatting for the time and/or date as you would like it to be displayed on the x-axis.
    7. Select OK to save the changes.
    For an example on how to make a graph with time stamps, please see the code example below.  
     

    WAS THIS ARTICLE HELPFUL?

    Not Helpful