Hi JMP Community,
I have an apparently simple problem that I have not been able to resolve.
In the script below, I am trying to add text annotations dynamically using the "Add Graphics Script" based on values extracted from the main data table (see attached). The issue is that the actual dynamic values across the multiple frames are all set to the last valid data extracted from the data table instead of being specifically associated with each frame. I suspect that I need to use a combination of "Eval Expr" and "Expr" to get the appropriate outcome but I have not been able to find the right syntax for this operation. All suggestions are welcome.
Names Default to Here (1);
dt = data table ("TS_DATA_TABLE_MOCK");
fdr_data = dt:FDR << Get Values ();
show (fdr_data);
gb = dt << Graph Builder(
Size( 832, 835 ),
Fit to Window( "Off" ),
Variables(
X( :"DURATION (Week)"n ),
Y( :LSMEAN ),
Wrap( :M_ID ),
Overlay( :ARM ),
Interval( :STDERR )
),
Elements( Points( X, Y, Legend( 31 ) ), Line( X, Y, Legend( 32 ) ) ),
SendToReport(
Dispatch(
{},
"LSMEAN",
ScaleBox,
{Add Ref Line( 0, "Solid", "Gray", "", 2 )}
),
Dispatch(
{},
"400",
ScaleBox,
{Legend Model(
31,
Base( 0, 0, 0, Item ID( "A", 1 ) ),
Base( 1, 0, 0, Item ID( "B", 1 ) )
)}
)
)
);
gbr = report (gb);
nfr = N items (gbr << Xpath ("//FrameBox"));
For (i = 0, i <= nfr-2, i++,
a_fdr4 = "fdr " || CHAR(Format(fdr_data [ (i*6) + 4], "PValue"));
a_fdr14 = "fdr " || CHAR(Format(fdr_data [ (i*6) + 6], "PValue"));
b_fdr4 = "fdr " || CHAR(Format(fdr_data [ (i*6) + 3], "PValue"));
b_fdr14 = "fdr " || CHAR(Format(fdr_data [ (i*6) + 5], "PValue"));
locfr = gbr [FrameBox (i+1)];
locfr << add graphics script (
Text size (8);
Text color (blue);
Text (Center Justified, {4, -0.15}, a_fdr4);
Text (Center Justified, {14, -0.15}, a_fdr14);
Text color (green);
Text (Center Justified, {4, -0.2}, b_fdr4);
Text (Center Justified, {14, -0.2}, b_fdr14);
);
);
Of note, this is a portion of a larger script that selects specific rows to plot in this format.
Best,
TS
Thierry R. Sornasse