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