I usually do these with the help of some sort XPath if I cannot easily build it into the graph builder script, as my reports tend to be quite dynamic
Names Default To Here(1);
dt = open("$SAMPLE_DATA/Big Class.jmp");
gb = dt << Graph Builder(
Size(528, 2954),
Show Control Panel(0),
Variables(X(:height), Y(:weight), Page(:age)),
Elements(Points(X, Y, Legend(5)), Smoother(X, Y, Legend(6)))
);
rep = Report(gb);
gbb_names = rep << XPath("//GraphBuilderGroupBox/text()");
group_number = Contains(gbb_names, "age = 14");
abs = Report(gb) << XPath("//AxisBox");
abs[group_number*2] << Add Ref Line(80, "Solid", "Black", "", 1);
// or possibly with dispatch you could do something like this
group_number = Contains(gbb_names, "age = 16");
rep << Dispatch({}, "weight", ScaleBox(group_number + 1),
{Add Ref Line(110, "Solid", "Black", "", 1)}
);
-Jarmo