cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar

How to insert text in frames in fit curve platform with Group and By variables (JMP 18)

Hi all!

 

I want to insert a text in frames in the fit curve platform using a Group and a By variable via JSL (JMP 18).

Therefore I tried the following code, but it doesn't work:

Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
obj = dt << Fit Curve(Y(:weight), X(:height), Group(:sex), Fit Linear, By(:age));

robj = obj << report;

(robj << XPath(
	"(//OutlineBox[text()='Fit Curve']//OutlineBox[text()='age=12']//OutlineBox[text()='Linear']//OutlineBox[text()='Plot']//FrameBox)[2]"
)) << Add Graphics Script( 1, Description( "Script" ), Text( {52, 120}, "F 12" ) );

I copied the XPath from the properties of the frame using Mode: XPath and Root: Window.

 

In JMP 17, this works with the following code:

Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
obj = dt << Fit Curve(Y(:weight), X(:height), Group(:sex), Fit Linear, By(:age));

robj = obj << report;

(robj << XPath( "(//OutlineBox[text()='Fit Curve age=12']//OutlineBox[text()='Linear']//OutlineBox[text()='Plot']//FrameBox)[2]" )) << Add Graphics Script( 1, Description( "Script" ), Text( {52, 120}, "F 12" ) );

The result should look like this for Fit curve age=12 (screenshot from JMP 17):

PolygonStallion_0-1719998721107.png

Many thanks for your help!

1 REPLY 1
jthi
Super User

Re: How to insert text in frames in fit curve platform with Group and By variables (JMP 18)

I would most likely use the list of platforms you get and loop over that (unless you wish to have exactly same text for each of the frameboxes in same location, then I would maybe use XPath and top level of the report)

Names Default To Here(1);

dt = Open("$SAMPLE_DATA/Big Class.jmp");

fcs = dt << Fit Curve(Y(:weight), X(:height), Group(:sex), Fit Linear, By(:age));

reports = fcs << report;

For Each({cur_report}, reports,
	//cur_report = reports[1];
	Try(
		cur_report[Outline Box("Linear"), OutlineBox("Plot"), FrameBox(2)] << Add Graphics Script(1,
			Text({52, 120}, "F 12")
		);
	,
		Write("\!NIssue with ", cur_report << get title, "\!N", exception_msg);
	);
);

-Jarmo