Multiple Column SwitchersIs there a way from preventing the same column from being picked when running multiple column switchers?
dt = open("$SAMPLE_DATA/Candy Bars.jmp");
biv = dt << Bivariate(
Y( :Saturated fat g ),
X( :Sugars g ),
SendToReport( Dispatch( {}, "Bivar Plot", FrameBox, {Frame Size( 593, 564 )} ) )
);
cs1 = biv << Column Switcher(
:Saturated fat g,
{:Name( "Serving/pkg" ), :Calories, :Total fat g, :Saturated fat g,
:Cholesterol g, :Sodium mg, :Carbohydrate g, :Dietary fiber g, :Sugars g,
:Protein g, :Vitamin A %RDI, :Vitamin C %RDI, :Calcium %RDI, :Iron %RDI}
);
cs2 = biv << Column Switcher(
:Sugars g,
{:Name( "Oz/pkg" ), :Calories, :Total fat g, :Saturated fat g,
:Cholesterol g, :Sodium mg, :Carbohydrate g, :Dietary fiber g, :Sugars g,
:Protein g, :Vitamin A %RDI, :Iron %RDI}
);
cs1 << Run;
cs2 << Run;
If you let this run long enough eventually cs2 catchs up with cs1 and throws an error. Since the columns are now the same, cs1 and cs2 lose their X/Y dependencies and now change both parameters. Thus X=Y is now always true.
Anyone know any work around?
Re: Multiple Column SwitchersHere's the buttons. This uses Schedule() to run the animation and setIcon() to get the graphic. the Write() statements should be replaced with the logic to change the variables. The OnClose sets up the visible window to close the scheduler window when the visible window is closed.

stop = 0; // animating state
loopFun = Function( {},
If( !stop,
Write( "go again\!n" ); // logic for animation
Schedule( .5, loopFun() ); // continue the animation 1/2 second later
)
);
New Window( "buttons",
<<ONCLOSE></ONCLOSE>
Re: Multiple Column SwitchersActually I got the formatting to work using Col List Box function. However, if anyone spent some time to try and create the custom play and stop button, YOU'D HAVE MY MANY THANKS!
Here's the code I quickly made for the custom switchers where xcolumns and ycolumns are the list of columns wanted for switching through, and dt is the data table.
xnlines = If(nitems(xcolumns) > 15, 15, nitems(xcolumns));
ynlines = If(nitems(ycolumns) > 15, 15, nitems(ycolumns));
vlb << Append(hlb = Hlistbox(VlistBox(
Text Box("Column X"),
columnswitcherX = Col List Box(width(250), maxSelected(1), nlines(xnlines)),
Text Box("Column Y"),
columnswitcherY = Col List Box(width(250), maxSelected(1), nlines(ynlines)))));
columnswitcherX << Append(xcolumns);
columnswitcherY << Append(ycolumns);
columnswitcherX << Set Selected(1);
columnswitcherX << Set Script(
bivcolx = columnswitcherX << get selected;
bivcoly = columnswitcherY << get selected;
try(interactivebiv << Delete Box);
hlb << Append(interactivebiv = dt << Bivariate( X( Column(dtinteractive, bivcolx) ), Y( Column(dtinteractive, bivcoly) ), Fit Line( {Line Color( {213, 72, 87} )} )) )
);
columnswitcherY << Set Script(
bivcolx = columnswitcherX << get selected;
bivcoly = columnswitcherY << get selected;
try(interactivebiv << Delete Box);
hlb << Append(interactivebiv = dt << Bivariate( X( Column(dtinteractive, bivcolx) ), Y( Column(dtinteractive, bivcoly) ), Fit Line( {Line Color( {213, 72, 87} )} )) )
);
columnswitcherY << Set Selected(1);
Re: Multiple Column Switchers<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />So, I've done this, but since the column names are rather long I can't get them to format correctly in my list box. Do you know how to make them appear as they do in the column switcher? (Firstpart....lastpart)?
Re: Multiple Column SwitchersThis is an irritating limitation of the column switchers. The workaround is to not use column switchers but implement the functionality yourself using list boxes (or combo boxes). Attach to these list boxes a script that will delete the bivariate plot and add create a new one based on the list box selections.