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: 

Code locking all threads with graph property access (with Video)

Solved!
Go to solution

I have recreated this problem that I found in my large graphing project. I have included the example code to show the problem. Labview 2018 SP1 f4

 

My constraints:

I need to put data into a graph, then I need to access the property to see what the auto-scaled axis min/max values are.

I don't need to get those min max values with any speed, but as my code shows, it almost does not matter.

 

I cannot think of a way to get this property without locking the entirety of labview. Please help.

 

I have a project that:

Loads a graph with random data.

Asks for the min and max on the x and y axes.

 

Problem(s):

It takes ~1 second to get the min max values.

During that time the entirety of labview stops.

Not asking for the min max is not a problem.

Waiting for a while and then asking for the min max does not fix the problem.

The "code" seems to optimize itself. Running it ~4 times and the problem goes away. A recompile of the code brings the problem back.

I cannot afford the problem the "first" time because I am actively collecting the data that is being graphed.

 

To diagnose the problem I have:

Tried asking for the property and not. 

Tried waiting between setting the property and asking for the min max

Created an independent thread that counts 10 ms timeouts. This shows that some of the timeouts are ~300 ms, indicating the lockup.

 

 

Please see my code example (attached)

The video is taking time to upload, I will edit the post with the video of me demoing the problem as soon as I can.

 

Thanks, Kevan

 

0 Kudos
Message 1 of 5
(1,287 Views)

Change your plots to linewidth=1 and "no points" and things will speed up. You are saturating the UI thread with such complicated plot styles (thick lines and all these points).

 

I am also not sure why you are using xy graphs if your x values are spaced equally. It also seems silly to graph 10k points on a graph area that is less than 400 pixels wide. Where is the data for the red graph?

0 Kudos
Message 2 of 5
(1,271 Views)
Solution
Accepted by topic author kevanA

OK, I can see the problem but If I replace the xy graph with a new instance, things are back to normal (~3ms, even on the first run). Maybe your graph has some internal corruption.

Message 3 of 5
(1,254 Views)

Looking at this in more details, Another problem is overlapping objects. You have many items (plot legend, scale legend, x-scrollbar, graph palette, cursor palette)  overlapping with the graph and with each other. Never do that (even if they are hidden)!

 

Still there is something wrong with you Y axes. Why don't the markers have numbers? As I suggested, start with a new graph, then customize.

 

 

 

altenbach_0-1598497968346.png

 

0 Kudos
Message 4 of 5
(1,236 Views)

It bothers me that replacing the graph is what ultimately worked. I did not want to believe it. I also set the line width to 1 and got rid of the points. It bothers me that labview will lock all threads when it is doing this.

 

Thank you for the help. The Desktop Trace Toolkit logged the data that pointed me to this being my problem. I am just glad I could make a single VI that replicated it to post on the forum. The code this is in is much bigger +100 VIs.

0 Kudos
Message 5 of 5
(1,179 Views)