cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Check out the JMP® Marketplace featured Capability Explorer add-in
Choose Language Hide Translation Bar
Thierry_S
Super User

JSL > GraphBuilder > Multi-frame plots > Dynamic Text Annotation Issue

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
1 ACCEPTED SOLUTION

Accepted Solutions
jthi
Super User

Re: JSL > GraphBuilder > Multi-frame plots > Dynamic Text Annotation Issue

If it is Eval(EvalExpr()) thing try this:

	Eval(EvalExpr(locfr << add graphics script(
		Text Size(8);
		Text Color(blue);
		Text(Center Justified, {4, -0.15}, Expr(a_fdr4));
		Text(Center Justified, {14, -0.15}, Expr(a_fdr14));
		Text Color(green);
		Text(Center Justified, {4, -0.2}, Expr(b_fdr4));
		Text(Center Justified, {14, -0.2}, Expr(b_fdr14));
	)));

At least the values in customize graph seem to get updated and the values aren't same in each of the groups:

jthi_0-1636654039483.png

 

-Jarmo

View solution in original post

2 REPLIES 2
jthi
Super User

Re: JSL > GraphBuilder > Multi-frame plots > Dynamic Text Annotation Issue

If it is Eval(EvalExpr()) thing try this:

	Eval(EvalExpr(locfr << add graphics script(
		Text Size(8);
		Text Color(blue);
		Text(Center Justified, {4, -0.15}, Expr(a_fdr4));
		Text(Center Justified, {14, -0.15}, Expr(a_fdr14));
		Text Color(green);
		Text(Center Justified, {4, -0.2}, Expr(b_fdr4));
		Text(Center Justified, {14, -0.2}, Expr(b_fdr14));
	)));

At least the values in customize graph seem to get updated and the values aren't same in each of the groups:

jthi_0-1636654039483.png

 

-Jarmo
Thierry_S
Super User

Re: JSL > GraphBuilder > Multi-frame plots > Dynamic Text Annotation Issue

Hi jthi,

Brilliant, as always. I am still struggling with the construct with Eval / Eval Expr / Expr.

Best,

TS

Thierry R. Sornasse