LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

graph scale updates on tabs

  We have a program with several tabs, each of which has different graphs and displays.  On one of the tabs is a histogram style bar graph.  We've added annotations to each bar to label each bar with a particular identifier.  The graphs are set to autoscaling, so first we write the data to the graph with a "Value" property node, then read back the graph's YMax value and use that to help calculate where to put each annotation.  (We typically put the annotation above the bar, but have to limit it to less than the YMax value so it stays on the graph.)  Works fine, as long as the graph's tab is displayed.

   So now you're displaying a different tab and put new data into the system.  Then click to the aforementioned tab.  The new data is displayed, and the graph is properly auto-scaled, but the annotations are out of place.  The YMax that was used to calculate their maximum y position was the graph's YMax from the last time it was displayed.

   What appears to be going on is that the graph's display isn't completely updated when LabVIEW knows that the graph isn't visible.  When you later make the graph visible, LabVIEW appears to have instantly autoscaled it correctly, but the YMax value that was available when the annotations were being created isn't the YMax that would be expected from the new data.

   Our work-around is to use the maximum Y value of the data.  For autoscaled graphs, this is usually pretty similar to the YMax of the axis, but not exactly the same.

   Does anyone have any insights or other ideas?  (Synchronous display didn't seem to help.  And we couldn't find any other property nodes that might be relevant.)

 

Thanks,

   DaveT

-------------------------------------------------------------
David Thomson Original Code Consulting
www.originalcode.com
National Instruments Alliance Program Member
Certified LabVIEW Architect
Certified Embedded Systems Developer
-------------------------------------------------------------
There are 10 kinds of people: those who understand binary, and those who don't.
0 Kudos
Message 1 of 2
(2,259 Views)

DaveT,

 

This may be a complete hack/abomination, but if you are prevented from manipulating your graph if the tab is not visible, you could use an Event Structure and handle the tab's Value Change event.  Update your graph within that event.

 

-cb

0 Kudos
Message 2 of 2
(2,253 Views)