Using the Position element on the Add Graphics Script message one can explicitly set the order a graphic element is going to be displayed on the graph. Below are 2 Graph Builder plots with the only thing changed is reversing the Add Graphics Script position from 6 to 5 and then to 5 to 6.
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/big class.jmp" );
gb = Graph Builder(
Variables( X( :weight ), Y( :height ) ),
Elements( Points( X, Y, Legend( 6 ) ), Smoother( X, Y, Legend( 7 ) ) ),
show control panel( 0 )
);
Report( gb )[axisbox( 1 )] << Min( 25 );
fgb = Report( gb )[framebox( 1 )];
fgb << Add Graphics Script(
6,
Description( "" ),
Text Color( "black" );
Text( right Justified, {45, 60}, "r: 0.0072" );
);
fgb << Add Graphics Script(
5,
Description( "" ),
Fill Color( "red" );
Transparency( .5 );
Polygon( [10 30 90], [88 22 44] );
);
gb = Graph Builder(
Variables( X( :weight ), Y( :height ) ),
Elements( Points( X, Y, Legend( 6 ) ), Smoother( X, Y, Legend( 7 ) ) ),
show control panel( 0 )
);
Report( gb )[axisbox( 1 )] << Min( 25 );
fgb = Report( gb )[framebox( 1 )];
fgb << Add Graphics Script(
5,
Description( "" ),
Text Color( "black" );
Text( right Justified, {45, 60}, "r: 0.0072" );
);
fgb << Add Graphics Script(
8,
Description( "" ),
Fill Color( "red" );
Transparency( .5 );
Polygon( [10 30 90], [88 22 44] );
);
Jim