LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Plot Legend Ordering

I am having a small, but frustrating problem in a LV app. I have a waveform chart that has a plot legend that is assigned programmatically. I assign the names with a property node of plot.name. The plot legend names are assigned in numerical order. I can add another element set to read and it shows the names in numerical order. I also set the active plot and the length of the plots.

The legend is not displayed in order and the plots are all off by one. The last one is actually the first one. The first one is actually the second one.

Any ideas?

TIA

James
0 Kudos
Message 1 of 8
(3,745 Views)
Please post an example of this!

I have dynamic plots and names but have never seen that behaviour.

I would like to see the code that does this.

Ben
Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 2 of 8
(3,742 Views)
I have encountered the same problem before when I was trying to help out another person solve this sort of thing then dennis set me straight.


see answer here



Joe.
"NOTHING IS EVER EASY"
Message 3 of 8
(3,735 Views)
Thank you Joe!

So this could also be the result of the active plot being set set AFTER (i.e. lower in the property node) the name is set.

So (imagining now) if a for loop is used to do the naming and the active cursor is the last when the loop starts, the first name would be applied to the last active plot. Then the active plot gets set to "0" in prep for the next iteration.

Just guessing.

So if this is the case, the fix would be to change to order in which the properties are manipulated in the property node (they execute top to bottom).

So thanks again joe for "the kick in the head"!

Ben
Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 4 of 8
(3,724 Views)
I eventually have fixed the problem. I pasted the code inside of the sequence, then made a sub vi. It works now, but the only thing I can I can guess at is the code I show in my attachment was pasted from old code I have had for years. Maybe some problem with the passed reference?

This is an example of it not ordering correctly.
0 Kudos
Message 5 of 8
(3,723 Views)
Bingo!

Rearrange the order of the properties such that the active plots is set first (i.e. above) and then set the name.

Again, thank you Joe.

Ben
Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 6 of 8
(3,721 Views)
Ben

It is a privelidge and an honor to get a thank's from someone of your expertise but as you can see from the post the thanks really belongs to dennis, I just knew about the post and seen it's relevance here. thanks for the stars.



Joe.
"NOTHING IS EVER EASY"
0 Kudos
Message 7 of 8
(3,717 Views)
Joe,

That is the explination that I have been searching for. It also works with multiple elements in a single node if the Active Plot is set first. I only spent several hours on this 😉

Many Thanks,

James
Message 8 of 8
(3,708 Views)