Agregar condiciones a variables en el generador de gráficos en JSLHola a todos,
Estoy intentando modificar el código del generador de gráficos que tiene ciertas variables. Me gustaría agregar declaraciones condicionales para incluir o excluir determinadas variables. Intenté usar declaraciones if, pero no parece funcionar correctamente. Agradecería cualquier sugerencia al respecto.
Código de ejemplo:
Quiero recibir una entrada del usuario (ya hecha con esta parte), para evaluar si el usuario quiere los resultados con respecto a la temperatura de prueba (por ejemplo). Tengo otras variables con las que trazar, pero proporcioné una temperatura de prueba para simplificar el ejemplo.
// x will be taken as an input
Graph Builder(
Size( 1257, 829 ),
Level Spacing Color( "Black" ),
Variables( Y( :TX_EVM ), Y( :TX_EVM ), If( Equal( X, 1 ), Group X( :Test_Temp ) ) ),
Elements( Box Plot( Y, Legend( 19 ) ) ),
Local Data Filter(
Add Filter(
columns( :Test_Temp ),
Where( :Test_Temp == {"test temp1 ", "test temp2", "test temp3"} )
)
)
);
Modelado estadístico avanzadoAutomatización y secuencias de comandosAnálisis y modelado de datos básicosventanasRe: Agregar condiciones a las variables en el generador de gráficos en JSLLa opción más fácil es probablemente eliminar la variable después de crear la gráfica.
Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
gb = dt << Graph Builder(
Size(528, 492),
Show Control Panel(0),
Variables(X(:weight), Y(:height), Group X(:sex)),
Elements(Points(X, Y, Legend(5)))
);
// gb << Get Variables; // depending on your graph calculating which index to remova can be a good idea
gb << Remove Variable(3);
wait(0);
También puedes construir la parte Variables() del mensaje Graph Builder() usando expresiones
Re: Agregar condiciones a las variables en el generador de gráficos en JSLEs posible que tengas que encapsular TestList[i3] con algo. A continuación se muestran algunas opciones
Names Default To Here(1);
dt = open("$SAMPLE_DATA/Big Class.jmp");
mycol = "weight";
gb = dt << Graph Builder(
Size(528, 448),
Show Control Panel(0),
Variables(X(:age), X(:sex), Y(mycol)), // won't work
Elements(Position(1, 1), Points(X, Y, Legend(6))),
Elements(Position(2, 1), Points(X, Y, Legend(7)))
);
gb = dt << Graph Builder(
Size(528, 448),
Show Control Panel(0),
Variables(X(:age), X(:sex), Y(Eval(mycol))), // might work
Elements(Position(1, 1), Points(X, Y, Legend(6))),
Elements(Position(2, 1), Points(X, Y, Legend(7)))
);
Eval(EvalExpr(
gb = dt << Graph Builder(
Size(528, 448),
Show Control Panel(0),
Variables(X(:age), X(:sex), Y(Expr(NameExpr(AsColumn(mycol))))), // works
Elements(Position(1, 1), Points(X, Y, Legend(6))),
Elements(Position(2, 1), Points(X, Y, Legend(7)))
)
));
Re: Agregar condiciones a las variables en el generador de gráficos en JSLGracias Jarmo por tu ayuda. Tu código funciona perfectamente bien, pero cuando implemento la misma técnica en mi código original, no funciona. Mi código crea varios generadores de gráficos y los agrega. Intenté eliminar variables después de cada generador de gráficos, pero no parece hacer ninguna diferencia.
Una versión simplificada del código que tengo es esta:
gb = {}; // initiate list
// loop through the test list
index = N Items( gb );//
gb[index + 1]= New Window( "Capability", hlb = H List Box() );
hlb << append(//
Graph Builder(
Size( 1800, 700),//
Variables(
X( :Temp, Position( 1 ) ),
X( :Location, Position( 1 ) ),
Y( TestList[i3] ), // this is
),
Elements( Histogram( X( 1 ), X( 2 ), X( 3 ), Y, Legend( 46 ), Means and Std Devs( 1 )),Smoother( X( 1 ), X( 2 ), X( 3 ), X( 4 ), Y, Legend( 49 ) ) ,Caption Box(
X( 1 ),
X( 2 ),
X( 3 ),
Y,
Legend( 51 ),
Summary Statistic( "Mean" ),
) ),
Local Data Filter(
.
.
.
.
.
.
.
),
SendToReport(
.
.
.
.
.
.
.
)
);
);
//end loop<BR />