Dear Community,
I would like to make a Graph Builder Script (want to put that as script in a new table) that contains a long list of y vars.
My first approach was to try expression manipulation, but this did not work as expected.
Can anyone please explain what would be a good way to write that script?
The example below also contains my current way, creating the GB instance, and adding y vars afterwards.
Thanks and best regards,
Names Default To Here( 1 );
cdt = Open( "$SAMPLE_DATA\Big Class.jmp" );
col_lst = cdt << get column names( Continuous, "String" );
gb_expr = Expr(
cdt << Graph Builder(
Size( 534, 450 ),
Show Control Panel( 0 ),
Variables( X( :age ), Y( :height ) ),
Elements( Position( 1, 1 ), Points( X, Y, Legend( 4 ) ) ),
Elements( Position( 1, 2 ), Points( X, Y, Legend( 5 ) ) )
)
);
// this does not work, Expr() does not accept comma separated items
// Substitute Into( gb_expr, Expr( Y( :height ) ), Expr( Y( :height ), Y( :weight ) ) );
// gb_obj = gb_expr;
// this works
// creating GB instance
gb_obj = cdt << Graph Builder(
Size( 534, 450 ),
Show Control Panel( 0 ),
Variables( X( :age )),
Elements( Position( 1, 1 ), Points( X, Y, Legend( 4 ) ) ),
Elements( Position( 1, 2 ), Points( X, Y, Legend( 5 ) ) )
);
// adding Y's
For Each( {ycol}, col_lst, Eval( Parse( Eval Insert( "gb_obj << variables( Y(:^ycol^ ))" ) ) ) );
// this I would like to create directly, w/o large parse/eval parts, that are bad for maintenance
my_target_expression = gb_obj << get script();
Georg