Column Switcher - Dynamically Add/Remove Reference LinesHello,
I have a Distribution platform using a column switcher being populated with columns from a list variable. Each of these columns represents a different quality parameter and thus has different limits which are gathered from an SQL query.
Is there a way to dynamically add reference lines to the Distribution platform as the column switcher changes columns? Right now, I have a SendToReport running in a loop for each item, but it ends up with the reference lines for all columns added at once, rather than just the two needed for each column.
An easy way to do this would be if the column switcher supported an "on column change" script - I could then remove the previous ref lines and add the new ones every time it changes. I couldn't find any scripting index info for if something like this is supported.
JMP version: 14
has_limits = {"item 1", "item 2", "item 3"};
dist = dt << Distribution(
Continuous Distribution( Column( "item 1" ), Horizontal Layout( 1 ), Always use column properties( 1 ), Vertical( 0 ), Outlier Box Plot( 0 ) ),
Column Switcher( "item 1", has_limits )
);
For( n = 1, n <= N Items( has_limits ), n++,
tempUCL = Col Max( Column( dt, has_limits[n] || "_UCL" ) );
tempLCL = Col Max( Column( dt, has_limits[n] || "_LCL" ) );
Eval(
Eval Expr(
dist << SendToReport(
Dispatch(
{Expr( has_limits[n] )},
"1",
ScaleBox,
{Add Ref Line( Expr( tempUCL ), "Dashed", "Medium Dark Red", "UCL", 1 ), Add Ref Line(
Expr( tempLCL ),
"Dashed",
"Medium Dark Red",
"LCL",
1
)}
)
)
)
);
); Automation and ScriptingRe: Column Switcher - Dynamically Add/Remove Reference LinesLooks like the column switch handler was not added until JMP 16.

Re: Column Switcher - Dynamically Add/Remove Reference LinesHere is a script that gets you partially there. For some reason, it removes the Axis values, but if you can try it on your data, you might be able to figure out how to get it to work correctly. The code was developed using JMP 14
names default to here(1);
dt = open("$SAMPLE_DATA/blood pressure.jmp");
has_limits = {"bp 8m", "bp 12m", "bp 6m"};
for(i=1,i<=nitems(has_limits),i++,
new column(has_limits[i] || "_UCL", values(matrix(quantile(.75,column(has_limits[i])<<GET values=""></GET>Re: Column Switcher - Dynamically Add/Remove Reference LinesThanks for this. I haven't figured out the missing axis values yet, it's very strange (also shows a "loading" cursor) but it's at least a step in the right direction.
Re: Column Switcher - Dynamically Add/Remove Reference LinesA work around might be to run your JSL, and then go to the Red Triangle in the report output window, and select Save Script. Save it to a script window and then run the script. My testing shows that the code that JMP creates has the missing X Azis Labels.
I have submitted the bug to JMP Support.
Re: Column Switcher - Dynamically Add/Remove Reference LinesOther workaround that seems to work is to add padding (maybe something is being pushed on top of axisbox?)

or enable Tick Marks inside Graph Frame from axis settings, though this makes the graph a bit weird looking and I think you might want to also enable grid lines

