Comment puis-je scripter une variable Y mobile pour le générateur de graphes ?Salut tout le monde,
Je fais un générateur de graphes avec des variables Y mobiles, la sortie du graphe apparaîtra comme ceci :

Mais, j'ai du mal à écrire l'axe Y en JSL.Comment puis-je le faire ?
For( i = 1, i <= N Items( NamesList ), i++,
obj = Graph Builder(
Size( 534, 464 ),
Show Control Panel( 0 ),
Variables(
X( :TETEST_MONTH ),
X( :TETEST_WEEK, Position( 1 ) ),
Y( :Name ("Y")) , // how do I insert the moving Y variable here ?
Y( :Name ("Y")), // how do I insert the moving Y variable here ?
Color( :TETEST_MONTH )
),
Elements( Position( 1, 1 ), Histogram( X( 2 ), X( 1 ), Y, Legend( 14 ) ) ),
Elements(
Position( 1, 2 ),
Box Plot( X( 2 ), X( 1 ), Y, Legend( 16 ) ),
Line( X( 2 ), X( 1 ), Y, Legend( 17 ) )
),
SendToReport( Dispatch( {}, "400", LegendBox, {Set Title( "" )} ) )
));Re : Comment puis-je scripter une variable Y mobile pour le générateur de graphes ?Merci Jim. Cela fonctionne à merveille maintenant.Re : Comment puis-je scripter une variable Y mobile pour le générateur de graphes ?Mon erreur ...... débarrassez-vous de toutes les références gb[i] et remplacez-les par gb.
Re : Comment puis-je scripter une variable Y mobile pour le générateur de graphes ?Merci Jim. Mais je rencontre encore une erreur. Je suppose que quelque chose ne va pas avec ma segmentation.
/* Open a sample data table */
dt = Open( "C:\Users\1.jmp", invisible );
// Find the Y Columns
numericColNamesList = dt << get column names( string, numeric );
For( i = N Items( numericColNamesList ), i >= 1, i--,
If(
Not(
Is Missing( Num( Word( 1, numericColNamesList[i], ":" ) ) ) == 0 &
Word( 2, numericColNamesList[i], ":" ) != ""
),
numericColNamesList = Remove( numericColNamesList, i, 1 )
)
);
// Run the Variance Charts
// With dynamic Y columns and fixed X columns
Fo( i = 1, i <= N Items( numericColNamesList ), i++,
gb = dt << Graph Builder(
Invisible,
Size( 752, 508 ),
Show Control Panel( 0 ),
Show Legend( 0 ),
Variables(
X( :Month ),
Y( Column ( numericColNamesList[i] ) ),
Overlay( :Month )
),
Elements(
Box Plot(
X,
Y,
Legend( 15 ),
Jitter( 0 ),
Outliers( 0 ),
Box Style( "Solid" )
),
Histogram( X, Y, Legend( 12 ) )
));
gb = LIST (gb[i]);
If( i == 1,
Report( gb ) << Save Presentation( "C:\Users\Ann Ann\1.pptx" ),
Report( gb[i] << Save Presentation( "C:\Users\Ann Ann\1.pptx", Append ) )
));
Re : Comment puis-je scripter une variable Y mobile pour le générateur de graphes ?Vous utilisez
gb = dt << Constructeur de graphes(.........
pour chaque exécution de la plate-forme Graph Builder.Ce n'est pas un vecteur de valeurs.Chaque fois que vous exécutez le script Graph Builder, vous créez une nouvelle valeur pour la variable "gb".Autrement dit, le pointeur vers la dernière instance de Graph Builder est déplacé pour pointer vers la nouvelle instance de Graph Builder.Il n'y a pas de gb[1], gb[2], etc. la façon dont vous avez configuré le code.
Une façon de surmonter cela consiste à déplacer la zone de code Enregistrer la présentation, à l'intérieur de la boucle For() initiale.
Une autre façon de résoudre ce problème est dans la boucle For() initiale, enregistrez les valeurs de "gb" dans une liste après sa création.Ensuite, pointez sur les éléments de la liste dans la deuxième boucle For(), au lieu de gb[i] etc.
For( i = 1, i <= N Items( numericColNamesList ), i++,
gb = dt << Graph Builder(
Size( 900, 850 ),
Show Control Panel( 0 ),
Variables(
X( :MONTH ),
X( :WEEK, Position( 1 ) ),
Y( Column( numericColNamesList[i] ) ),
Y( Column( numericColNamesList[i] ) ),
Color( :MONTH )
),
Elements( Position( 1, 1 ), Histogram( X( 2 ), X( 1 ), Y, Legend( 14 ) ) ),
Elements(
Position( 1, 2 ),
Box Plot( X( 2 ), X( 1 ), Y, Legend( 16 ) ),
Line( X( 2 ), X( 1 ), Y, Legend( 17 ) )
),
SendToReport( Dispatch( {}, "400", LegendBox, {Set Title( "" )} ) )
);
If( i == 1,
Report( gb ) << Save Presentation( "C:\Users\Ann Ann\1.pptx" ),
Report( gb[i] << Save Presentation( "C:\Users\Ann Ann\1.pptx", Append ) )
);
);
Open( "C:\Users\Ann Ann\1.pptx" );Re : Comment puis-je scripter une variable Y mobile pour le générateur de graphes ?Merci Jim.
Mais je ne sais pas pourquoi cette erreur m'a incité pendant le débogage.

For( i = 1, i <= N Items( numericColNamesList ), i++,
gb = dt << Graph Builder(
Size( 900, 850 ),
Show Control Panel( 0 ),
Variables(
X( :MONTH ),
X( :WEEK, Position( 1 ) ),
Y( Column( numericColNamesList[i])) ,
Y( Column( numericColNamesList[i])) ,
Color( :MONTH )
),
Elements( Position( 1, 1 ), Histogram( X( 2 ), X( 1 ), Y, Legend( 14 ) ) ),
Elements(
Position( 1, 2 ),
Box Plot( X( 2 ), X( 1 ), Y, Legend( 16 ) ),
Line( X( 2 ), X( 1 ), Y, Legend( 17 ) )
),
SendToReport( Dispatch( {}, "400", LegendBox, {Set Title( "" )} ) )
));
Report(gb[1]) << Save Presentation( "C:\Users\Ann Ann\1.pptx" );
For( i = 2, i <= N Items( numericColNamesList ), i++,
Report (gb[i] << Save Presentation( "C:\Users\Ann Ann\1.pptx", Append )
));
Open( "C:\Users\Ann Ann\1.pptx" );
//wait(0);
//obj << close window();
Re : Comment puis-je scripter une variable Y mobile pour le générateur de graphes ?En supposant que "NamesList" contient les colonnes Y que vous souhaitez utiliser comme colonnes Y, puis remplacez
:Noms( "Y" )
avec:
en tant que colonne (NamesList[i])