LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

legend programming

Solved!
Go to solution
Hello,

I'm trying to control programmatically the legend of a chart graph. I've written a labview code and I don't find what is wrong there.
The legend doesn't operate correctly like I hope it. I've sent some input values (STRINGS) into the Plot.Name of the property node of my chart, they are correct when I try to get them again in output indicators but the legend shows me sometimes different STRING. Could somebody help me and explain me what I m doing bad?

Thanks,

PrinceJack
0 Kudos
Message 1 of 10
(3,370 Views)

Hi Princejack,

 

I don't know what you're after. Your VI sets the channel names to "Channel 1" to "Channel 4" as wired in the BD...

 

Show a picture of your "wrong" result.

 

Hints:

- For all those comparisions in your subVIs you will find special functions in the comparison palette (IsEmptyString?, IsNaN?, IsEqualToZero?).

- You also have a RubeGoldberg (IMHO) in your code with comparing a boolean to FALSE...

- You can resize the IndexArray function to have more outputs and you don't need to wire an index if you want elements 0 to 3...Then you wouldn't need 2 different subVIs to spit out some array elements...

 

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 10
(3,362 Views)

Thank you very much for your reply.

I sending you 2 pictures. You can see in example1.jpg that I've choosen 2 channels (1 and 4). I was waiting that the legend shows me the plot name "Channel 1" and "Channel 4" like the output indicators do it. But on the legend man has to read another Strings "Channel 4" and "Channel 2". I don't understand why.

On a second example (example2.jpg) you can see that I've choosen the Channel 1, Channel 2 and Channel 4. The Ouptput indicators give me here also these values again but the legend show me another Strings "Channel 4", "Channel 2" and "Channel 3".

With the choice of 2 or 3 channels I don't get always on the legend of the chart the correct Strings but I can control and see that the strings Iwaiting to read are sently correctly in theoutput indicators.

I searching the error since last Monday and try a lot of possibilities witout success.

I hope you understand now my preoccupation and could help me.

 

Thank in advance

Sincerly,

PrinceJack

Download All
0 Kudos
Message 3 of 10
(3,346 Views)

Take a look at the output of Channel_Selection.vi. Array2 is always of 4 elements, while the others are of size of buttons pressed.

Now check this expression:

NaN=NaN is false

This isn't obvious but logically correct.

 

BTW: Get rid of the local variables for 'initialization', they will give you problems. Also get used to the auto-indexing of for-loops, this will reduce code size by 50%

 

Felix

Message 4 of 10
(3,337 Views)

A picture is worth a thousand words: 

 

Lessons Learned.png

 

Felix

0 Kudos
Message 5 of 10
(3,325 Views)

I thank you for your assistance but you don't answer my question. I correct like you told me to do but I always have differents "OUTPUT STRINGS ON THE LEGEND OF THE CHART GRAPH".

My question is:

Why are the input strings into the "plot.name" of the property node of the chart graph different from the Strings of the Strings of the output indicators (element 1, element 2 element 3 and element 4) on the front panel.

 

I send you a picture again of the front panel and block diagramm.

Could you may be do the correction of my labview code? I send you a modified copy of the code.

 

Thank again,

 

Sincerly,

 

PrinceJack

Download All
0 Kudos
Message 6 of 10
(3,305 Views)
Solution
Accepted by topic author princejack

have a look at this code

 

dynamic legends.jpg

 

 and the false case:

 

dynamic legends2.jpg

 

0 Kudos
Message 7 of 10
(3,287 Views)

Thank you very much Jeffneuer,

 

Your picture help me very much and resolve my problem. But I would ask you just to know, if possible, could you explain me why the case structure, like I did, were false. The output indicators gave the desired strings but these don t appear on the legend. Could you explain me what was wrong? Just if you have some idea. Thank you again for your big help.

Have a nice day,

 

Sincerly

 

PrinceJack

0 Kudos
Message 8 of 10
(3,263 Views)
see attached
0 Kudos
Message 9 of 10
(3,252 Views)

Thank a lot for your reply. I understand it now better.

Thank again and have a nice day again.

 

Sincerly,

 

PrinceJack

0 Kudos
Message 10 of 10
(3,245 Views)