09-15-2016 03:08 PM
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?
09-15-2016 03:35 PM - edited 09-15-2016 03:53 PM
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:
09-15-2016 03:53 PM
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.
09-15-2016 03:59 PM
09-15-2016 04:17 PM
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:
09-15-2016 04:33 PM
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.
09-15-2016 11:46 PM
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?").
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?
07-11-2024 02:44 AM
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.
07-12-2024 03:51 AM - edited 07-12-2024 03:59 AM
@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.
however it is sufficient to use plot.visible, I like to also use plot.name, plot.interpolation and plot.PointStyle
by trial and error, it can be found, that
Plot.Interp=0 is the counter part to
Plot.PointStyle = 0 is the counterpart to
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
|
|