I want to use graph builder script automatically to remove variables and add ones.
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
gb=Graph Builder(
Size( 604, 489 ),
Show Control Panel( 0 ),
Variables( X( "sex" ), Y( "height" ) ),
Elements(
Position( 1, 1 ),
Points( X, Y, Legend( 6 ) ),
Box Plot( X, Y, Legend( 7 ) ),
Line( X, Y, Legend( 8 ) )
),
Elements(
Position( 2, 1 ),
Points( X, Y, Legend( 9 ) ),
Box Plot( X, Y, Legend( 10 ) ),
Line( X, Y, Legend( 11 ) )
)
);
This script generates graph builder as follows. When I used " gb << Variables( X( "name" )); ", "name" is added in right of "sex" variables.

So I want to remove "sex" variable and add "name" with "remove" function script as follows. How can I script the "remove" function in Graph Buider?

Hi @Kwangki,
To remove a variable you'll need to send a message to the Graph Builder box. The following will remove "sex" from your plot:
//set a reference to the graph builder box
gbr = Report( gb )[Graph Builder Box( 1 )];
// remove by variable number
gbr << Remove Variable( 1 );
// or, remove by reference by name and role
gbr << Remove Variable( {:sex, Role( "X" )} );
Help > Scripting Index has a lot of useful messages under the GraphBuilderBox display box section:
I hope this helps!
@julian
Maybe if you had the graph script in an expression and you had y(:sex) as the first argument, then you could remove from the expression the first item, and then insert into the expression y(:age) at the first position. Then finally close the first window and re-evaluate it.