LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to trigger an event based on a change to a graph scale range?

I would like to lock the x-scales of two graphs to each other. Typically what I do is continually write the x-scale range cluster from one graph to the other (only one x-scale is visable) in a while loop, but I would like to avoid polling in this application if possible. Is there an event that is triggered when the operator changes a scale parameter? I tried to use Key-up on my graph, but apparently the scales don't register as a text input on the graph control. I also fooled around with Mouse Enter/Leave/Move, but these are not guaranteed to work.

Any suggestions, or do I have to poll.

TIA
Chris
0 Kudos
Message 1 of 11
(4,256 Views)
What about creating a user generated event when you change the scale range of one graph? Using dynamically generated events would be a sort of manual way to create an event by which you can change your second graph.
0 Kudos
Message 2 of 11
(4,251 Views)
Hi Chris,

Just a question: what event causes the graph to re-draw? I have done this in a state machine where I put the actual graph-drawing event in a state... any change to the data causes the case structure to jump to the graph, which can also include the scale-linking.



@C. Minnella wrote:
I would like to lock the x-scales of two graphs to each other. Typically what I do is continually write the x-scale range cluster from one graph to the other (only one x-scale is visable) in a while loop, but I would like to avoid polling in this application if possible. Is there an event that is triggered when the operator changes a scale parameter? I tried to use Key-up on my graph, but apparently the scales don't register as a text input on the graph control. I also fooled around with Mouse Enter/Leave/Move, but these are not guaranteed to work.

Any suggestions, or do I have to poll.

TIA
Chris


0 Kudos
Message 3 of 11
(4,241 Views)
Thanks for responding. First, I like the idea of defining an event, but I'm still stuck with how to trigger it. I looked at dynamically registering events, and maybe doing something where a click on the graph control registers an event for key presses on the vi. I'd still have to figure out out to terminate the key press event. Unfortunately, (actually it's a feature I like..) there are a number of different ways to complete typing in a scale change. I routinely use ctr-enter (habit from working on a laptop), though enter works fine, and clicking somewhere else is probably the most common method. I am not that familar with User Defined Events, so I may be overlooking something obvious here.

The graphs are a Bode Plot, with a seperate graph for RPM vs Phase Lag, and RPM vs Magnitude. I want them to always be plotted on the same x-axis. The plot is generated when the user doubleclicks on a dataset. After that, it's just the user looking at it. They can change the axis without any new data being generated.

Thanks,
Chris
0 Kudos
Message 4 of 11
(4,235 Views)
One option would be to have a button the user has to press when making changes to the graph settings. You can set the tab order to make it as convenient as possible for the user... for example, the user changes the range of the graph and then has to hit enter or tab enter to press the button. This would give you a specific event to register, and then you could change both axes at the same time.

Another option would be to wire the control for the one graph to the range controls for both graphs. This would work if your application loops continuosly while running because the values would get read each loop. I guess it just depends on how you've implemented your VI...
0 Kudos
Message 5 of 11
(4,229 Views)
Try the 'Key Down' Event to register changes to the scale that end when the user hits 'Enter' and also the ' Mouse Up' event for when the user clicks away from the graph in place of the 'Enter' key.

Does this do what you need?
Randall Pursley
Message 6 of 11
(4,222 Views)
The 'Mouse Up' even is not a control event but a 'This VI' event.
Randall Pursley
Message 7 of 11
(4,218 Views)
I just wanted to follow up to this thread documenting my solution. I'm happy with the performance using Randall Pursley's suggestion of triggering scale updates on both key-down and mouse-down VI events. I was a little leary of how often these would occur (and I'm sure it would depend on the application), but for my situation it works fine. The case does execute unnecessarily, but nothing like as often as it would if I was polling with a reasonable update rate. Thanks to you all.

Chris
0 Kudos
Message 8 of 11
(4,209 Views)
Hello,
Would you please post the simple vi demonstrating the idea of locking xscale in two graps?
Thanks
0 Kudos
Message 9 of 11
(4,085 Views)
Here's a really quick example I just threw together. The x scale on the bottom graph contols both x scales. It would be a little more complicated to allow either scale to be changed, but it would work the same way essentially. I saved this as LV 7 just in case you are working with an older version. Let me know if you have any questions.

Chris
0 Kudos
Message 10 of 11
(4,068 Views)