LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

trouble adding times to graphs

I am trying to add a graph to my VI. I have a continous loop measuring weather data. I want to plot these values with the current time on the X axis. Is there a simple way to accomplish this?
0 Kudos
Message 1 of 16
(3,553 Views)
If the time between each measurement is constant you can use a standard graph and set the X.Scale.Multiplier property once, and then calculate and set the offset every time you update the graph.

E.g. read the number of values you have and use the current time and the delta t to calculate the offset value (the start time) to write to the XScale.Offset property.

If delta t varies you'll need to use an XY graph and bundle each measurement with it's time.
0 Kudos
Message 2 of 16
(3,553 Views)
> I am trying to add a graph to my VI. I have a continous loop measuring
> weather data. I want to plot these values with the current time on the
> X axis. Is there a simple way to accomplish this?

Since it is continuous, it sounds like you might want a chart instead of
a graph. Charts have built-in history, keeping the existing points and
adding the new ones to it. If using a graph, you can do the same using
a shift register and an array builder.

As mentioned in the other post, for evenly spaced points, set the
multiplier to the delta between points, and set the Offset to be the
time of the first point.

Another way to go that will work for discrete points is to build a
waveform by attaching a timestamp to each.

Greg McKaskle
0 Kudos
Message 3 of 16
(3,553 Views)
With regards to your question on displaying a time on the x-axis, I wrote a simple VI that shows how to format the x-axis into actual time stamp. Also refer to the previous answer or Greg McKaskle2 by attaching a timestamp to each accquired data. I'm not using offset/multiplier property instead I used maximum & minimum. Please view the sample vi. Good luck!
Download All
0 Kudos
Message 4 of 16
(3,553 Views)
Thanks very much for this...I will try it and let you know how it works!
0 Kudos
Message 5 of 16
(3,553 Views)
Joel,
Thanks for your Vi...I must admit I don't understand totally how it works! Can I trouble you to set it up to show one day (24 hours) on the X axis. I plan to add one value each minute. Can you show me where the analog input goes? and how to change the max min values on the Y axis? I think the time stamp idea will work very well as we start and stop the program frequently and working out the multipliers and offsets each time is frustrating. Thanks again for all your help!!
0 Kudos
Message 6 of 16
(3,553 Views)
I updated the VI and set the x-axis to 24H. Please view the documentation inside the diagram. Note that the graph will start to update and format the axis after 1min since start. I also corrected a graph connection error from previous vi. Replace the random number generator with your analog input where you sampled your data in real time. Good luck!
0 Kudos
Message 7 of 16
(3,553 Views)
Thanks again! One more quick question....I am searching the documentation and I can't seem to be able to add the time stamp to my data. (I assume that the input field on the left is where I would add my input data) How do I take a simple input from an analog channel and format it with a time stamp so your graph can view it? I'm sorry but I am new to this....MH
0 Kudos
Message 8 of 16
(3,553 Views)
> Thanks again! One more quick question....I am searching the
> documentation and I can't seem to be able to add the time stamp to my
> data. (I assume that the input field on the left is where I would add
> my input data) How do I take a simple input from an analog channel and
> format it with a time stamp so your graph can view it? I'm sorry but I
> am new to this....MH

I'm not sure what you are looking at when you refer to the left. First
determine what your current datatype is by showing the Context Help
window and placing the tool, particularly the wiring tool over the wire.

If the wire is a waveform, you can set the timestamp on the waveform
using the Build Waveform node. Wire the existing waveform to the top
left, and the timest
amp you want to use to the t0 input on the left.

If the wire is an array, build either a waveform by wiring the array to
the Y input and the timestamp to t0. Another alternative is to use a
cluster built using a bundler.

You might want to open the example in
examples/general/graphs/gengraph.llb/Waveform Graph.vi

Greg McKaskle
0 Kudos
Message 9 of 16
(3,553 Views)
Here is a modified VI to show you where to connect your analog input. On the diagram, replace the sub vi "Single Data Analog Input.vi" with your analog input. Here, I'm using double numeric datatype. You need to acquires a single data point or measurement from a single analog input channel. Good luck!
0 Kudos
Message 10 of 16
(3,553 Views)