I'm sure everyone would approach this slightly differently. But if the two tables above are your starting point, then I would do something like this:
NamesDefaultToHere(1);
// Data tables
data = DataTable("Test WORKFLOW.jmp");
stats = DataTable("Test WORKFLOW RESULT TABLE.jmp");
// Template expression for Graph Builder with text annotation
gbExpr =
Expr(
data << Graph Builder(
Show Control Panel( 0 ),
Variables( X( :X ), Y( yTBD ), Overlay( :Overlay ) ),
Elements(Line(X, Y, Legend( 12 ), Error Interval( "None" ))),
SendToReport(
Dispatch(
{},
"Graph Builder",
FrameBox,
{Add Graphics Script( 2, Description( "Annotation" ), Text( {8, 0}, "interaction P Val: "||Char(Round(pValTBD, 3))))}
)
)
)
);
// Loop over 'Y' variables
lub = LineUpBox(NCol(1));
for(c=3, c<=NCol(data), c++,
yCol = Column(data, c);
pVal = Column(stats, 2)[c-2];
lub << append(Eval(Substitute(NameExpr(gbExpr), Expr(yTBD), yCol, Expr(pValTBD), pVal)));
);
// Reports in a Journal
nw = NewWindow("Report", <<Journal, lub);
You should be able to develop this outline to suit your case. You could also try including some logic to place the annotation in a 'better' place. If you are not sure how it works, then see 'Help > Scripting Guide' and the JSL book.