"remove variable" - just in front of my eyes, but I did not see it.
Many thanks
Names Default To Here( 1 );
dt = Current Data Table();
updatePlot2 = Function( {},
If( Length( clb << get selected ) == 0 | Length( clb2 << get selected ) == 0,
Print( "value missing" ),
gbr = Report( gb );
gbb = gbr[Graph Builder Box( 1 )];
var = (clb << get selected)[1];
groupByvar = (clb2 << get selected)[1];
allVariables = (gbb << get variables);
For Each( {var, idx}, Reverse( allVariables ),
gbb << remove variable( {var[1] , Role( Arg( var[2] ) )} )
);
gbb << add variable( {Column( var ), Role( "X" )} );
Eval(
Eval Expr(
gbb << add variable(
{Transform Column(
"Cumulative Probability[1=100%]",
Formula(
Col Rank( Expr( Name Expr( As Column( var ) ) ), Expr( Name Expr( As Column( groupByvar ) ) ),Excluded() ) / (
Col Number( Expr( Name Expr( As Column( var ) ) ), Expr( Name Expr( As Column( groupByvar ) ) ),Excluded() ) + 1)
)
), Role( "Y" )}
)
)
);
gbb << add variable( {Column( groupByvar ) , Role( "Overlay" )} ) ;
// SendToReport( Dispatch( {}, "Cumulative Probability[1=100%]", ScaleBox, {Scale( "Normal Probability" ), Format( "Best", 12 )} ) )
yAxis = ((gb << xpath( "//ScaleBox" ))[2]);
yAxis << {Scale( "Normal Probability" ), Format( "Best", 12 ), Title};
gb << getXML();
)
);
gbWindow = New Window( "Grouped Cumulative Probability",
hlb = H List Box(
V List Box(
Panel Box( "Value", clb = Col List Box( all, <<Set Data Type( "numeric" ), max selected( 1 ), updatePlot2() ) ),
Panel Box( "group by", clb2 = Col List Box( all, max selected( 1 ), updatePlot2() ) )
),
gb = dt << Graph Builder(
Size( 724, 560 ),
Show Control Panel( 0 ),
Elements( Points( X, Y, Legend( 7 ) ), Smoother( X, Y, Legend( 8 ), Method( "Savitzky-Golay" ), Lambda( 2 ) ) ),
SendToReport( Dispatch( {}, "Cumulative Probability[1=100%]", ScaleBox, {Scale( "Normal Probability" ), Format( "Best", 12 )} ) )
)
)
);
updates:
- remove & add variable (Y) deletes the normal probability setting on this axis
-> send the normal probability command again
- new problem: when running the "transform column" a second time and more often, jmp adds a counter to the name on the y axis: Cumulative Probability[1=100%] XX
-> Y axis no longer accessible by its original name
-> get the y axis title via xPath
- Excluded() added in the Col... functions to force jmp to ignore excluded() rows in the calculation.