Salut,
J'utilise la fonction "by" pour dessiner des tracés une seule fois.
Comment puis-je utiliser un script pour définir une échelle différente ?
J'ai essayé d'utiliser "if" mais cela n'a pas fonctionné.
Voici mon script :
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 )})))
)
);Avec Graph Builder, vous souhaiterez peut-être utiliser Page au lieu de By. Vous devez définir tous les axes séparément ou utiliser des solutions de script, ce qui peut devenir un peu compliqué.
Avec page
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)})
)
);
Avec par
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)})))
);Voici une solution de script lors de l’utilisation de By. Selon l'endroit où vous obtenez les valeurs des lignes min/max et ref, je déplacerais très probablement celles-ci en dehors de la boucle 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);
);Vous pourrez peut-être adapter l'approche de @jthi en utilisant XPath(). Envoyez ce message à Graph Builder comme ceci :
xAxis = d_graph << XPath( "//AxisBox" );
xAxis[2::N Items(xAxis)::2] << Min( min ) << Max( max ) ...;
Vous devriez obtenir une liste de références à toutes les boîtes d'affichage Axis. Vous souhaitez traiter les axes X, les éléments pairs de la liste. Vous pouvez utiliser la fonction Index pour indiquer la liste et envoyer les messages Axis à la liste en cascade. La liste distribuera les messages à chaque élément pour vous.