Sorry, this may not be very helpful. I had errors in the control chart code because the dataset isn't really suitable for a control chart and I didn't have time to debug with a proper data set. But you might be able to use this and debug the control chart code. I just tested it with the distribution platform instead of control chart and it worked ok. Keep in mind the col list box with the "on change()" code takes the place of the column switcher, so you don't need to add that to the control chart code. It just gets deleted and re-run every time you select a new parameter (column) from the col list box.
I didn't realize you also wanted plots. In that case a column switcher may have been more appropriate to use. There are ways to intercept that the selection has changed and you can run code to update your variables and re-plot. But this col list box() approach should also work ok.
names default to here(1);
dt = open("$SAMPLE_DATA\Big Class.jmp");
// New columns, update big class for y1, y2, y3
Local( {dt},
dt = Data Table( "Big Class" );
dt << New Column( "Y1",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Selected
) << New Column( "Y2",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Selected
) << New Column( "Y3",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Selected
) << Begin Data Update;
For Each Row(
dt,
:Y1 = Random Integer( 1, 40 );
:Y2 = Random Integer( 1, 40 );
:Y3 = Random Integer( 1, 40 );
);
dt << End Data Update;
);
colList = {"Y1", "Y2", "Y3"};
new window("Calculations",
hlb = hlistbox(
clb = col list box(dt, max selected(1),
on change(
try(calcVlb << delete());
currCol = clb << get selected();
currColName = char(currCol[1]);
z_yyy = Eval(column(currCol));// Eval( {currCol} );
z_xx = z_yyy << get values;
z_nnn = Eval( {:weight} ); //change back
z_nn = z_nnn[1] << get values;
z_rrr = Eval( {:age} ); //change back
z_Proportion = E Div( z_xx, z_nn );
z_Pbar = V Sum( z_xx ) / V Sum( z_nn );
z_sigma_est = Root( z_Pbar * (1 - z_Pbar) );
z_zvalue = E Mult( ((z_Proportion - z_Pbar) / z_sigma_est), Root( z_nn ) );
z_nr = N Row( z_zvalue );
z_mRList = {0};
z_m = z_zvalue;
z_m[1, 0] = [];
z_m = z_m |/ [0];
z_mr = Abs( z_m - z_zvalue );
z_nr = N Row( z_mr );
z_mr[z_nr, 0] = [];
z_SigmaZ = Mean( z_mr ) / 1.128;
z_KSigmaZ = 3 * z_SigmaZ;
show(currCol[1]);
show(z_Proportion);
hlb << append(
calcVlb = vlistbox(
textbox("Variables updated to column " || currCol[1]);
)
);
calcVlb << append(
Distribution(
Stack( 1 ),
Continuous Distribution(
Column( column(currCol[1])),
Horizontal Layout( 1 ),
Vertical( 0 ),
PpK Capability Labeling( 0 ),
Customize Summary Statistics(
Std Err Mean( 0 ),
Upper Mean Confidence Interval( 0 ),
Lower Mean Confidence Interval( 0 ),
N Missing( 1 ),
Range( 1 )
)
)
);
);
//Graph_exprall=Expr(
/*
hlb << append(
Graphall = Control Chart(
Sample Label( :weight ),
Sample Size( :age ),
KSigma(z_KSigmaZ),
Sort by Row Order( 1 ),
Chart Col( column(currCol[1]), P( Test Beyond Limits( 1 ), Limits Precision( 1 ), LCL( -3 ) ) ),
SendToReport(
Dispatch(
{},
"P of Y1",
OutlineBox,
{Set Title( "p'-chart, Proportion de défaut" )}
),
Dispatch(
{"P of Y1"},
"2",
ScaleBox,
{Format( "Fixed Dec", 12, 5 ), Min( -0.00025 ), Max( 0.0025 ),
Inc( 0.00025 ), Minor Ticks( 1 )}
),
Dispatch(
{"P of Y1"},
"1",
ScaleBox,
{Min( 0.5 ), Inc( 1 ), Minor Ticks( 0 )}
),
Dispatch(
{"P of Y1"},
"",
AxisBox,
{Add Axis Label( "Taux de défauts (srg)" )}
)));
//ColumnSwitcherObject = graphall << Column Switcher( :"Y1"n,{:"Y2"n, :"Y3"n, :"Y4"n, :"Y5"n ,"Y6"n ,"Y7"n});
// );
// On affecte le SigmaZ à la carte de controle
// SubstituteInto(Graph_exprall, Expr(TBD), z_KSigmaZ);
// Graph_exprall;
);
*/
)
)
)
);
clb << append(colList);
clb << set selected(1);