After doing what Ian suggests you can look at the JSL code to see how JMP did it. In Graph Builder click the red triangle and select Script > Copy Script. Paste the script into a new JSL window and you'll see something like this (I added the open of big class):
dt = open("$sample_data\Big Class.jmp");
Graph Builder(
Size( 526, 451 ),
Show Control Panel( 0 ),
Variables( X( :weight ), Y( :height ) ),
Elements( Points( X, Y, Legend( 16 ) ), Line( X, Y, Legend( 18 ) ) ),
SendToReport(
Dispatch( {}, "Graph Builder",
OutlineBox, {Set Title( "This is my graph" )}
)
)
);