Very minor changes were required to produce the graph you want.
The JSL produced by the initial script that runs the Graph Builder is
Graph Builder(
Show Control Panel( 0 ),
Variables( X( :lot_id ), Y( :NPN1 ), Y( :IVP1 ), Y( :PNP4 ), Y( :NPN4 ) ),
Elements( Position( 1, 1 ), Points( X, Y, Legend( 1 ) ) ),
Elements( Position( 1, 2 ), Points( X, Y, Legend( 2 ) ) ),
Elements( Position( 1, 3 ), Points( X, Y, Legend( 3 ) ) ),
Elements( Position( 1, 4 ), Points( X, Y, Legend( 4 ) ) )
);
When one looks at the JSL that created the above Graph Builder code, only 2 sections do the real work.
gb_expr = Expr(Graph Builder(
Show Control Panel(0)
));
Creates the shell for the Graph Builder
Graph Builder(
Show Control Panel( 0 ),
);
The JSL
variables_expr = Expr(Variables(X(:lot_id)));
For Each({y_col}, y_values,
temp_expr = Expr(Y());
Insert Into(temp_expr, Name Expr(AsColumn(dt, y_col)));
Insert Into(variables_expr, Name Expr(temp_expr));
);
Generates the code
Variables( X( :lot_id ), Y( :NPN1 ), Y( :IVP1 ), Y( :PNP4 ), Y( :NPN4 ) )
Then,
Insert Into(gb_expr, Name Expr(variables_expr));
Inserts the Variables( X(.................) JSL into the Graph Builder() code
Graph Builder(
Show Control Panel( 0 ),
Variables( X( :lot_id ), Y( :NPN1 ), Y( :IVP1 ), Y( :PNP4 ), Y( :NPN4 ) )
);
Now what needs to be done, is to build
Elements( Position( 1, 1 ), Points( X, Y, Legend( 1 ) ) ),
Elements( Position( 1, 2 ), Points( X, Y, Legend( 2 ) ) ),
Elements( Position( 1, 3 ), Points( X, Y, Legend( 3 ) ) ),
Elements( Position( 1, 4 ), Points( X, Y, Legend( 4 ) ) )
The JSL that creates these lines of code is
For Each({y_col, idx}, y_values,
Eval(EvalExpr(
Insert Into(gb_expr,
Name Expr(Elements(Position(1, Expr(idx)), Points(X, Y, Legend(Expr(idx)))))
)
));
);
It loops through each of the Y values and creates the Elements line one at a time, and inserts it into the Graph Builder() JSL.
Finally,
Eval(gb_expr);
Runs the completed Graph Builder JSL
So now, what needs to be changed.
Basically if one looks at what is different between the JSL the original script creates, and the saved JSL from the Graph Builder with the new modifications, in the original script output, the Elements structure is
Elements( Position( 1, 1 ), Points( X, Y, Legend( 1 ) ) )
Where the Saved code's Elements section has a section for both Points, and Box Plot
Elements(
Position( 1, 1 ),
Points( X, Y, Legend( 1 ), Jitter( "None" ) ),
Box Plot( X, Y, Legend( 5 ), Jitter( "None" ) )
)
Therefore, all that needs to be changed is to add this second section to the code that generates the Elements section.
For Each( {y_col, idx}, y_values,
Eval(
Eval Expr(
Insert Into(
gb_expr,
Name Expr(
Elements(
Position( 1, Expr( idx ) ),
Points( X, Y, Legend( Expr( idx ) ), jitter( "None" ) ),
Box Plot( X, Y, Legend( Expr( N Items( y_values ) + idx ), jitter( "None" ) ) )
)
)
)
)
)
);
If you put all of this together, the new script is
Names Default To Here( 1 );
Clear Log();
dt = Open( "$sample_data\Semiconductor Capability.jmp" );
y_values = {"NPN1", "IVP1", "PNP4", "NPN4"};
variables_expr = Expr(
Variables( X( :lot_id ) )
);
For Each( {y_col}, y_values,
temp_expr = Expr( Y() );
Insert Into( temp_expr, Name Expr( As Column( dt, y_col ) ) );
Insert Into( variables_expr, Name Expr( temp_expr ) );
);
gb_expr = Expr(
Graph Builder( Show Control Panel( 0 ) )
);
Insert Into( gb_expr, Name Expr( variables_expr ) );
For Each( {y_col, idx}, y_values,
Eval(
Eval Expr(
Insert Into(
gb_expr,
Name Expr(
Elements(
Position( 1, Expr( idx ) ),
Points( X, Y, Legend( Expr( idx ) ), jitter( "None" ) ),
Box Plot( X, Y, Legend( Expr( N Items( y_values ) + idx ), jitter( "None" ) ) )
)
)
)
)
)
);
Show( Name Expr( gb_expr ) );
Eval( gb_expr );
Jim