LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Question about waveform chart and x-axis

Solved!
Go to solution

Maybe It's a stupid, but I don'k know how to solve it. 

Suppose you have a while loop and you have double data type, for example a random number. Then you send the data to a waveform chart. But in the x-axis you want the time in the proper format: month, year, day, hour, seconds, minutes, etc. 

Choosing from the properties of the chart the "absolute time", makes the x axis start in the 1904. 

Then I tried to create a property node in order to modify the Xscale offset, giving as a offset the timestamp from Get Date and converting it in a double. The first data has correct value for x-axis, but then the x-axis increases at a wrong rate (much faster than the real time). I tried to put the property node inside or outside the property node.

I tried also to play with other property nodes (Minimum and Maximum). I used a flat sequence structure inside the while in order to call the date before the chart, but I had no success. 

 

My question is: is there a way to have the proper value of time with a waveform chart if the data is a double?

[I don't want to use the XYGraph instead of waveform chart, because I need all the benefits given by the waveform chart that the graph has not.]

Thank you in advance

0 Kudos
Message 1 of 7
(3,394 Views)

Have you considered looking at the examples that come with LabVIEW? Do a search for chart. Open the VI called Real Time Chart.

0 Kudos
Message 2 of 7
(3,389 Views)
Solution
Accepted by topic author gnappo

The code I posted in this thread will let you plot data based on the time of the measurement. It uses a waveform data type to let you specify the "t0".

 

It looks like this.

 

 

have fun,

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 3 of 7
(3,375 Views)

That's exactly what I wanted! Great! Sorry if I could not find your old post: when I made a search I missed it. Thank you very much.

0 Kudos
Message 4 of 7
(3,364 Views)

From what I see, you will still have the problem of an incorrect dt unless your sample rate is 1 second.

0 Kudos
Message 5 of 7
(3,357 Views)

@Dennis Knutson wrote:

From what I see, you will still have the problem of an incorrect dt unless your sample rate is 1 second.


Good point Dennis!

 

From my experiements I believe as long as

 

1) There is only a single element in the "Y" array, the dt appears to have no effect provided...

 

2) The next update to the plot has a t0 that is larger than the previous time plus the default "dt"

 

so if the update come more often than the default of dt=1 second and all of the new time stamps are ever increasing it should work fine.

 

In apps where I use this technique I usally set the dt to be very small and not cause problems.

 

The tell-tale sign that the dt is to small is the chart will suddenly clear itself.

 

This techniques has worked very well for those apps where I am talking to a widget that is not periodic but I need to plot the updates vs time.

 

And if you really push it....

 

You can have data coming in at dirrenet times for each channel and as long as the "Y" array is empty the chart will ignore those plots. You can see sign of that in the above image where one plot is ahead of the other.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 6 of 7
(3,349 Views)

Cool. Never really used a waveform data type with a single element before with a chart. Learned something new today. Thanks!

0 Kudos
Message 7 of 7
(3,345 Views)