Here is a script that works on JMP 13
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Blood Pressure.jmp" );
nw = New Window( "test",
ob = Outline Box( "Var Charts",
MyHLB = H List Box(
vc = Variability Chart( Y( :BP 8M ), X( :Subject ), Std Dev Chart( 0 ) ),
vc2 = Variability Chart( Y( :BP 8M ), X( :Subject ), Std Dev Chart( 0 ) )
)
)
);
cs = vc << Column Switcher( :BP 8M, {:BP 8M, :BP 12M, :BP 6M, :BP 8W, :BP 12W, :BP 6W, :BP 8F, :BP 12F, :BP 6F} );
nw["Var Charts"][listboxbox(1)] << set script(
VarList = {:BP 8M,:BP 12M,:BP 6M,:BP 8W,:BP 12W,:BP 6W,:BP 8F,:BP 12F,:BP 6F};
CurVar = word(2,char(vc2<<get script),":)");
Eval(
Substitute(
Expr( cs2 = vc2 << Column Switcher( __CurVar__, varlist )
),
Expr( __CurVar__ ), Parse( ":" || CurVar )
)
);
SwitchVar = Char((nw["Var Charts"][listboxbox(1)] << get selected)[1]);
For(i=1,i<=N items(VarList),i++,
If(SwitchVar==Char(VarList[i]),
Break()
)
);
nw["Var Charts"][listboxbox(2)]<<set selected(i);
cs2 << remove column switcher;
);
I tested it on JMP 11.1, and it works only for the first selection, then the link to the second Variability Chart gets lost. I assume this is a JMP bug that was fixed in JMP 12 or 13. However, all is not lost. What you can do, is to change my code to not generate a second Column Switcher and then use it to change the second chart, but instead, to delete the VC2 object completly, and then rebuild the chart and to append it to the MyHLB object.
Jim