Subscribe Bookmark RSS Feed

Automatic Recalc(1) causes old legends to reappear after deleting parent border box.

eigenmetricsoli

Community Trekker

Joined:

Jun 26, 2014

In JMP 11 I am writing a plotting application that allows the user to customize the legends by selecting the grouping column that defines the row states. This requires deleting the old legend (by deleting the parent border box) and adding in a new legend.  However I have found that if automatic recalc is set on the bivariate or variability platforms (I hen't tested other platforms), that this will causave a copy of the old legend to re-appear in addition to the new one, when the new one is generated with the FrameBox<<Row Legend command.  As more legends are selected, all of the old legends show up.  I need automatic recalc on to recalculate trendlines and statistics depending on how data is filtered.  Is there a workaround for this?  Is there a better way to delete the legend than to say BorderBox<<Delete?  I know from the gui you can right click and say "Remove" to a legend...is there a script command equivalent for this?

I have also looked at using the <<color by column on the data table with the "create window with legend" option, and then inserting the legend (table box with strincolbox child) into the plot directly, but this causes the legend to lose its row selection functionality and I cannot seem to add it back in (there must be hidden methods for the table which I cannot access because I also don't know how to put markers into a tablebox in order to do a custom legend).

1 ACCEPTED SOLUTION

Accepted Solutions
Solution

Oh what I ended up doing eventually is using the dt<<Make Rowstate Handler function to handle rowstate change events, very useful feature.  Whenever the excluded state changes I throw off a function to update my plots.

3 REPLIES
eigenmetricsoli

Community Trekker

Joined:

Jun 26, 2014

Ok so I came up with a simple workaround:  I turned off automatic recalc on the platform object in question (by using <<Get Scriptable Object on the selected table), updated the legend, then turned automatic recalc back on.  What's weird is that I wasn't able to recreate this bug using a dummy script on a bivariate with automatic recalc turned on and legends added and deleted repeatedly.

eigenmetricsoli

Community Trekker

Joined:

Jun 26, 2014

So I have been playing around alot with it and I eventually was able to recreate this behavior, even using one of the built-in datasets.  The following code will cause some kind of memory leak which will cause JMP to crash.

Here is how you recreate the bug:

(1)  create a platform inside a window that has automatic recalc set to 1

(2) add some legends

(3) exclude some rows

(4) add in another legend..even after deleting one or both of the original legend/s and JMP will freeze

The bug manifests itself as gradually increasing memory usage (~10 MB/s) by jmp as it works through some infinite memory leak.

This bug can be avoided by setting the excluded state to 0 for all rows in the table (i.e. For Each Row(Excluded(RowState()) = 0).

Another quirk that is turned on by automatic recalc is the fact that legends will not delete unless there is a forced time delay before deleting the legend after it is created.  If automatic recalc is set to 0 then the deletion happens without a problem.

//code that crashes

Names Default To Here( 1 );

Try(CLose(dt,nosave));

dt = Open( "$SAMPLE_DATA/Big Class.jmp",invisible );

dt<<clear row states;

obj = NewWindow("test",biv_container = HListbox(biv = Bivariate( Y( :weight ), X( :height ),Automatic Recalc(1))));

/*

data_filter_container = ScrollBox(Size(200,500),data_filter = dt << Data Filter( Add Filter( columns( :Sex, :Age, :Name, :Height, :Weight ) )));

data_filter<<Mode( Select( 1 ), Show( 1 ), Include( 1 ) );

obj[OutlineBox("Bivariate Fit of weight By height")]<<Sib Prepend(data_filter_container);*/

obj[OutlineBox("Bivariate Fit of weight By height")][FrameBox(1)]<<Row Legend(:weight,Color(1),Marker(0));

obj[OutlineBox("Bivariate Fit of weight By height")][FrameBox(1)]<<Row Legend(:sex,Color(0),Marker(1));

obj[OutlineBox("Bivariate Fit of weight By height")][FrameBox(1)]<<Marker Size(6);

dt<<Select Where(:sex == "F")<<Exclude;

//Show(For Each Row(Excluded(RowState()) = 0));

//dt<<Select Where(:sex == "F")<<Unexclude;

wait(0.1);//forced time delay necessary to delete the color legend

obj[OutlineBox("Bivariate Fit of weight By height")][BorderBox(2)]<<Delete;

obj[OutlineBox("Bivariate Fit of weight By height")][FrameBox(1)]<<Row Legend(:height,Color(1),Marker(0));

Solution

Oh what I ended up doing eventually is using the dt<<Make Rowstate Handler function to handle rowstate change events, very useful feature.  Whenever the excluded state changes I throw off a function to update my plots.