The script below extends Jim's, @txnelson, excellent suggestion, demonstrating how to set specific colors using JSL to modify the Legend Model.
Names Default to Here(1);
dt = open("$sample_data/big class.jmp");
gb = dt << Graph Builder(
show control panel(0),
Variables(
X( :age ),
X( :sex, Position( 1 ) ),
Y( :height ),
Color(
Transform Column(
"Transform[age]",
Character,
Nominal,
Formula( (Char( :age ) || " ") || :sex )
)
)
),
Elements( Bar( X( 1 ), X( 2 ), Y, Legend( 12 ) ) )
);
//note Item ID count begins with 0
gb << SendToReport(
Dispatch(
{},
"400",
ScaleBox,
{Legend Model(
//12,
Properties( 0, {Fill Color( 5 )}, Item ID( "12 F", 1 ) ),
Properties( 1, {Fill Color( 5 )}, Item ID( "12 M", 1 ) ),
Properties( 2, {Fill Color( 20 )}, Item ID( "13 F", 1 ) ),
Properties( 3, {Fill Color( 20 )}, Item ID( "13 M", 1 ) ),
Properties( 4, {Fill Color( 6 )}, Item ID( "14 F", 1 ) ),
Properties( 5, {Fill Color( 6 )}, Item ID( "14 M", 1 ) ),
Properties( 6, {Fill Color( 27 )}, Item ID( "15 F", 1 ) ),
Properties( 7, {Fill Color( 27 )}, Item ID( "15 M", 1 ) ),
Properties( 8, {Fill Color( 26 )}, Item ID( "16 F", 1 ) ),
Properties( 9, {Fill Color( 26 )}, Item ID( "16 M", 1 ) ),
Properties( 10, {Fill Color( 12 )}, Item ID( "17 F", 1 ) ),
Properties( 11, {Fill Color( 12 )}, Item ID( "17 M", 1 ) )
)}
)
);