Thanks , this is working, but ... Mabey you can help with the following:
i have this code , when i play with the legend buttons only all is working, but when i start using the filter it opens a bunch of border boxes.. i believe it comes from "automatic recalc" and for some reason the border boxes are stuck in memory...
have any idea how to solve this?
//obj << show tree structure
//Report( obj )[Outline Box( 1)] << Delete;
//Begin Script;
CreateTrendPlot = Function( {},
// Create and return the trend plot with legend
obj = Bivariate(
Y( :height ),
X( :weight ),
Automatic Recalc( 1 ),
Group By( :sex ),
Fit Spline( 0.1, standardized ),
SendToReport(
Dispatch( {}, "Bivar Plot", FrameBox,
{Row Legend(
age,
Color( 0 ),
Color Theme( "" ),
Marker( 0 ),
Marker Theme( "" ),
Continuous Scale( 0 ),
Reverse Scale( 0 ),
Excluded Rows( 0 )
), Row Legend(
age,
Color( 0 ),
Color Theme( "" ),
Marker( 0 ),
Marker Theme( "" ),
Continuous Scale( 0 ),
Reverse Scale( 0 ),
Excluded Rows( 0 )
)}
),
Dispatch( {}, "", Picture Box( 3 ), {Visibility( "Collapse" )} ),
Dispatch( {}, "", Picture Box( 2 ), {Visibility( "Collapse" )} )
)
)
);
CreateVarPlot = Function( {},
obj2 = Variability Chart(
Y( :height ),
X( :age, :sex ),
Connect Cell Means( 1 ),
Show Group Means( 1 ),
Show Grand Mean( 1 ),
Show Grand Median( 1 ),
Std Dev Chart( 0 ),
Points Jittered( 1 ),
Show Box Plots( 1 ),
Mean Diamonds( 1 ),
SendToReport(
Dispatch( {}, "2", ScaleBox,
{Min( 5000 ), Max( 2000 ), Inc( 100 ), Minor Ticks( 1 ),
Add Ref Line( 0, "Dotted", "Medium Light Gray", "", 1 ),
Add Ref Line( 3200, "Solid", "Black", "TGT", 4 ), Add Ref Line(
4200, "Dashed", "Medium Dark Red", "UCL", 4
), Add Ref Line( 2200, "Dashed", "Medium Dark Red", "LCL", 4 )}
),
Dispatch( {""}, "", NomAxisBox, {Rotated Tick Labels( 0 )} )
)
)
);
// Open Data Table: Big Class.jmp
// → Data Table( "Big Class" )
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
color = {"age", "sex"};
marks = {"age", "sex"};
boxPlot = {"age", "sex", "name"};
// Initial nlevels is the number of levels of 'age', as it is the first by-group used.
cur_col = "age";
cur_mar = "age";
// Creating the legend. For each selection, the previous spline fits are removed, then
// new ones are generated.
color_legend = Panel Box( "Choose Color",
legend1 = Radio Box(
color,
<<Set Function(
Function( {self},
Report( obj )[Border Box( 2 )] << Delete;
Report( obj )[Border Box( 2 )] << Delete;
cur_col = self << Get Selected;
Report( obj )[FrameBox( 1 )] << {Row Legend(
Eval( cur_col ),
color( 1 ),
Color Theme( "JMP Default" ),
Marker( 0 ),
Marker Theme( "" )
), Row Legend(
Eval( cur_mar ),
color( 0 ),
Color Theme( "" ),
Marker( 1 ),
Marker Theme( "Standard" )
)};
)
)
),
);
mark_legend = Panel Box( "Choose Mark",
legend1 = Radio Box(
color,
<<Set Function(
Function( {self},
Report( obj )[Border Box( 2 )] << Delete;
Report( obj )[Border Box( 2 )] << Delete;
cur_mar = self << Get Selected;
Report( obj )[FrameBox( 1 )] << {Row Legend(
Eval( cur_col ),
color( 1 ),
Color Theme( "JMP Default" ),
Marker( 0 ),
Marker Theme( "" )
), Row Legend(
Eval( cur_mar ),
color( 0 ),
Color Theme( "" ),
Marker( 1 ),
Marker Theme( "Standard" )
)};
)
)
),
);
box_list = Panel Box( "BoxPlots",
boxes = Check Box(
boxPlot,
<<Set Function(
Function( {self},
cur_bp = self << Get Selected;
)
)
)
);
// Fitting the initial Bivariate fit with 'age' as the by-group, adding the legend
// to control the selections.
nw = New Window( "Bivariate",
H List Box(
V List Box(
dt << Data Filter(
Location( {0, 0} ),
Mode( Show( 1 ), Include( 1 ) ),
Add Filter( columns( :sex ), Display( :sex, Size( 160, 60 ), List Display ) )
),
color_legend,
mark_legend
),
CreateTrendPlot(),
CreateVarPlot(),
box_list
)
);
//Report(obj)[Outline Box(3)] << Visibility("collapse");
Report( obj )[framebox( 1 )] << add graphics script(
oboxes = obj << xpath( "//OutlineBox" );
For( i = 1, i <= N Items( oboxes ), i++,
box = oboxes[i];
If( Contains( box << get title, "Smoothing Spline" ),
box << visibility( "collapse" )
);
);
);