[JMP12 JSL for Graph Builder] Failed to add new element into each positionHi, currently I hope to add new element into each position for my chart, chart with one X-axis and several Y-axes;
so I use the code below:
For(jj = 1, jj <= 20, jj++,
gb << Elements( Position( 1, jj ), Points( X, Y , Legend( 1 )), Smoother( X, Y , Legend( 2 ) ) );
);
However, the chart created with this code still with 1 elements only, I right click the chart there are 2 elements shown though.
When I perform redo analyse, the new chart created as expected but I don't know why.
Since I am now using JMP12, is it caused by the dated version?
WindowsRe: [JMP12 JSL for Graph Builder] Failed to add new element into each positionI don't have access to JMP12 to test this, but it might be enough if you evaluate jj
Eval(
EvalExpr(
gb << Elements(Position(1, Expr(jj)), Points(X, Y, Legend(1)), Smoother(X, Y, Legend(2)))
)
);
Re: [JMP12 JSL for Graph Builder] Failed to add new element into each positionI tested the JSL under JMP 12.2 and in order to get the Legend to appear correctly I needed to make a minor change.

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/big class.jmp" );
dt << New Column( "Ratio", formula( :Height / :Weight ) );
gb = Graph Builder( Variables( X( :age ), Y( :height ), Y( :weight ), Y( :ratio ) ) );
For( jj = 1, jj <= 20, jj++,
Eval(
Eval Expr(
gb << Elements(
Position( 1, Expr( jj ) ),
Points( X, Y, Legend( Expr( jj * 2 ) ) ),
Smoother( X, Y, Legend( Expr( jj * 2 + 1 ) ) )
)
)
)
);
Re: [JMP12 JSL for Graph Builder] Failed to add new element into each positionand for later versions of JMP?
Re: [JMP12 JSL for Graph Builder] Failed to add new element into each positionThanks for your help! After several tries on your solution it worked but not for every time. So I modified my code and found that it may be induced by the code used for changing the marker size/mode.
TotalFrame = gb << xpath("//FrameBox");
For(ii = 1, ii <= N Items(TotalFrame), ii++,
gb << SendToReport(
Dispatch( {}, "Graph Builder", FrameBox( ii ), {Marker Size( 2 ), Marker Drawing Mode( "Outlined" )} ),
);
);
For( jj = 1 ...
After swithing the position, the chart was drawn currently:
For( jj = 1 ...
TotalFrame...
I don't know the reason though the problem has been solved...
Thanks again!