Ciao Team JMP,
È possibile assegnare dinamicamente un testo personalizzato a Graph Builder Caption Box utilizzando lo script JSL?
Ho creato script JSL che creano grafici GB con testo assegnato dinamicamente utilizzando il posizionamento del testo su scala dell'asse Y (vedi sotto). Questo ha funzionato relativamente bene, ma sto ancora riscontrando alcuni problemi con il posizionamento. Quindi, vorrei esplorare la possibilità di utilizzare GB Caption Box che rimane sempre in una posizione fissa indipendente dalla scala dell'asse Y.
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;
); Grazie,
ST
Utilizzare il messaggio << Elements con l'argomento impostato per specificare la linea di adattamento e le informazioni associate. Guarda questo esempio:
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 )
)
);