Le code JSL ci-dessous tente d'utiliser la méthode « add Element » pour afficher un tracé de contour sur le graphique de droite. Cependant, comme « add Element » est une opération d'ajout d'élément, il ne peut ni supprimer ni remplacer le format de points d'origine sur le graphique de droite, ce qui entraîne une image différente de la figure ci-dessous. Les points d'origine sont conservés avec le contour ajouté. L'axe des X ne pouvant être ajouté qu'ultérieurement, est-il possible de supprimer le format de points d'origine tout en utilisant « add Element » ?
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
gb = dt << Graph Builder(
Size( 488, 352 ),
Show Control Panel( 0 ),
Fit to Window( "Off" ),
Variables( Y( :weight ), Overlay( :age ) ),
Elements( Position( 1, 1 ), Points( X, Y, Legend( 21 ) ), Points( X, Y, Legend( 23 ) ) ),
//Elements( Position( 2, 1 ), Contour( X, Y, Legend( 22 ) ) ),
);
gb << Add Variable( {:height, Role( "X" )} );
gb << Add Variable( {:Height, Role( "X" )} );
gb << Add Element( 1, 1, {Type( "Points" ), X, Y} );
gb << Add Element( 2, 1, {Type( "Contour" ), X, Y} );

Vous pouvez supprimer l'élément point
Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
gb = dt << Graph Builder(
Size(488, 352),
Show Control Panel(0),
Fit to Window("Off"),
Variables(Y(:weight), Overlay(:age)),
Elements(Position(1, 1), Points(X, Y, Legend(21)), Points(X, Y, Legend(23))),
//Elements( Position( 2, 1 ), Contour( X, Y, Legend( 22 ) ) ),
);
gb << Add Variable({:height, Role("X")});
gb << Add Variable({:Height, Role("X")});
gb << Remove Element(2, 1, 1);
gb << Remove Element(2, 1, 1);
gb << Add Element(2, 1, {Type("Contour"), X, Y});
ou vous pouvez créer l'expression du générateur de graphiques pour en tenir compte
1. Vous avez déjà ajouté des points à votre graphique même si vous n'avez pas d'axe des x -> vous pourriez vous retrouver avec plus de graphiques de points que vous ne le pensez.
Exécuter le script de création de graphiques -> copier le script
Graph Builder(
Size(488, 352),
Show Control Panel(0),
Fit to Window("Off"),
Variables(Y(:weight), Overlay(:age)),
Elements(Points(Y, Legend(21)), Points(Y, Legend(23)))
);
Exécuter << Ajouter une variable -> Copier le script
Graph Builder(
Size(488, 352),
Show Control Panel(0),
Fit to Window("Off"),
Variables(X(:height), Y(:weight), Overlay(:age)),
Elements(Points(X, Y, Legend(21)), Points(X, Y, Legend(23)))
);
Exécuter << Ajouter une variable -> Copier le script
Graph Builder(
Size(488, 352),
Show Control Panel(0),
Fit to Window("Off"),
Variables(X(:height), X(:height), Y(:weight), Overlay(:age)),
Elements(Position(1, 1), Points(X, Y, Legend(21)), Points(X, Y, Legend(23))),
Elements(Position(2, 1), Points(X, Y, Legend(24)), Points(X, Y, Legend(25)))
);
</CODE>Run << Remove Element -> copy script</P>
<BR />
<BR />
<PRE><CODE class=" language-jsl">Graph Builder(
Size(488, 352),
Show Control Panel(0),
Fit to Window("Off"),
Variables(X(:height), X(:height), Y(:weight), Overlay(:age)),
Elements(Position(1, 1), Points(X, Y, Legend(21)), Points(X, Y, Legend(23))),
Elements(Position(2, 1), Points(X, Y, Legend(25)))
);
Exécuter << Supprimer l'élément -> copier le script
Graph Builder(
Size(488, 352),
Show Control Panel(0),
Fit to Window("Off"),
Variables(X(:height), X(:height), Y(:weight), Overlay(:age)),
Elements(Position(1, 1), Points(X, Y, Legend(21)), Points(X, Y, Legend(23))),
Elements(Position(2, 1))
);
et ainsi de suite.
Vous pouvez vous donner de bien meilleures chances de succès si vous utilisez un générateur de graphiques aussi complet que possible.
Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
gb = dt << Graph Builder(
Size(488, 393),
Show Control Panel(0),
Fit to Window("Off"),
Variables(X(:height), Y(:weight), Overlay(:age)),
Elements(Points(X, Y, Legend(2)))
);
gb << Add Variable({:Height, Role("X"), Position(2)});
gb << Remove Element(2, 1, 1);
gb << Add Element(2, 1, {Type("Contour"), X, Y});
2. Vous pouvez ajuster l'axe des x avec un script (les axes sont différents car le tracé des contours nécessite plus d'espace que les points)
Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
gb = dt << Graph Builder(
Size(488, 352),
Show Control Panel(0),
Fit to Window("Off"),
Variables(Y(:weight), Overlay(:age)),
Elements(Position(1, 1), Points(X, Y, Legend(21)), Points(X, Y, Legend(23))),
//Elements( Position( 2, 1 ), Contour( X, Y, Legend( 22 ) ) ),
);
gb << Add Variable({:height, Role("X")});
gb << Add Variable({:Height, Role("X")});
gb << Remove Element(2, 1, 1);
gb << Remove Element(2, 1, 1);
gb << Add Element(2, 1, {Type("Contour"), X, Y});
min2 = Report(gb)[AxisBox(3)] << get min;
max2 = Report(gb)[AxisBox(3)] << get max;
Report(gb)[AxisBox(1)] << Min(min2) << Max(max2);