Use your chart to indicate time of day.
LabVIEW charts, out of the box, don’t lend themselves to displaying the actual time of day. By default they give you 1024 history points and a visible scale of 0-100 so what you see is in terms of sample numbers, having no relation to actual time. This is reasonable, given that the scale is adjustable in so many ways; there’s no way to guess what you want, so it’s up to you to tailor it to fit what you want.
Sometimes it’s useful to display the time of day on your charts, and keep that axis correctly updated as data flows in. For example:
As you can see, the leading edge of the plots coincides with the current time on the clock (see here for how to do the clock indicator). As data keeps coming in to this chart, the leading edge will reach the right side and the chart (and the X-axis scale) will scroll to the left, thus always matching the time of day.
Out of the box, a LabVIEW chart has a history of 1024 samples, and an X scale of 0-100 samples. This scale has nothing to do with time, so if you want it to display the time, then you have to do several things to make it work. If you have a CLEAR CHART function, triggered by a button or something, then attach this code to that action, otherwise just do it once when you start the data flowing (Ideally, you should do this as you feed the first sample to the chart, but the few mSec difference that makes probably won’t matter).
First, you clear the history. That makes sure the OFFSET number is operating from an empty buffer (Time 0). If the history buffer contains data, then the OFFSET applies to the end of it, and that’s not what you want. The constant has to be an empty array of the same type of data as you feed to the chart (cluster of two DBLs in this case).
Next you set the XSCALE.OFFSET to set the OFFSET number to the current time.
Next you set the XSCALE.MULTIPLIER to the time (in sec) between samples that you display.
Next you set the XSCALE.MAXIMUM to now + the duration (in seconds) that you want the chart to show.
Do them in that order, or it could get confusing. You also can set the CHART HISTORY LENGTH to match the duration / the display period. For one minute at 2 Hz, that would be 120 samples. You only need to do that step once – it’s a property that is not programmable.