Hola equipo JMP,
¿Es posible asignar dinámicamente texto personalizado al cuadro de subtítulos de Graph Builder usando el script JSL?
He estado creando secuencias de comandos JSL que crean gráficos de GB con texto asignado dinámicamente utilizando el posicionamiento de texto de escala del eje Y (ver más abajo). Esto ha funcionado relativamente bien, pero todavía tengo algunos problemas con la ubicación. Por lo tanto, me gustaría explorar la posibilidad de usar GB Caption Box, que siempre permanece en una posición fija independiente de la escala del eje 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;
); Gracias,
TS
Utilice el mensaje << Elementos con el conjunto de argumentos para especificar la línea de ajuste y la información asociada. Mira este ejemplo:
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 )
)
);