cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Try the Materials Informatics Toolkit, which is designed to easily handle SMILES data. This and other helpful add-ins are available in the JMP® Marketplace
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!

2 ACCEPTED SOLUTIONS

Accepted Solutions
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

View solution in original post

jthi
Super User

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

Your example added same text to each of the frameboxes so I did the same (as in I didn't know what you wanted to add). Adding the graphic script will fail if the report doesn't have curves fit, for example there could be too few observations.

-Jarmo

View solution in original post

4 REPLIES 4
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

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

Hi jthi,

 

Many thanks for your reply. Please let me clarify my question:

Your script inserts "F12" in every framebox with data of females but I would need a specific text in every framebox with linear fits.

I think this can be realized by using "reports [1]", "reports [2]" etc. instead of "cur_report" and without the "For Each..." function.

 

Is there a reason, why you use "Try" and a potential error message instead of Eval? What could make the insertion of the Graphics Script fail?

jthi
Super User

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

Your example added same text to each of the frameboxes so I did the same (as in I didn't know what you wanted to add). Adding the graphic script will fail if the report doesn't have curves fit, for example there could be too few observations.

-Jarmo

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

Now I understand, thank you for the explanation and for your support!