LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Odd Problem with Graph Control Legend

I'm experiencing an issue with an XY Graph Control (I think the others behave the same way) where I have more plots shown in the legend then exist in the data of the graph. Normally, I size the legend to the number of plots, and this isn't an issue, but in this application I need to use the scrollbar on the graph legend because there are potentially a large number of plots. There is no easy way to read the number of elements in the graph legend; I have to cycle through Active Plot until I get an error. My workaround is to just make sure the plot names are blank for all plots after the real ones, but the plot visibility checkbox is still visible for these ghost plots. I can uncheck them, but they are still there. Can anyone recommend a way to clear the elements out of the plot legend?

.GraphLegendGhosts.png

0 Kudos
Message 1 of 8
(2,769 Views)

You can just right click on the graph and open up the properties. There's a numeric control there for "Number of Plots to Display". You can also access this programmatically with a property node.

0 Kudos
Message 2 of 8
(2,680 Views)

Seems like this known (and annoying) behavior: How-can-I-delete-a-curve-from-a-graph 

Message 3 of 8
(2,658 Views)

There are related ideas about this (there might be workarounds in them):

Provide method to delete plot names from all graphs, charts, etc. - NI Community

0 Kudos
Message 4 of 8
(2,655 Views)

Thanks for taking a moment to take a look at this. Unfortunately, the "Plots shown" from the properties dialog is equivalent to the xygraph:legend:number of rows property. That only controls how many rows of legend entries are visible in the legend at one time, not how many plots are in the legend.

0 Kudos
Message 5 of 8
(2,615 Views)

@minnellac wrote:

Thanks for taking a moment to take a look at this. Unfortunately, the "Plots shown" from the properties dialog is equivalent to the xygraph:legend:number of rows property. That only controls how many rows of legend entries are visible in the legend at one time, not how many plots are in the legend.


Yes, it's known (and annoying) behavior.

0 Kudos
Message 6 of 8
(2,609 Views)

I thought I was on to a solution with the Legend Plot Minimum property mentioned in one of the threads you linked. In fact, writing any value (other than 0) into the plot legend minimum property seems to trigger something that gets rid of any legend elements that are greater than that number (yay!), but, the behavior of the legend with a scrollbar after that is weird. Everything after the desired number is now grayed out, but it seems to get the text from the last or second to last valid legend item. Sometimes it shows up blank, but moving the mouse cursor over it seems to paint in plot names. Shown below are a couple of legends where the only difference is that I moved the mouse around and scrolled the legend (with mouse scroll wheel) a bit. I'm not sure if this is better or worse than the original situation.

weirdplotlegend.pngweirdplotlegend2.png

0 Kudos
Message 7 of 8
(2,601 Views)

I gave up on this years ago.

 

Even if the number of plots gets fixed, I need more control over graph properties. I usual don't want my customers to change labels, or fill graphs to -inf, change to bar plot, etc.

 

A DIY legend can be anything from easy to very, very hard, depending on how you want it. An array with colors is easy, for example. If you want line style, you can make a picture ring. But if you want the exact look and feel of a 1 menu, where you can change line style, color and line with, well, good luck. Maybe there's one online, because that is just hell to make. 

0 Kudos
Message 8 of 8
(2,579 Views)