LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

What is a good way to graph time?

I am programming my application and I want the X axis in my X-Y graph to be time. I have yet to find a good way of converting the timestamp to a format which can be graphed. Any ideas out there? The only thing I have found so far to be moderately useful is the millisecond timer.
0 Kudos
Message 1 of 11
(4,023 Views)
Unless you HAVE to use an XY graph, try using a waveform chart/graph.  The waveform data type (WDT) contains timing information, and the graphs/charts use the timing information as their x-axis.
0 Kudos
Message 2 of 11
(4,016 Views)
You don't need the millisecond timer. what you need to do is use To DBL (Numeric>>Conversion palette) to get the X value you want and format the axis as absolute time (right click on the graph>>Format & Precision). This is because a timestamp is a DBL representation of the number of seconds that have passed since 01\01\1904.

___________________
Try to take over the world!
0 Kudos
Message 3 of 11
(4,015 Views)

Would you happen to have an example of how you would program this? I am not quite grasping how it should look. Thanks in advance.

 

Troy

0 Kudos
Message 4 of 11
(4,007 Views)

Have a look at the attached VI. It uses a graph to simulate a chart (that's good if you have the data coming in at non-regular intervals).

Ignore all the stuff except the top left corner where a new data point is being created. It is built from an X value (time) and a Y value (random #). Then, look at the formatting for the x-scale. You will see it is set to display Absolute Time. That's it. Simple as that.

If you use a chart, you only feed the Y values, so you need to use the Offset and Multiplier properties in the beginning to get the X scale right.

To learn more about LabVIEW, I suggest you try searching this site and google for LabVIEW tutorials. Here and here are a couple you can start with. You can also contact your local NI office and join one of their courses.
In addition, I suggest you read the LabVIEW style guide and the LabVIEW user manual (Help>>Search the LabVIEW Bookshelf).


___________________
Try to take over the world!
0 Kudos
Message 5 of 11
(4,001 Views)
Hi Trosier,

I'm not sure if you are aware of this, but you can actually use the Waveform Chart with timestamps too. This makes it easy to plot data that has been collected with uneven dt. Just change the properties of the Chart to use "time" as the unit of the X-axis and then just add the timestamp to each data point that is being collected. Only catch: Remember to use the Build Array function, since the Build Waveform only accepts an array as "Y"::



After you create the code, try to change the "millisecond multiple" in run-time, and notice how the horizontal distance between the data points change accordingly.

Have fun!

Message Edited by Philip C. on 08-18-2005 02:22 AM

- Philip Courtois, Thinkbot Solutions

Thinkbot Solutions
0 Kudos
Message 6 of 11
(3,972 Views)

Philip - Thanks for the information. That really helped. I changed my VI and now it is working the way I originally wanted it to. One other thing. I am trying to clear the chart when starting the VI. All of the help I have searched in tells me how to clear charts that are using an array of double precision etc., etc. I cannot find out how to clear a charts history that is using waveform dbl. The help says to wire an empty array to the history property node but I cannot seem to get it. Any help would be appreciated.

 

Thanks,

Troy

0 Kudos
Message 7 of 11
(3,956 Views)
If you create a property node, the very bottom property is "History Data".  Just click that, make sure it's writeable (Right click->Change to Write), and then right click on the property, and ->create constant.

That should do the trick...  I dunno if this image helps, but that's what it looks like.

Message Edited by Novatron on 08-18-2005 09:42 AM

0 Kudos
Message 8 of 11
(3,956 Views)
That is what I was initially trying to do but the create>constant is not able to be selected in this case. I am trying to initialize a chart that is using waveform (dbl). That is where the problem is.
0 Kudos
Message 9 of 11
(3,947 Views)
Sorry, if you do the same thing, and right click and create a control, it will have the same effect, so long as you leave the control empty.

Another option would be to set the default of the chart to empty, and then reinitialize it to default on the program start.

Message Edited by Novatron on 08-18-2005 09:57 AM

0 Kudos
Message 10 of 11
(3,945 Views)