LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Plot names don't update when deleting the plot legend name

Solved!
Go to solution

Hello,

 

I'm programming a software with LV2016 that uses a XY graph. The user will be able to edit the Plot legend name on the front panel. Then I use the plot names to update page caption in a tab control.

After some tests, I noticed that when the user deletes the plot name via the plot legend, the page caption in the tab control keeps the previous plot name. I try to figure out where the problem comes from and it looks like the graph doesn't reset the plot name when deleting the plot legend name. The only ways I've found to reset/delete the plot name are with the properties of the graph (right click on the XY graph) or by putting an empty string in the property node of the graph, but that's not what i'm looking for.

Of course I could use string controls and put them over each plot legend name but I would like to know if there is a way or a property to correctly delete the plot name by deleting the plot legend name via the front panel.

I put a small exemple that describe my problem.

 

Thanks in advance !

0 Kudos
Message 1 of 11
(2,745 Views)

How are you deleting the plot legend name, and it isn't working?

If I select the string in the plot legend, hit delete, and either hit enter or click else where,  it seems to update for me.

0 Kudos
Message 2 of 11
(2,740 Views)

Hello RavensFan,

 

Indeed, it updates in my side too, but sometime it looks like the program doesn't consider the new Legend name when I delete the string and click else where as you can see below :

 

Plot Name example.png

0 Kudos
Message 3 of 11
(2,732 Views)

What do you mean by "left else where"?

0 Kudos
Message 4 of 11
(2,729 Views)

Click* else where sorry

0 Kudos
Message 5 of 11
(2,725 Views)

Odd.  Because I could click elsewhere and it would update.

 

But to be fair there were a couple times in messing with it that it didn't seem to update.  But I could never figure put my finger in exactly what I did that caused it not to update.

0 Kudos
Message 6 of 11
(2,711 Views)

Little Update : I noticed I've made a small mistake : the event was generated in each loop.

I corrected it but still got the same problem.

0 Kudos
Message 7 of 11
(2,706 Views)

Why are you playing around with spaces vs. empty strings in the timeout case of the event structure, switching back and forth between them?

 

I think you might have a race condition game going on where if you delete the string as just the wrong moment, the race between those property nodes where one is switching from a space to an empty string, and the other is switching from an empty string to a space, that although you changed the string, the results of the comparisons aren't recognizing a change occurred.

 

I ran your code with highlight execution turned on and it helped show me how confusing it all was and the results of the comparison kept coming out to be False and not triggering a change.

 

(PS:  You don't need those constants on the Index array function.

0 Kudos
Message 8 of 11
(2,697 Views)
Solution
Accepted by topic author GBrevier

Indeed I ran my code with highlight execution aswell and I saw that the comparaison doesn't trigger the event.

 

Furthermore, I noticed that when you delete the plot legend name via the front panel and you try to read the plot name with a property node, the graph keeps in memory its previous plot name, instead of returning an empty string.

 

I think I'm going to use string controls I'll put on the different plot legend name as follows in this example. It makes the event easier to handle and allows me to write empty string in my plot legend and my tab control.

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

I think that's probably a good idea.  Besides what I think may be a race condition in the way you coded it, it is also possible there is a timing issue in the way the event structure handles events.  The order of when LabVIEW detects events vs. its handling internally things like the plot legend update or leaving a control maybe in happening in an order that works against you.

0 Kudos
Message 10 of 11
(2,671 Views)