Manejo de visualización condicional de variables del eje Y en JSL para la construcción de gráficosAl utilizar "graph built", ¿cómo puedo describir el requisito en JSL de que ciertas variables del eje Y, que no siempre aparecen, se muestren si tienen valores y no se muestren si no tienen valores? Los dos métodos siguientes no han sido efectivos.
1.
dt = Open("$SAMPLE_DATA/Big Class.jmp");
Graph Builder(
Size( 534, 450 ),
Show Control Panel( 0 ),
Variables( X( :sex ), try(Y( :bbb )), Y( :height ), Y( :weight ) ),
Elements( Position( 1, 1 ), Points( X, Y, Legend( 13 ) ) ),
Elements( Position( 1, 2 ), Points( X, Y, Legend( 14 ) ) ),
Elements( Position( 1, 3 ), Points( X, Y, Legend( 15 ) ) )
);2.
dt = Open("$SAMPLE_DATA/Big Class.jmp");
Graph Builder(
Size( 534, 450 ),
Show Control Panel( 0 ),
Variables( X( :sex ), Y( :bbb ), Y( :height ), Y( :weight ) ),
Elements( Position( 1, 1 ), Points( X, Y, Legend( 13 ) ) ),
Elements( Position( 1, 2 ), Points( X, Y, Legend( 14 ) ) ),
Elements( Position( 1, 3 ), Points( X, Y, Legend( 15 ) ) )
);Automatización y scriptingRe: Manejo de visualización condicional de variables del eje Y en JSL para la creación de gráficosHola @BabyDoragon , ¿bbb es una columna que existe o no y esto es lo que debemos verificar, o bbb siempre está allí pero faltan algunos valores (filas)?
Re: Manejo de visualización condicional de variables del eje Y en JSL para la creación de gráficosEl valor predeterminado de bbb es {} y, a veces, puede almacenarse como una variable, por ejemplo en los dos casos siguientes.
1.
dt = Open("$SAMPLE_DATA/Big Class.jmp");
bbb={};
bbb="age";
Graph Builder(
Size( 534, 450 ),
Show Control Panel( 0 ),
Variables( X( :sex ), Y( as column(bbb)), Y( :height ), Y( :weight ) ),
Elements( Position( 1, 1 ), Points( X, Y, Legend( 13 ) ) ),
Elements( Position( 1, 2 ), Points( X, Y, Legend( 14 ) ) ),
Elements( Position( 1, 3 ), Points( X, Y, Legend( 15 ) ) )
);2.
dt = Open("$SAMPLE_DATA/Big Class.jmp");
bbb={};
//bbb="age";
Graph Builder(
Size( 534, 450 ),
Show Control Panel( 0 ),
Variables( X( :sex ), Y( as column(bbb)), Y( :height ), Y( :weight ) ),
Elements( Position( 1, 1 ), Points( X, Y, Legend( 13 ) ) ),
Elements( Position( 1, 2 ), Points( X, Y, Legend( 14 ) ) ),
Elements( Position( 1, 3 ), Points( X, Y, Legend( 15 ) ) )
);Espero permitir que el gráfico incluya o excluya automáticamente este elemento en función de si hay alguna variable actualmente en bbb.
Re: Manejo de visualización condicional de variables del eje Y en JSL para la creación de gráficosPuedes crear la expresión o agregar la variable más tarde.
Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
gb = dt << Graph Builder(
Size(534, 450),
Show Control Panel(0),
Variables(X(:sex), Y(:height), Y(:weight)),
Elements(Position(1, 1), Points(X, Y, Legend(13))),
Elements(Position(1, 2), Points(X, Y, Legend(14)))
);
dt << new column("A", Numeric, Continuous, Formula(Row()));
extra_cols = {"height", "A"};
For Each({extra_col}, extra_cols,
Eval(EvalExpr(
gb << Add Variable({Expr(NameExpr(AsColumn(dt, extra_col))), Role("Y")});
));
);
Dependiendo de lo que estés intentando hacer, puede haber bastantes cosas a tener en cuenta (orden, tipo de gráficos, leyenda, ...)
Si recuerdo correctamente, esto podría tener algo relacionado con este tema Scripters Club Recording: JSL en Graph Builder