Come impostare una scala diversa quando utilizzo "by"?CIAO,
Utilizzo la funzione "by" per disegnare grafici una volta.
Come potrei utilizzare lo script per impostare una scala diversa?
Ho provato a usare "if" ma non ha funzionato.
Ecco la mia sceneggiatura:
d_graph=dt3 << Graph Builder(
Size( 1200, 300 ),
Show Control Panel( 0 ),
Variables(
X( :Lot ),
X( :ReadPoint, Position( 1 ) ),
Y( :drift% ),
Group X( :Rel_Test ),
Color( :Lot )
),
Elements( Box Plot( X( 1 ), X( 2 ), Y, Legend( 1 ) ) ),
By( :Label ),
SendToReport(
If(:Label == "IGSS" | :Label == "IGSSR" | :Label == "IDSS",
(Dispatch(
{},
"drift%",
ScaleBox,
{Min( 0 ), Max( 20 ), Inc( 5 ), Minor Ticks( 1 ),
Add Ref Line( 10, "Solid", "Medium Dark Red", "1000%", 1 ),
Add Ref Line( 5, "Dotted", "Medium Dark Red", "500%", 1 )})),
(Dispatch(
{},
"drift%",
ScaleBox,
{Min( -0.25 ), Max( 0.25 ), Inc( 0.05 ), Minor Ticks( 1 ),
Add Ref Line( 1.2, "Solid", "Medium Dark Red", "20%", 1 ),
Add Ref Line( 0.8, "Solid", "Medium Dark Red", "-20%", 1 )})))
)
);Automazione e scriptingAnalisi di affidabilitàRe: Come impostare una scala diversa quando utilizzo "by"?Con il Costruttore di grafici potresti voler utilizzare Pagina invece di Per. È necessario impostare tutti gli assi separatamente o utilizzare soluzioni di scripting che possono diventare un po' complicate.
Con Pagina
Graph Builder(
Size(525, 2954),
Show Control Panel(0),
Variables(X(:weight), Y(:height), Page(:age)),
Elements(Points(X, Y, Legend(12)), Smoother(X, Y, Legend(13))),
SendToReport(
Dispatch({}, "height", ScaleBox(2), {Min(49.55686), Max(71.1300045339471), Inc(5), Minor Ticks(1)}),
Dispatch({}, "height", ScaleBox(3), {Min(39.2571438997966), Max(67.3579268825169), Inc(5), Minor Ticks(1)}),
Dispatch({}, "height", ScaleBox(4), {Min(59.60392), Max(70.2079010526316), Inc(2), Minor Ticks(1)}),
Dispatch({}, "height", ScaleBox(5), {Min(60.2030935251799), Max(67.27), Inc(1), Minor Ticks(0)}),
Dispatch({}, "height", ScaleBox(6), {Min(58.60392), Max(69.3254618181818), Inc(2), Minor Ticks(1)}),
Dispatch({}, "height", ScaleBox(7), {Min(60.1377273502176), Max(70.192348647039), Inc(2), Minor Ticks(1)})
)
);
Con Di
Graph Builder(
SendToByGroup({:age == 12}),
Size(525, 454),
Show Control Panel(0),
Variables(X(:weight), Y(:height)),
Elements(Points(X, Y, Legend(1)), Smoother(X, Y, Legend(2))),
By(:age),
SendToByGroup({:age == 12}, SendToReport(Dispatch({}, "height", ScaleBox, {Min(46.2708484375), Max(64.6984984375), Inc(5), Minor Ticks(1)}))),
SendToByGroup({:age == 13}, SendToReport(Dispatch({}, "height", ScaleBox, {Min(54), Max(66.3534322916667), Inc(2), Minor Ticks(0)}))),
SendToByGroup({:age == 14}, SendToReport(Dispatch({}, "height", ScaleBox, {Min(58.1802560677083), Max(70.9932314583333), Inc(2), Minor Ticks(1)}))),
SendToByGroup({:age == 15}, SendToReport(Dispatch({}, "height", ScaleBox, {Min(61), Max(66.5205305091258), Inc(1), Minor Ticks(0)}))),
SendToByGroup({:age == 16}, SendToReport(Dispatch({}, "height", ScaleBox, {Min(57.1194704166667), Max(68.432), Inc(2), Minor Ticks(1)}))),
SendToByGroup({:age == 17}, SendToReport(Dispatch({}, "height", ScaleBox, {Min(59.0567933224374), Max(69.0987213244912), Inc(2), Minor Ticks(1)})))
);Re: Come impostare una scala diversa quando utilizzo "by"?Ecco una soluzione di scripting quando si utilizza By. A seconda di dove ottieni i valori min/max e della linea di riferimento, molto probabilmente li sposterei all'esterno del ciclo For Each.
Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
gbs = dt << Graph Builder(
SendToByGroup({:age == 12}),
Size(525, 454),
Show Control Panel(0),
Variables(X(:weight), Y(:height)),
Elements(Points(X, Y, Legend(1)), Smoother(X, Y, Legend(2))),
By(:age)
);
For Each({gb}, gbs,
rep = Report(gb);
yaxis = rep[AxisBox(2)];
gbtitle = rep[Outline Box(1)] << Get title;
category = Word(-1, gbtitle, "=");
If(Contains({"12", "14", "15", "16"}, category),
minval = 50;
maxval = 70;
ref1 = 55;
ref2 = 65;
ref1title = "500%";
ref2title = "1000%";
, Contains({"13"}, category),
minval = 0;
maxval = 100;
ref1 = 5;
ref2 = 95;
ref1title = "-20%";
ref2title = "20%";
);
yaxis << Min(minval) << Max(maxval);
yaxis << Add Ref Line(ref1, "Solid", "Medium Dark Red", ref1title, 1);
yaxis << Add Ref Line(ref2, "Solid", "Medium Dark Red", ref2title, 1);
);Re: Come impostare una scala diversa quando utilizzo "by"?Potresti essere in grado di adattare l'approccio di @jthi utilizzando XPath(). Invia questo messaggio al Costruttore di grafici in questo modo:
xAxis = d_graph << XPath( "//AxisBox" );
xAxis[2::N Items(xAxis)::2] << Min( min ) << Max( max ) ...;
Dovresti ottenere un elenco di riferimenti a tutte le caselle di visualizzazione di Axis. Vuoi indirizzare gli assi X, gli elementi con numeri pari nell'elenco. È possibile utilizzare la funzione Index per indicizzare l'elenco e inviare i messaggi Axis all'elenco in cascata. L'elenco distribuirà i messaggi a ogni elemento per te.
Re: Come impostare una scala diversa quando utilizzo "by"?Grazie @jthi e @Mark_Bailey .