I can always add Legend to a Bivariate chart by using Report and FrameBox (see below), but how can i remove the added Legends?
Report(biv_chart)[FrameBox(1)] << Row Legend(
Color( 0 ),
Color Theme( "" ),
Marker( 0 ),
Marker Theme( "" ),
Continuous Scale( 0 ),
Reverse Scale( 0 ),
Excluded Rows( 0 )
dt = Open("$SAMPLE_DATA/Big Class.jmp");
biv = Bivariate(Y(:weight), X(:height));
Report(biv)[FrameBox(1)] << Row Legend(:weight);
//Report(biv) << show tree structure;
//I used the tree structure to figure out the next line that removes the legend
((Report(biv)[FrameBox(1)] << parent) << sib) << delete;
I explained in more details my problem (i replied to my original post), the method you suggested will not work in the long run for what i need. deleting a display box will indeed remove it form the screen of the user, but if you update something in the chart (i am also using Data Filter object) then all the alegedly removed Row Legends will be re-displayed together because the Legends were not removed completely (watch the Bivariate script after a deletion and you will see that in the Bivariate script the Legend part is still there, if you use the mouse to remove the Legend that part will not be part of the Bivariate script anymore).
So I am looking for a way to remove the Legend using script to be exactly how you remove it with the Mouse Right-Click (is it possible?)
Some explanation about what i mean in this discussion:
if you create a Bivariate chart and display it, you can see and copy the script from it (click on red triangular --> Script...).
Once you add a Row Legend to the Bivariate, you can watch its script again and see how the Legend is now part of the Bivariate script.
If you manually use the mouse Right-Click on the Legend and click "Remove" then the Legend script disappears entirely from the Bivariate Script.
But if you write a script to delete the Row Legend by deleting one of the display boxes holding the Legend ( Report(biv_chart)[BorderBox(2)]<<Delete , or OwnerBox(1), or TableBox(1) ) it will only delete the display currently in action. After deleting the display box you can copy the script from the Bivariate and see that it will still have the Legend part embedded in it, which is different form the way by removing the Legend with the Mouse Right-Click.
I think that this fact is responsible for my problem in which I use interactive Bivariate chart with control buttons and when the chart will need to be updated it will then add up all the historical Row Legends I added because those were never removed from the Bivariate Script (if I am manually removing them with the mouse instead of script this problem is not occurring), so i am looking for away to remove the Row Legend form the Bivariate that will be equivalent to the way you use your mouse Right-Click and "Remove" the Legend.
Does anyone knows how to completely remove the Row Legend from a Bivariate chart?
so that the Bivariate script will no longer include the Legend part embedded in it?
I think you miss understand what is happening when you add a row legend.
All this is doing is adding color and marker states to each row of the data table based on values of a certain column. It then adds a STATIC display showing a legend or key to understand the color-marker pairing. When you right-click >> remove all you are doing is deleting this STATIC display. Which is the same as described above. If you want to remove the coloring and markers you can simply use 'dt << clear row states' where dt is the data table used to create the bivariate plot.
However, if you are just deleting the row legend to add another this isn't necessary. Since adding an additional row legend will update all the row states. Thus deleting the previous legend/key should suffice. This is true EXCEPT where your data table has missing values. If you don't have flush data, then be sure to clear the row states between each row legend command. (I'd prefer to avoid this since clearing row states also clears things like hide/exclude but will be necessary if you have missing data).