LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how can I limit the number of items in an XY graph legend

I am building an application that can have anywhere from 3 to 38 plots displayed on a single XY graph.  When the legend gets to be taller than the graph itself I will limit the height of the legend and display a scroll bar.  The problem I'm running into is that once I've run the application with 38 plots, all 38 stay in the legend list even if I run with only 5 plots.  How do I clear the legend so it is limited to the number of actual plots being displayed?  I have tried the 'obvious' property nodes with no luck.

 

I've attached a program that displays the issue.

0 Kudos
Message 1 of 5
(2,980 Views)

hide the legend scrollbar unless the number of plots is above a certain limit.

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

altenbach,

That works for the use cases upto about 20 plots.  With more than 20 plots the legend would be taller than the graph and I need the scroll bar so I can keep the legend no taller than the graph and still get to all the plots. I kept the scroll bar with the 5 plot case to demonstrate the behavior -- sorry for the confusion.  If I have a scroll bar all the 'extra' unused plots are at the bottom of the legend, no matter the value of 'Legend: Number of Rows', or the number of plots I'm actually writing to the graph.  It is those extras at the bottom of the legend I want to get rid of.

Steve

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

Hi Steve,

 

The secret is to write a value to Property: Legend: Plot Minimum.  This will get you very close to the functionality that you are looking for, with the exception that a single empty element will be added to the end of the legend.  I am not sure if/how you can remove that empty element.

 

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

MStewart,

Thank you.  The empty element I'm willing to live with.  Your solution gets me to where I want to be.  Thanks again.

Steve

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