Example Code

Display Current Time on a Chart with Absolute Time Setting in LabVIEW

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Software

  • LabVIEW

Code and Documents

Attachment

Overview

This document demonstrates how to add timing information so a chart displays the correct time.

 

Description
As discussed in KnowledgeBase 326F9HIP: Displaying the Current Time in a Graph/Chart, displaying Absolute Time on a Chart with no timing information displays the starting time and date as 1:00am 1/1/1904.  The purpose of this example is to illustrate a two methods for displaying the correct timing information on a LabVIEW chart. 

     

Method 1 involves setting the correct timing information in a chart's property node so that the x axis scales properly.  The multiplier will be set to the time between samples and the offset will be set to the time of the initial sample, as seen below.

 

Method 2 involves setting this timing data into a waveform data type, which will scale the chart automatically when it is set as an input.  The actual values being set are similar, but they are packaged into the properties of the waveform itself rather than the chart, as seen below.

 

Requirements

  • LabVIEW 2012 (or compatible)

 
Steps to Implement or Execute Code

1. Select which mode use
2. Set Samples for Second
3. Run VI

 

Additional Information or References

VI Block Diagram

Absolute Time Chart LV2012 NI verified.png 

 **This document has been updated to meet the current required format for the NI Code Exchange.** 

 

Alex Person
NI-RIO Product Support Engineer
National Instruments

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Comments
heel
Member
Member
on

I tried this in LV2012. The second program model using waveforms works nicely, however the first using manipulation of the offset of the x-axis does not work if the chart already contains data from a previous run.

And after a few thoughts - it can never work without filling in the missing time laps. So to make sense, the chart should be cleared upon start. Then it works.

abh
Member
Member
on

I want to get the correct time in my chart but unable to do so as i am applying the second method illustrated above. please help i am working with analog I/O 's of NI WSN Devices.

kaywr
Member
Member
on

I need to fill in the X-axis with 7 "major tick marks", including time and date, to display a 7-day temperature trend chart.  I was able to do so using Labview 6.1 but not with 2009.  Please help