LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Adjusting time interval for Waveform Chart based on current system time

Solved!
Go to solution

Hello!

 

I'm using Waveform Chart (LabView 2015 SP1) to plot data from temperature sensor and need to modify the way it is pictured:

- maximum timestamp: the nearest half-an-hour ahead

- minimum timestamp: 3 hours back from the maximum

- time ticks on the x-Scale: every 15 minutes

 

I found post (https://stackoverflow.com/questions/32822008/labview-how-to-set-the-time-range-in-a-waveform-chart) which suggested to use properties Nodes, and I tried to do it this way:

 

Capture.PNG

But it doesn't seem to work:

- full scale for some reason is only approx. 17 minutes

- shown time is approx 2.5 h back from current system time

- end time is still not a nearest half-an-hour

 

Capture_2.PNG

 

What is wrong?

0 Kudos
Message 1 of 8
(1,818 Views)

First of all, please attach your VI instead of pictures. we cannot debug pictures.

 

What is the value of the "reading interval" control? That determines the multiplier (i.e. time spacing between points) you need to set. Are you sure it is set correctly. (We cannot tell from a picture!!!)

A chart has a fixed history and after the history is full, the oldest values are discarded. while the x keeps incrementing, so setting a max and min will not be useful. Maybe you want to implement your own buffer and use a plain graph instead. 

 

0 Kudos
Message 2 of 8
(1,808 Views)

Please, find the vi-file attached (is there a way to edit original post?). 

 

 

0 Kudos
Message 3 of 8
(1,768 Views)

Hi Ye,

 

when you need full control over the X axis then you should use a graph instead of a chart…

 

  • Collect your data in your own buffer.
  • Limit the amount of data wired to the graph to reasonable ranges (as required for your X axis range).
  • Set the X axis properties only when they change! No need to set the same values each iteration…
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 8
(1,762 Views)
Solution
Accepted by YePererva

Hi,  YePererva!

 

If I understand correctly, you need some "free space" on the Chart after the current measurement time (time ahead). And some history before.

 

- maximum timestamp: the nearest half-an-hour ahead

- minimum timestamp: 3 hours back from the maximum

- time ticks on the x-Scale: every 15 minutes

 

Try the attached code. For simplicity I set time ahead to 30s, and history time to 180s. I hope this is what you mean...

 

Perhaps the variant, proposed by @altenbach and @GerdW - using a separate buffer for collecting data and displaying them on a Waveform Graph, or even on XYGraph instead of a Chart would be more preferable.

 

How to determine the exact period of markers spacing along the X axis of a Chart - I do not know.

0 Kudos
Message 5 of 8
(1,744 Views)

Thank you! I'll test it. I need some time to understand how does it work.

0 Kudos
Message 6 of 8
(1,730 Views)

Sorry, I'm not getting this part, where you've set up the Offset and Multiplier. Could you explain me that?

 

P.S. Regarding time ranges: not exactly what I needed. Apparently, my original part should work, but I messed up at choosing Quotient & Remainder. I selected Reminder for further calculations instead of Quotient.

0 Kudos
Message 7 of 8
(1,706 Views)

This is due to the nature of the LabVIEW Chart control.
All points of the Chart are stored as an array of Y-values (Chart history). And the X-axis is actually the index of this array.

 

But the Chart has the ability to shift the values displayed on the X-axis using Offset and

set the distance between the displayed points using the Multiplier.
When your X-axis is in DateTime format, you can apply an offset using the current time when you start the program.

If left at zero, the displayed value will be the beginning of 1904.

 

You also have the refresh rate of incoming data - set it as a Multiplier and the displayed time intervals will correspond to reality.

 

PS: X AutoScale disabled in my example.

Message 8 of 8
(1,669 Views)