LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Updating graph data using variant>property nodes - why do timestamps come out incorrectly?

I've made this simple VI to update a graph (fill_in_graph_dans.vi) with new values using its reference and a property node. It seems to work fine for straightforward numbers, but appears to have a lot of trouble when it comes to plotting my timestamps. (the timestamps have been converted to doubles)
 
What seems to happen is that the variant > property node loses/alters the value of the timestamp, making the dates corresponding to the data in the 1970's!
By setting the x scale on XY graph to autosizing you can see there data is there, but stuck in the 70's.
Reading the data back from the graph also gives the same result.
 
I've checked the data is being preserved correctly by the variant, and it certainly appears to be (see graph 2 in fillgraphtester.vi)
 
Surely there must be a way to make time based x axes on graphs without having to carry the data right through the whole program?
Have I done something incorrectly?
 
thanks for the help
 
Dan
Download All
0 Kudos
Message 1 of 5
(3,642 Views)
forgot to mention: it's LV 7.1
0 Kudos
Message 2 of 5
(3,638 Views)
hmmm, I've tried feeding the graph property node the timestamps explicity (instead of doubles) but that still shows the same problem.
Does anybody have any ideas why the graph property node is mangling the contents of my variant?
0 Kudos
Message 3 of 5
(3,627 Views)
The problem is subtle.  Your XY graph is of the wrong data type.  XY graphs can accept several different data formats.  Yours is not connected to anything, so it has a data type of the last data that was connected to it.  To solve the problem, connect your data directly to the graph, then delete your wire.  This will set the graph data type.  You will then need to replace your reference on the subVI, since it, also, is the wrong type.  Things should work at that point.

Let us know if you need more help.

P.S.  Updating a graph with a property node in another VI is fairly inefficient (you make copies of your data and force a refresh of the screen on every update).  It is usually best to update the graph in the VI it is on.  You can get the data to the graph using queues.  Check out the queue examples and post again if you are interested in more information.
Message 4 of 5
(3,614 Views)

thanks, this has fixed the problem. I foolishly thought that a graph was the same object whether it was plotting a single series or not! (note: I stopped using the variant too - no point as my datatype now fits as an input to the property node)

Seems to be working without any flaws now. As far as efficiency goes, I'm not overly worried. This is my first proper app and I'd rather keep it simple. It only needs to update the graph every 15s, or on user presses and I've deliberately kept the sizes of the arrays small.

Thanks a lot for the help!

Dan

0 Kudos
Message 5 of 5
(3,605 Views)