NI Home > Community > NI Discussion Forums

LabVIEW

Reply
Member
vijtin
Posts: 100
0 Kudos

Waveform Chart

Hello,

I am using labview7.0 and need to know how to display and update current time and date on x-axis of  waveform chart and waveform graph.

 

 

Please reply 

 

 

Thanks,

Ratna

Active Participant
Himanshu_Goyal
Posts: 294
0 Kudos

Re: Waveform Chart

Hi

 

In waveform chart or graph to select the x-scale as a time stamp, select the graph or chart property. Select the display format and according to your requirement select relative time or absolute time settings.

Thanks and Regards
Himanshu Goyal | LabVIEW Engineer- Power System Automation
Values that steer us ahead: Passion | Innovation | Ambition | Diligence | Teamwork
It Only gets BETTER!!!
Member
vijtin
Posts: 100
0 Kudos

Re: Waveform Chart

hi

Thanks for the reply, but i did all those changes in waveform chart and graph. The problem is it is not showing current date and time. Its displaying time as 5:30 and date as 01/01/04.

 

Kindly tell me how can i start chart x-axis with current time and date and update it after every 1 sec.

 

 

Thanks,

Ratna

Trusted Enthusiast
DFGray
Posts: 2,779
0 Kudos

Re: Waveform Chart

It appears you are not setting the timestamps of the data you send to the chart (we would need your code to know for sure).  The easiest way to set a timestamp on data is to use the waveform datatype and set the timestamp in the datatype before writing to the chart/graph.  You can certainly use single point waveforms.

 

Give it a try.  If you still have problems, post your attempt so we can help correct the problem.

Using LabVIEW 2011 - 2013 on Windows 7 64-bit
Member
vijtin
Posts: 100
0 Kudos

Re: Waveform Chart

Hi,

 

I have attached the code for x-axis timestamp. I tried many options but still facing the same problem of wrong timestamp on x-axis. My requirement is to start accumulating values of all plots as soon as the vi gets executed, so the

x-axis timestamp also should get accumulated from the start.

 

Please help me to solve this problem as its very important for further development.

 

 

Thanks,

Ratna 

 

 

 

 

Trusted Enthusiast
DFGray
Posts: 2,779
0 Kudos

Re: Waveform Chart

You have two major issues with your code:

 

  1. You need to associate the timestamp with the data, not the graph.  The graph can autoscale its X-axis if the data properly contains X information.  It cannot put data at an x-axis place other than where you tell it to.  You are not telling it anything (you have no x-axis information).  There are three primary ways of supplying x-axis information for LabVIEW data.  The first is to use the waveform datatype and make sure the timestamp and increment are properly filled out.  The second is to use a cluster composed of X0, dX, and a data array for your data (this is very similar to the waveform datatype).  The final way (which may work best for you) is to create a cluster containing the X data (timestamp, but not timestamp datatype) and Y data (value) for each data point.  You will need to use an XY graph for this to work.  Please read the documentation on LabVIEW graphs for details of these methods and look at the included examples.
  2.  You are using front panel controls to hold data.  In LabVIEW, data is held in the wires connecting nodes together.  Using front panel controls as data repositories and local variables to fetch that data will result in code which is slow, a memory hog, and prone to race conditions (a difficult to debug program error).  For example, in the timeout case of your event structure, at the top, you write the current timestamp to Current time, and right next to it, you use a local variable to fetch the data.  A wire would have worked much better, since this has a race condition.  There is no guarantee that the data will be written to the Current time indicator before it is read by the local variable, so you could get inconsistent results.  If there is no data flow reason for events to occur in a certain order, their order will be determined by the compiler or operating system in an indeterminate manner.

So learn about the different types of data that a graph can accept.  Learn about using wires instead of front panel controls.  Use shift registers to cache data in loops.

 

Good luck!  Keep us posted on your progress.

Using LabVIEW 2011 - 2013 on Windows 7 64-bit