Discussion:
Delete plot definitions from chart
(too old to reply)
Thoric
2008-07-23 09:40:13 UTC
Permalink
Hi all. I'm struggling with a chart to which I programmatically add and
remove plots. When I wire an empty array to the Value property it
clears the plot, as expected, but each of the plot definitions still
remains. This can be seen by simply inspecting the legend, snapshot
below. How can I remove these definitions?
<img src="Loading Image...">
I've read that this is supposed to be a good thing, but it's not
for me. I programmatically enlarge and shrink the legend to show the
number of plots, so as the user clicks "Add Data to Plot" the legend
size increases. This works fine, but once the legend reaches ten elements deep, I turn on the vertical scroll bar and keep the legend size constant. But the vertical scroll bar allows the user to see
all previously defined (yet empty) plots, which looks terrible! Below
are three more snapshots, showing 4 defined plots, 9 defined plots and
13 defined plots. You can see that in the third snapshot where only the
first 10 are in the legend and the scrollbar is on, the user will be able to see
lots more previously defined plot entries by scrolling down. How
can I programmatically remove these definitions?<img src="Loading Image...">
Message Edited by Thoric on 07-23-2008 10:29 AM


legend1.jpg:
http://forums.ni.com/attachments/ni/170/343219/1/legend1.jpg


legend5.jpg:
http://forums.ni.com/attachments/ni/170/343219/2/legend5.jpg
MikeS81
2008-07-23 11:10:06 UTC
Permalink
Hi Thoric,
you can use a property node to select the active plot and change the property "visible" of this one. So you can hide some plots.
Hope it helps.Mike
Thoric
2008-07-23 11:10:07 UTC
Permalink
Thanks for the input Mike, but this hasn't worked for me :smileysad:See the snapshot - the Visible flag has simply made the plot symbol in the legend invisible, but it's still defined. You can see from here that I've added up to "test 14" in the plot, but there any many more in the legend. Right down to 27 if I scroll all the way. I really do need these to be erased. Is there really no way to un-define them at all? :smileysad:<img src="Loading Image..."> Message Edited by Thoric on 07-23-2008 12:01 PM


legend6.jpg:
http://forums.ni.com/attachments/ni/170/343234/1/legend6.jpg
Norbert B
2008-07-23 11:10:08 UTC
Permalink
Thoric, could you please post the VI?Norbert
MikeS81
2008-07-23 11:10:08 UTC
Permalink
Hi Thoric,
so you want to clear the chart completly, is that correct? Can you show the code, how you dynamically add new plots?
Mike
Thoric
2008-07-23 11:40:05 UTC
Permalink
Hi, Initially I need to clear the graph completely, but during program execution the user will be able to add and remove plots, any number of plots, to the chart. Therefore my legend grows and shrinks as the user adds and removes plots. When the chart has more than 10 plots, the legend needs to be the size of 10, but have the vertical scrollbar on so the user can scroll through the legend entries. The problem is, as shown above, that there are far more entries in the legend when the vertical scrollbar is on than the user has plotted.See this attachment, which clears the chart, then adds up to 20 plots to the chart one at a time. When ten are reached, the legend scrollbar is made visible, and suddenly there are then up to 27 plots in the legend. I need all un-used plot definitions to be deleted so the user can't see these entries.LV 8.5.1, Win XP Pro


cell_plot_tester2.vi:
http://forums.ni.com/attachments/ni/170/343239/1/cell_plot_tester2.vi
MikeS81
2008-07-23 12:10:07 UTC
Permalink
Hi Thoric,
the inner for loop is the number of plots! You write more points to your chart as you want. See the attached example pease.
&nbsp;
Hope it helps.
Mike


Unbenannt 7_LV80.vi:
http://forums.ni.com/attachments/ni/170/343247/1/Unbenannt 7_LV80.vi
Thoric
2008-07-23 12:40:09 UTC
Permalink
Thanks for the vi Mike, but I don't think it helps me. You've replaced my waveform graph with a scope chart, and are using the History property to remove all defined data. My graph has no History property to call, so I can't do this.I see that I used the wording chart above in my thread, where I actually meant graph, so maybe this has led to the confusion?Also, when I call your vi a second time, with a reduced number of plots, it draws nothing? Although I do concede that the legend has the correct number of elements in it.Can I mimic this History property somehow???
MikeS81
2008-07-23 12:40:13 UTC
Permalink
Hi Thoric,
sorry for the mistake. Please see this attachment. The minimum plots shown was 27 because you defined it in the graph properties. I think this should now work, like you need it.
&nbsp;
Mike


cell_plot_tester2_LV80.vi:
http://forums.ni.com/attachments/ni/170/343267/1/cell_plot_tester2_LV80.vi
Thoric
2008-07-23 13:10:06 UTC
Permalink
Mike,I'm now quite confused. Your attachment works. Just as I need it to. I made the very same changes to my copy of my code, and it doesn't work.If I visually compare your cell_plot_tester2_LV80.vi to my cell_plot_tester2.vi, there are no differences, yet mine still fails to clear the unwanted plots from the legend.Did you replace the chart in my example? Was it corrupt perhaps? Or is there some magic here??? :smileysurprised:<img src="Loading Image..."> Message Edited by Thoric on 07-23-2008 02:03 PM


MinevsYours.jpg:
http://forums.ni.com/attachments/ni/170/343274/1/MinevsYours.jpg
MikeS81
2008-07-23 13:10:07 UTC
Permalink
Hi Thoric,
as i said, you have defined 27 plots in the graph properties. Open the properties and go to the plot page. Delete all plots from 12 to 27, you can do it if you clean the name control.
Mike
Thoric
2008-07-23 13:40:07 UTC
Permalink
I know I have 27 defined plots - that's precisely what I'm trying to delete. If I go to Properties -&gt; Plot and replace each plot name with a blank, they don't go away. They just have no plot name anymore.<img src="Loading Image..."> If I programmatically do the same thing, they still remain. There simply seems to be no way to remove defined plots - at all! Programmatically or otherwise! LV is starting to get me mad :smileymad:<img src="Loading Image..."> Message Edited by Thoric on 07-23-2008 02:16 PM


legend9.jpg:
http://forums.ni.com/attachments/ni/170/343283/1/legend9.jpg


clearnamestr.jpg:
http://forums.ni.com/attachments/ni/170/343283/2/clearnamestr.jpg
MikeS81
2008-07-23 13:40:08 UTC
Permalink
Hi Thoric,
i think you have to do it manually. If you go to the properties and clear the names for all from 12 to 27, then they are deleted. Thats the way i did it. :smileyhappy:
Mike
Thoric
2008-07-23 13:40:08 UTC
Permalink
This is what I have now, having cleared the plot name entries in the Properties dialogue manually. Clearly they still exist. I just can't shift them! :smileysad:<img src="Loading Image..."> Message Edited by Thoric on 07-23-2008 02:22 PMMessage Edited by Thoric on 07-23-2008 02:23 PM


properties.jpg:
http://forums.ni.com/attachments/ni/170/343287/1/properties.jpg
MikeS81
2008-07-23 13:40:09 UTC
Permalink
Hi Thoric,
but after closing the propertie window they should be deleted.
Mike
&nbsp;
[EDIT] If you simply change the number from 11 to 12 and back (on the first page) then all others are also gone :smileyhappy: [/EDIT]Message Edited by MikeS81 on 07-23-2008 03:28 PM
Thoric
2008-07-23 13:40:11 UTC
Permalink
Nope. I've even closed down LV. Restarted LV and loaded the vi. They're still there, as in that screenshot above. Out of curiosity I saved the vi as version 8.0, and loaded it into LV 8.0. In there, I removed the string entries, and indeed they DID disappear.It would seem there are differences between 8.0 and 8.5.1 (which I'm using). Clearly in 8.5.x you are allowed plot entries with a blank string, whereas in 8.0 a blank string can be used to indicate the plot is no longer needed and hence LV deletes it.
MikeS81
2008-07-23 13:40:12 UTC
Permalink
MikeS81 wrote:
&nbsp;
[EDIT] If you simply change the number from 11 to 12 and back (on the first page) then all others are also gone :smileyhappy: [/EDIT]


Hi Thoric,
this works.
Mike
Thoric
2008-07-23 13:40:12 UTC
Permalink
Aha! That worked!!!! Brilliant! Your edit suggestion of changing the number from 11 to 12 worked perfectly! It removed the plots with no name! How can I do this programmatically though?????
MikeS81
2008-07-23 13:40:13 UTC
Permalink
Hi Thoric,
i think you don“t need it programmatically. You can set it to one in the properties, but if you set it programmatically to more, you will also see all specified plots.
Mike
Thoric
2008-07-23 14:40:11 UTC
Permalink
You are right. I do not need to worry as long as I set the defined plots to none. For those interested, see the attachment. The vi will draw 18 lines and auto-manage the legend. Click Remove 16 plots to remove all but the last two. The legend will shrink automatically.This works perfectly for me! Thank you very much for your assistance Mike, couldn't have done it without you!(Unfortunately I can't rate your messages, I don't have enough posts yet apparently :smileysad: )


cell_plot_tester2.vi:
http://forums.ni.com/attachments/ni/170/343333/1/cell_plot_tester2.vi
Loading...