LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Autosizing plot legends

I turned on Autosize Plot Legend on an XY Graph.  At one time the legend for a plot was very long. Now that the legend is short again, the autosize sets to the legend size to the old plot with the long legend name.  Is there a way to programatically remove the old plots names from the graph "history" so autosizing works properly?

 

New Bitmap Image.jpg

0 Kudos
Message 1 of 9
(4,753 Views)

Edit: so the "LegNumRows" can give you the option to set the number of rows. Since there is no way directly to delete a Plot from the Graph (I mean with the legend too), you could just rename any of the Plots as needed. So set the number of raws, and rename the Plots. In this way you can have total control on the visibility. The data order will decide what you connect to the XYGraph how your data will be displayed (changing names does not change any order in the Graph plot list itself).

You can always set first the active plot, and then operate on that plot, like this:

 

UserInterfaceEventPattern 1_BD.png

 

legend_xy.png

0 Kudos
Message 2 of 9
(4,735 Views)

This is not what I am trying to do.  I am trying to clear the names from the "History" on the drop down on the Plots tab in the Graph properties as shown in the original post.

0 Kudos
Message 3 of 9
(4,727 Views)
See my edit.
0 Kudos
Message 4 of 9
(4,720 Views)

You can also find useful free toolkits via the VIPM ( http://vipm.jki.net/ ). For example, the MGI Graph functions can save some programming time for you 😉 http://sine.ni.com/nips/cds/view/p/lang/en/nid/209753

 

Like you can easily specify an array of string for the Graph, and change all of them at once. Full control on the plot names:

 

MGI1.png

Message 5 of 9
(4,714 Views)

Thanks, this looks interesting.  Does this also remove the names if you shorten the list?  I can rename them in LV now, just can't remove them.

0 Kudos
Message 6 of 9
(4,708 Views)

I just do not understand why you need to remove a plot name, when you can just rename it. During runtime you can have full control on all strings, and also you can limit how many rows your Legend has. Why you need more actually?? The user cannot change the number of rows during runtime (your end-application should be always an EXE and not a VI), so why you care about the non-visible Legend entry names??

 

I do not think this is needed at all in your case, but there is another property, called "Legend: Plot minimum". This will limit the number of rows, and if you had plot names in the legend beyond the specified limit, it will indeed delete these names. But the result might look ugly, so you need to use this property alongside with the "LegNumRows" property node (or the MGI function which includes this property "Set Plot Legend Height?").

LegPlotMin.png

 

And I repeat again, you do not need to delete plot names, it just does not give you extra feature. You can limit the number of rows, and have full control on the strings. That is all you need...

Could you explain the actual reason why you need to delete Plot names?

0 Kudos
Message 7 of 9
(4,691 Views)

Despite if the plotnames of unused (empty) plots can be seen or not in the end application. I think the question should be why these plotnames remains still in memory when there is no data (XY or wave) for this plot.

0 Kudos
Message 8 of 9
(489 Views)

@Pieter_B wrote:

Despite if the plotnames of unused (empty) plots can be seen or not in the end application. I think the question should be why these plotnames remains still in memory when there is no data (XY or wave) for this plot.


becaus a good soul at NI seperated plot data and plot cosmetics, I guess.

 

 

for unused entries: it  often is sufficient to format manually for the first plot with a name but no data, which I prefer to be the last entry in the legend.

 

 

Spoiler


however it is sufficient to use plot.visible, I like to also use plot.name, plot.interpolation and plot.PointStyle
last-entry.png




by trial and error, it can be found, that

Plot.Interp=0 is the counter part to

alexderjuengere_0-1720773564058.png

 

Plot.PointStyle = 0 is the counterpart to

alexderjuengere_1-1720773664124.png

 

 

even if plot 2 does contain any data, when Plot.visible=false, the y-axis autoscaling ignores the data of plot 2, which I consider to be extremly useful

alexderjuengere_2-1720773802147.png

alexderjuengere_3-1720773860231.png

alexderjuengere_5-1720773994962.png

alexderjuengere_0-1720774500480.png alexderjuengere_0-1720774403364.png
0 Kudos
Message 9 of 9
(443 Views)