LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Changing visible graph plot takes a long time

I have a project with quite a waveform graphs, each graph showing up to 256 waveforms. Obviously you can't show all graphs at the same time or it would be just one big mess, so I made a selector to choose which waveform is visible.

The problem is, that my code to change the visibility of the plots takes quite a long time to run through at the first time (carefull with the example VI, labview will hang for several seconds after selecting a value). Interestingly only at the first time, after that the while loop runs through smoothly. Even after stopping and restarting the VI with another array it works quite fine, you have to close LabView completely to get this behaviour back.

 

Can you explain to me what is happening there? And is there some way to speed up this first run?

 

Spoiler
Choose visible graph plot.png

 

Best regards

jusaca

 

PS: One other question regarding the waveform graph:

How can I change the appearance of plot 0? In comparison to all of the other plots it has a white area beneath the plot...

Download All
0 Kudos
Message 1 of 5
(2,372 Views)

 You are graphing all of the data and then hiding most of it in a loop (causing your initial delay). Instead of writing all of the data to your graph, use your selector to index the array and only write the relevant data.

0 Kudos
Message 2 of 5
(2,368 Views)

The first mistake is your use of an inner while loop instead of a FOR loop. Most likely you'll get better performance if you disable FP updates during the inner loop execution, but that still seems incredibly inefficient. You should also limit the event queue to 1 for any "rapidfire" event, such as a slider change. (Currently you lock the front panel until the event completes). Why would you stuff many megabytes into a front panel object (graph) and using it as data storage if you never display more than a very small fraction of it?

 

 

All you probably need is to keep the 2D array in a shift register and update it whenever the data changes. Execute the even (1) when the data changes, (2) when the slider is moved.

 

Here is a nonfunctional template that you can adapt to your needs.

 

OneTrace.png

 


@jusaca wrote:

 

How can I change the appearance of plot 0? In comparison to all of the other plots it has a white area beneath the plot...


Don't apply a "fill to -inf" with white.

 

NoFill.png

0 Kudos
Message 3 of 5
(2,338 Views)

Use the property, Defer Panel Updates.

 

Defer it before you loop through the plots, then turn panel updates back on after you are done looping.

 

It will speed up the process tremendously.

 

But when I run your code on my PC, it actually is behaving pretty quickly.

0 Kudos
Message 4 of 5
(2,330 Views)

@

I was thinking about something like that, but I'm not sure how to implement it - the processing state machine runs asynchronously from the GUI loop, so when I get the value change event I have no access to the (already existing) shift register with the data. Thats why I figured using the graph as storage might be a good idea - I get the idea that might be a mistake 😉


Don't apply a "fill to -inf" with white.

Ah, that easy! Thanks already 😉

 

//

@

Ah, that's way easier to implement - I will try this first, before changing larger parts of the code. Thanks!

 

Best regards

jusaca

0 Kudos
Message 5 of 5
(2,325 Views)