LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

No Graph Size event...how do I know when to redraw my plot images?

LV 2011 SP1

 

I have a graph that can be resized, and it contains a front image:

WFGraph:Plot Images:Front

 

When the graph changes size, the plot image needs to be updated, but I can't find a "Graph Size" event to catch and handle. The shipping example for using plot images (<labview>\examples\general\graphs\Graph Pictures.llb\Graph Plot Area Images) constantly updates the image in a loop, but that's a non-starter for my application. I need to be able to respond to an event, not continuously redraw the UI.

 

I tried putting the graph in a pane using splitters and setting it to resize with the pane so I could catch and handle the "Pane Size" event, but the output of the "Map XY to Coords" method doesn't give updated values when I handle that event. I suspect the event is being fired and handled before LV's drawing engine resizes the graph to meet the pane's new bounds.

 

Has anybody figured out a way to do this? Surely LV provides some solution!

0 Kudos
Message 1 of 11
(3,072 Views)

@David_Staab wrote:

 

I tried putting the graph in a pane using splitters and setting it to resize with the pane so I could catch and handle the "Pane Size" event, but the output of the "Map XY to Coords" method doesn't give updated values when I handle that event. I suspect the event is being fired and handled before LV's drawing engine resizes the graph to meet the pane's new bounds.


I haven't looked into this, and I'm assuming you're not using a filter event (if memory serves, there's no resizing filter event), but if this is the case, you could probably just fire another event (or use some other notifying mechanism) from the event case and do the updating in the second event. You might need to wait before calling the actual method (and be willing to accept race conditions, etc.).


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

Update: Responding to the Pane Size event works now. I was using a notifier in my application to limit the number of redraws performed in response to the event, because I expected it to fire continuously as the pane resizes. The Wait on Notifier function, for some weird reason, wasn't responding until I put a probe on the refnum wire. (I have no idea!) After that, the redraw logic started executing and it worked.

 

I noticed that the Pane Size event fires very slowly. As a result my overlay only redraws itself when the user is finished dragging the panel (or once every second or so)...that looks kind of unprofessional. Any ideas for how I might get it to redraw more continuously while dragging the corner of the panel? Maybe a combination of Mouse Down and Mouse Move events...?

0 Kudos
Message 3 of 11
(3,046 Views)

The mouse events won't help you in any case, because they only respond to events inside the panel. I'm not sure I understand the current issue, so I would suggest you upload a simple example demonstrating it so that we have a baseline.


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

Here you go: a simple change to the shipping example. Run it, grab the lower-right corner of the VI, and drag the corner around to resize. Two things to note:

  • The overlay only updates slowly, so it's rarely in sync with the waveform.
  • If you drag around the screen fast enough, you'll see that the overlay changes shape. This is because the coordinates for each point are polled in a loop, and the graph will have changed size by the time the next point is queried from the method.
0 Kudos
Message 5 of 11
(3,033 Views)

What does the VI you posted have to do with your question?  No event structure. No images. Not even any graphs.

 

Lynn

0 Kudos
Message 6 of 11
(3,025 Views)

Easy there, tiger. I posted the wrong file on accident. Here's the right one.

0 Kudos
Message 7 of 11
(3,020 Views)

May I have the Map Graph to XY Panel Coordinates.vi, please.

 

Lynn

0 Kudos
Message 8 of 11
(3,011 Views)

That's a dependency of the original example. It's also in <labview>\examples\general\graphs\Graph Pictures.llb .

0 Kudos
Message 9 of 11
(2,999 Views)

It looks like this has nothing to do with the pane size event. If you run the polling case and add an indicator on the i terminal, you can see that the loop actually slows down considerably when you resize the panel. I'm not sure where it stops running, but it's not the obvious suspect, which is the XY-Coords conversion, because it still happens when you disable it. It seems to happen with every call to a property node (see the attached VI).

 

But that doesn't really help you. I don't know if the following will, but the example you posted can be handled simply by setting the point style on the plot. I'm assuming your real case needs something more complicated...

I'm also assuming that setting the object not to scale while resizing is not something you want, because that doesn't look very good either...


___________________
Try to take over the world!
0 Kudos
Message 10 of 11
(2,984 Views)