ah.. I though you want to modify legend. Axis labels seem to be one of the annoying things (you can remove them and add new, but I'm not exactly sure how to get current label). So XPath to rescue like usually (might be a good idea to filter out graph title and possibly x-axis)
Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
gb = dt << Graph Builder(
Size(528, 454),
Show Control Panel(0),
Variables(X(:height), Y(:height), Y(:weight)),
Elements(Position(1, 1), Points(X, Y, Legend(3))),
Elements(Position(1, 2), Points(X, Y, Legend(1)))
);
rep = Report(gb);
tebs = rep << XPath("//GraphBuilderTitleBox/TextEditBox");
For Each({teb}, tebs,
cur_title = teb << get text;
show(cur_title);
If(cur_title == "weight",
teb << Set Text(Repeat(cur_title, 2))
);
);
-Jarmo