I have worked my example a little further. It now dynamically changes the axis when the data filter is changed. The data filter is now a global filter, so the code can pick up the changes in the selection in the data table
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA\semiconductor capability.jmp" );
f = Function( {a},
// Capture the LCL and UCL from the Limit Summaries Outline Box in the Report Output
myLCL = (Report( ccb )["NPN1 Limit Summaries"][Table Box( 1 )][2] << get)[1];
myUCL = (Report( ccb )["NPN1 Limit Summaries"][Table Box( 1 )][4] << get)[1];
// Apply back to the Control Chart the new axis settings
Report( ccb )[Axis Box( 3 )] << Min( myLCL );
Report( ccb )[Axis Box( 3 )] << Max( myUCL );
);
rs = dt << make rowstate handler( f );
New Window( "Working Example",
Data Filter Context Box(
H List Box(
dt << Data Filter( Add Filter( Columns( :SITE ) ),Mode(select(1),show(1),include(1)) ),
Platform(dt,
ccb = Control Chart Builder(
Size( 534, 453 ),
Show Control Panel( 0 ),
Variables( Y( :NPN1 ) ),
Chart( Position( 1 ), Limits ),
Chart( Position( 2 ) ),
SendToReport(
Dispatch(
{},
"NPN1",
ScaleBox,
{Min( 96.6346153846154 ), Max( 131.634615384615 ), Inc( 5 ), Minor Ticks( 0 ),
Add Ref Line( 104.412948990151, "Solid", "Blue", "LSL", 1 ),
Add Ref Line( 131.893493064355, "Solid", "Blue", "USL", 1 ),
Add Ref Line( 118.153221027253, "Solid", "Blue", "Target", 1 )}
)
)
)
)
)
)
);
Jim