Ciao comunità JMP,
Ho un problema apparentemente semplice che non sono riuscito a risolvere.
Nello script seguente, sto cercando di aggiungere annotazioni di testo in modo dinamico utilizzando "Aggiungi script grafici" in base ai valori estratti dalla tabella dati principale (vedi allegato). Il problema è che i valori dinamici effettivi su più frame sono tutti impostati sugli ultimi dati validi estratti dalla tabella dati invece di essere specificamente associati a ciascun frame. Sospetto di dover utilizzare una combinazione di "Eval Expr" ed "Expr" per ottenere il risultato appropriato, ma non sono riuscito a trovare la sintassi giusta per questa operazione. Tutti i suggerimenti sono i benvenuti.
Names Default to Here (1);
dt = data table ("TS_DATA_TABLE_MOCK");
fdr_data = dt:FDR << Get Values ();
show (fdr_data);
gb = dt << Graph Builder(
Size( 832, 835 ),
Fit to Window( "Off" ),
Variables(
X( :"DURATION (Week)"n ),
Y( :LSMEAN ),
Wrap( :M_ID ),
Overlay( :ARM ),
Interval( :STDERR )
),
Elements( Points( X, Y, Legend( 31 ) ), Line( X, Y, Legend( 32 ) ) ),
SendToReport(
Dispatch(
{},
"LSMEAN",
ScaleBox,
{Add Ref Line( 0, "Solid", "Gray", "", 2 )}
),
Dispatch(
{},
"400",
ScaleBox,
{Legend Model(
31,
Base( 0, 0, 0, Item ID( "A", 1 ) ),
Base( 1, 0, 0, Item ID( "B", 1 ) )
)}
)
)
);
gbr = report (gb);
nfr = N items (gbr << Xpath ("//FrameBox"));
For (i = 0, i <= nfr-2, i++,
a_fdr4 = "fdr " || CHAR(Format(fdr_data [ (i*6) + 4], "PValue"));
a_fdr14 = "fdr " || CHAR(Format(fdr_data [ (i*6) + 6], "PValue"));
b_fdr4 = "fdr " || CHAR(Format(fdr_data [ (i*6) + 3], "PValue"));
b_fdr14 = "fdr " || CHAR(Format(fdr_data [ (i*6) + 5], "PValue"));
locfr = gbr [FrameBox (i+1)];
locfr << add graphics script (
Text size (8);
Text color (blue);
Text (Center Justified, {4, -0.15}, a_fdr4);
Text (Center Justified, {14, -0.15}, a_fdr14);
Text color (green);
Text (Center Justified, {4, -0.2}, b_fdr4);
Text (Center Justified, {14, -0.2}, b_fdr14);
);
);
Da notare che questa è una parte di uno script più grande che seleziona righe specifiche da tracciare in questo formato.
Migliore,
TS
Se è Eval(EvalExpr()) prova questo:
Eval(EvalExpr(locfr << add graphics script(
Text Size(8);
Text Color(blue);
Text(Center Justified, {4, -0.15}, Expr(a_fdr4));
Text(Center Justified, {14, -0.15}, Expr(a_fdr14));
Text Color(green);
Text(Center Justified, {4, -0.2}, Expr(b_fdr4));
Text(Center Justified, {14, -0.2}, Expr(b_fdr14));
)));Almeno i valori nel grafico di personalizzazione sembrano essere aggiornati e i valori non sono gli stessi in ciascuno dei gruppi:

Ciao jthi,
Brillante, come sempre. Sto ancora lottando con il costrutto con Eval / Eval Expr / Expr.
Migliore,
TS