Choose Language Hide Translation Bar
Highlighted
Thierry_S
Level VI

JSL > Graph Builder > CAPTION BOX: Is it possible to dynamically assign user defined specific text to GB Caption Box?

Hi JMP Team,

 

Is it possible to dynamically assign custom text to Graph Builder Caption Box using JSL script?

 

I have been creating JSL scripts that create GB plots with dynamically assigned text using Y-axis scale text positioning (see below). This has worked relatively well but I'm still experiencing some issues with the placement. Hence, I would like to explore the possibility of using GB Caption Box which always remains at a fix position independent of Y-Axis scale. 

 

Names Default to Here (1);

dt = Current Data Table ();

CList = dt << Get Column Names (string);


gbe = Expr (dt << Graph Builder(
				Size( 557, 503 ),
				Variables(
					X( :DURATION ),
					Y( _YS_ ),
					Overlay( :ARM ),
					Interval( _ES_ )
				),
				Elements( Points( X, Y, Legend( 9 ) ), Line( X, Y, Legend( 11 ) ) ),
				SendToReport(
					Dispatch(
						{},
						_LABEL_,
						ScaleBox,
						{Add Ref Line( 0, "Dotted", "Black", "", 2 )}
					),
					Dispatch(
						{},
						"400",
						ScaleBox,
						{Legend Model(
							9,
							Base( 0, 0, 0, Item ID( "CTRL", 1 ) ),
							Base( 1, 0, 0, Item ID( "GROUP 1", 1 ) ),
							Base( 2, 0, 0, Item ID( "GROUP 2", 1 ) ),
							Base( 3, 0, 0, Item ID( "GROUP 3", 1 ) )
						)}
					),
					Dispatch(
						{},
						"Graph Builder",
						FrameBox,
						{Marker Size( 6 ), Add Graphics Script(
							2,
							Description( "Script" ),
							Text Size( 12 );
							Text Color (21); // ABBV-105
							Text( Center Justified, {-0.25, _TP1_}, "105" );
							Text( Center Justified, {4.0, _TP1_}, _TXT1_ );
							Text( Center Justified, {12.0, _TP1_}, _TXT2_ );
							Text color (19); // UPA
							Text( Center Justified, {-0.25, _TP2_}, "494" );
							Text( Center Justified, {4.0, _TP2_}, _TXT3_ );
							Text( Center Justified, {12.0, _TP2_}, _TXT4_ );
							Text color (24); // ABBV-599
							Text( Center Justified, {-0.25, _TP3_}, "599" );
							Text( Center Justified, {4.0, _TP3_}, _TXT5_ );
							Text( Center Justified, {12.0, _TP3_}, _TXT6_ );
						), Grid Line Order( 4 ), Reference Line Order( 5 )}
					)
				)
			)
		);

For (i = 5, i <= 188, i++, //188

	YCOL = Column (dt, i);
	ECOL = Column (dt, i+184);
	PCOL = Column (dt, i+368);
	LBL = CList [i];
	
	YMax = Col Mean (YCOL) + (Col Std Dev (YCOL)/sqrt(Col Number(YCOL)));
	YMin = Col Mean (YCOL) - (Col Std Dev (YCOL)/sqrt(Col Number(YCOL)));
	
	YRANGE = abs (YMax - Y Min);
	
	If (YRANGE < 1.5, 
							YMax = YMax + 0.9;
							YMin = YMin - 0.4	
							);
	
	TOPY1 = YMax*0.90;
	TOPY2 = YMax*0.75;
	TOPY3 = YMax*0.60;
	
	
	
	PVAL1 = "p VAL " || CHAR(Format(PCOL[5], "PValue"));
	PVAL2 = "p VAL " || CHAR(Format(PCOL[6], "PValue"));
	PVAL3 = "p VAL " || CHAR(Format(PCOL[8], "PValue"));
	PVAL4 = "p VAL " || CHAR(Format(PCOL[9], "PValue"));
	PVAL5 = "p VAL " || CHAR(Format(PCOL[11], "PValue"));
	PVAL6 = "p VAL " || CHAR(Format(PCOL[12], "PValue"));
	
	gbx = Substitute (Name Expr (gbe), 	Expr (_YS_), YCOL,
										Expr (_ES_), ECOL,
										Expr (_LABEL_), LBL,
										Expr (_TP1_), TOPY1,
										Expr (_TP2_), TOPY2,
										Expr (_TP3_), TOPY3,
										Expr (_TXT1_), PVAL1,
										Expr (_TXT2_), PVAL2,
										Expr (_TXT3_), PVAL3,
										Expr (_TXT4_), PVAL4,
										Expr (_TXT5_), PVAL5,
										Expr (_TXT6_), PVAL6
											
					);
	gb = Eval (gbx);
	
	Yaxis = report (gb)[Axis Box (2)];
	
	LocYMin = Yaxis << Get Min;
	LocYMax = Yaxis << Get Max;
	
	LocRange = LocYMax - LocYMin;
	
	mytitle = LBL;
	
	report (gb) [OutlineBox (1)] << Set Title (mytitle);
		
	if(abs (LocRange) < 1.5, 
		Yaxis << Max (LocYMax + 1.0);
		Yaxis << Min (LocYMin - 0.6);
		Yaxis << Inc (0.2),.);

	
	gb << Journal;
	gb << close window;
	

);	

Thanks,

 

TS

Thierry R. Sornasse
1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted

Re: JSL > Graph Builder > CAPTION BOX: Is it possible to dynamically assign user defined specific text to GB Caption Box?

No, you may only turn the display of information on and off. You may not supply the information to be displayed. The information is always determined by JMP using the observations in the plot.

 

You could use a graphics script or a graphlet, textlet, and gridlet script to build what you want. 

Learn it once, use it forever!

View solution in original post

5 REPLIES 5

Re: JSL > Graph Builder > CAPTION BOX: Is it possible to dynamically assign user defined specific text to GB Caption Box?

You can use the << Add Text Annotation message with the Frame Box display box object. Would that way work?

Learn it once, use it forever!
Highlighted
Thierry_S
Level VI

Re: JSL > Graph Builder > CAPTION BOX: Is it possible to dynamically assign user defined specific text to GB Caption Box?

Hi Mark,

Thanks for your suggestion but I was hoping for a couple of things beyond the "Add Text Annotation" message.
Specifically, 1) I would like to use the "floating" behavior of the GB element Caption Box that shows different statistics for the plotted data, and 2) I would like to be able to place the custom text based on the X axis scale reference (and not the pixel reference of the FrameBox). Any ideas?
Best regards,
TS
Thierry R. Sornasse
Highlighted

Re: JSL > Graph Builder > CAPTION BOX: Is it possible to dynamically assign user defined specific text to GB Caption Box?

Use the << Elements message with the argument set to specify the line of fit and associated information. See this example:

 

Names Default to Here( 1 );

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

gb = dt << Graph Builder(
	Size( 534, 456 ),
	Show Control Panel( 0 ),
	Show Legend( 0 ),
	Variables( X( :height ), Y( :weight ) )
);

gb << Elements(
	Points( X, Y, Legend( 3 ) ),
	Line Of Fit(
		X,
		Y,
		Legend( 5 ),
		Root Mean Square Error( 1 ),
		R²( 1 ),
		Equation( 1 ),
		F Test( 1 )
	)
); 

 

Learn it once, use it forever!
Highlighted
Thierry_S
Level VI

Re: JSL > Graph Builder > CAPTION BOX: Is it possible to dynamically assign user defined specific text to GB Caption Box?

Hi Mark,

Thanks again for trying to help with my rather convoluted request. We are getting on track but not there yet.

In the GB elements, I can add the element Caption Box which can be set to different predefined statistics (e.g. N, Mean, StdEv...). Is it possible to alter these predefined statistics to enter a user defined information (such as p values from another table)?

Thanks again for your kind support.

Best,

TS
Thierry R. Sornasse
Highlighted

Re: JSL > Graph Builder > CAPTION BOX: Is it possible to dynamically assign user defined specific text to GB Caption Box?

No, you may only turn the display of information on and off. You may not supply the information to be displayed. The information is always determined by JMP using the observations in the plot.

 

You could use a graphics script or a graphlet, textlet, and gridlet script to build what you want. 

Learn it once, use it forever!

View solution in original post

Article Labels

    There are no labels assigned to this post.