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.