From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to force a plot legend to refresh immediately

Hello everybody,

 

sorry to bother you with this but I have a little problem with the refresh of a plot legend (LV 8.6). In an XY-Graph I'm displaying temperatures along a railtrack. When the temperatures cross some alarm boarders I'm changing the way the plotlines appear (different colour and line style). This works well, the only thing is that the plot legend will not show these changes immediately. I've tried to force the frontpanelelements to update by setting the "Defer Front Panel Update" Property to False but this does not really work. The FP is always in Front but it updates sometimes seconds, sometimes minutes later, sometimes only when I bring the frontpanel to the background and then to the front again.

 

As the "Defer FP Update" did not really work out, is there another possibility to force the plot legend to update?

 

Greetings,

 

Robert

0 Kudos
Message 1 of 9
(3,976 Views)

Hi,

 

Can you post your code?

0 Kudos
Message 2 of 9
(3,968 Views)

Hi,

 

as my original code involves some external hardware it is not suitable as an example and so I tried to get a simple VI done that demonstrates the problem.

 

Doing this made me nearly mad as the problem seemed to be not reproducible at first ... it really took some time to find out about a rather strange behaviour of the plotlegend ... so maybe I stumbled across some kind of Bug (may be LV-Version dependent, i don't know).

 

The code I attached simple generates a sine wave with increasing amplitude and as soon as the maximum value crosses an alert boarder (in the example 30% of amplitude) the alert boarders will change to a bold dotted line.

When you run the VI the plotlegend get's updated immediately, just as one would suspect. But as soon as you rename "Plot 1" to "alert" or something alike, the plotlegend will not update anymore!!! This is also what happens when you drag the plotlegend to a different position.

 

As this is (in my opinion) rather strange behaviour I can not guarantee that this will show up on any other PC or when running it in another LV-Version but that's how it behaves on my PC using LV8.6.

 

Any ideas how to avoid this?

 

Regards,

 

Robert

0 Kudos
Message 3 of 9
(3,949 Views)

Hi,

 

I have tried to reproduce your problem with LV 8.6 and your description of renaming and moving the plotlegend but I was not able to get the error. Have you tried to slow things down for debugging with the highlight-tool?

 

Cheers,

Niceday

0 Kudos
Message 4 of 9
(3,932 Views)

Hi robert p,

Try this. As you said you have some other code as well ...may be it is taking some time to execute so your case structure which decides plot type executes late.

Try to put your case structure in other loop. With less delay. May be this will help.

 

example.JPG

Gaurav k
CLD Certified !!!!!
Do not forget to Mark solution and to give Kudo if problem is solved.
0 Kudos
Message 5 of 9
(3,927 Views)

Hi Gak,

hi Niceday,

 

thanks for your effort but I have to admit that I'm slightly puzzled. As Niceday wrote that he could not reproduce the error and Gak made the suggestion to alter the code and both suggestions did not change the behaviour of my plotlegend I suspected some sort of graphicproblem specific to my PC. But when I copied the VI to another PC with LV2009 it still was (nearly) the same. Dragging the plotlegend around did not effect the refresh of the legend but after renaming "Plot 1" to something different the plotlegend again did not update anymore except on things as Mouse-Over or Minimizing/Resizing the whole window.

 

So the problem must be something different and is not dependent on the PC or the LabView-Version used!

 

I'd be grateful for any further suggestions!

 

Thanks,

 

Robert

0 Kudos
Message 6 of 9
(3,915 Views)

Hi,

 

okey... seems odd. Can you give use some details about the operating systems and computers? And to get things straight, have you used the example or your old version on the "LV 2009 computer"? Hope we can be of any help!

 

Cheers,

Niceday

0 Kudos
Message 7 of 9
(3,894 Views)

Hi,

 

I used the example I posted in this thread and also a new one that included the changes Gak suggested. Both showed the behaviour I described in the above post.

 

I have to admit, that in the meantime I found a quite dirty (and not really satisfying) workaround with an independent VI that serves as a hideable plotlegend that displays the colors and linestyles depending on boolean alert states (visualized as boolean elements with correspondig graphical elements). In my case this was very easy to do, so for me this problem has lost quite a bit of importance.

 

But concerning the machines I tested the example with ... both are machines running WinXP, the hardware of both machines is not very common I guess. They are industrial Mainboards (both iBase, a MB930F-R and the older one MB800) because we need to have ISA-Ports in both of those systems.

 

Greetings,

 

Robert

0 Kudos
Message 8 of 9
(3,886 Views)

I'm also having this problem. Anybody know a fix? Force redraw on the plot doesn't  do it. The best thing I have come up with is hiding and showing the legend scrollbar. If it's fast enough you won't see the scrollbar flash but it will redraw the plot legend. It's also definitely a hack so if anyone has a better solution I'd love to know what it is. 

0 Kudos
Message 9 of 9
(3,062 Views)