Función de bucle de elementos del generador de gráficos¿Cómo puedo utilizar la función de bucle para la definición de múltiples posiciones?
Si se separa como se muestra a continuación, funcionará:
Eval(
Substitute(
Expr(
gb = cdt << Graph Builder(
Size( 600, 800 ),
Show Control Panel( 0 ),
vvv,
Elements(Position( 1, 1 ),
Points( X, Y( 1 ), Y( 2 ), Y( 3 ), Legend( 3 ) ),
Smoother( X, Y( 1 ), Y( 2 ), Y( 3 ), Legend( 4 ) )
),
Elements(
Position( 2, 1 ),
Box Plot( X, Y, Outliers( 0 ) ),
Points( X, Y ),
Bar( X, Y, Bar Style( "Float" ), Label( "Label by Value" ) ),
Legend( 6 )
),
Elements(
Position( 2, 2 ),
Box Plot( X, Y, Outliers( 0 ) ),
Points( X, Y ),
Bar( X, Y, Bar Style( "Float" ), Label( "Label by Value" ) ),
Legend( 7 )
),
Elements(
Position( 2, 3 ),
Box Plot( X, Y, Outliers( 0 ) ),
Points( X, Y ),
Bar( X, Y, Bar Style( "Float" ), Label( "Label by Value" ) ),
Legend( 8 )
)
)
),
Expr( vvv ),
Name Expr( var expr )
)
);Pero si al usar un bucle de esta manera solo tiene la barra, ¿qué falta en este código?
Eval(
Substitute(
Expr(
gb = cdt << Graph Builder(
Size( 600, 800 ),
Show Control Panel( 0 ),
vvv,
Elements(Position( 1, 1 ),
Points( X, Y( 1 ), Y( 2 ), Y( 3 ), Legend( 3 ) ),
Smoother( X, Y( 1 ), Y( 2 ), Y( 3 ), Legend( 4 ) )
),
For( j = 1, j <= n_mydatecol, j++,
Elements(
Position( 2, j ),
Box Plot( X, Y, Outliers( 0 ) ),
Points( X, Y ),
Bar( X, Y, Bar Style( "Float" ), Label( "Label by Value" ) ),
Legend(eval( 5 + j ))
),
),
)
),
Expr( vvv ),
Name Expr( var expr )
)
);
Automatización y scriptingVentanasRe: Función de bucle de elementos del generador de gráficosPuedes crear las expresiones de elementos por separado y luego evaluarlas dentro del generador de grafos. En algunos casos, podría ser más fácil usar "Añadir Elemento".
Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
gb = Graph Builder(Variables(X(:height), Y(:weight)), Elements(Points(X, Y), Smoother(X, Y)));
Wait(0.5);
gb << Add Element(1, 1, {Type("Line Of Fit"), X, Y, Degree("Quadratic")});Re: Función de bucle de elementos del generador de gráficosMi gráfico quiere ser así, ¿necesito definir la posición?

Re: Función de bucle de elementos del generador de gráficosAgregar elemento le permite configurar la posición X e Y. ¿Probó si funcionaría para su caso de uso?
Re: Función de bucle de elementos del generador de gráficosHola Jarmo,
Intente usar el código a continuación, pero aún así solo muestra el diagrama de cuadro, ¿cómo puedo mostrar la barra y la etiqueta?

Eval(
Substitute(
Expr(
gb = cdt << Graph Builder(
Size( 1200, 800 ),
Show Control Panel( 0 ),
vvv,
Elements(
Position( 1, 1 ),
Points( X, Y( 1 ), Y( 2 ), Y( 3 ), Legend( 3 ) ),
Smoother( X, Y( 1 ), Y( 2 ), Y( 3 ), Legend( 4 ) )
)
);
// Loop to add repetitive elements
For( i = 2, i <= 10, i++,
gb << Add Elements(
Position( 2, i ),
Box Plot( X, Y( 1 ), Y( 2 ), Y( 3 ), Legend( 2 * i + 1 ) ),
Bar( X, Y, Legend( 2 * i + 2 ), Bar Style( "Float" ), Label( "Label by Value" ), Label Format( "Fixed Dec", 5, 2 ) )
);
);
),
Expr( vvv ),
Name Expr( var expr )
)
);
Re: Función de bucle de elementos del generador de gráficosTendré que crear datos de ejemplo (o encontrar unos apropiados) y volver a crear el gráfico, por lo que llevará algún tiempo.
Re: Función de bucle de elementos del generador de gráficosVeo que todas las imágenes han cambiado por completo... No estoy seguro de si los scripts proporcionados se corresponden con las nuevas imágenes. ¿Qué columnas habría que añadir dinámicamente y dónde?
Script de creación de gráficos para esto

se parece a algo así
Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
gb = dt << Graph Builder(
Size(528, 454),
Show Control Panel(0),
Variables(X(:height), X(:sex), Y(:weight)),
Elements(
Position(1, 1),
Points(X, Y, Legend(5)),
Smoother(X, Y, Legend(6)),
Line Of Fit(X, Y, Legend(8))
),
Elements(
Position(2, 1),
Points(X, Y, Legend(18)),
Bar(X, Y, Legend(19), Bar Style("Float"), Label("Label by Value"))
)
);
Si tiene un gráfico como este y desea agregarle un gráfico de barras flotante en el lado derecho con puntos

Puedes usar el elemento adicional
gb << Add Element(2, 1, {Type("Bar"), X, Y, Bar Style("Float"), Label("Label by Value")});
Ver más...
Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
gb = dt << Graph Builder(
Size(528, 454),
Show Control Panel(0),
Variables(X(:height), X(:sex), Y(:weight)),
Elements(
Position(1, 1),
Points(X, Y, Legend(5)),
Smoother(X, Y, Legend(6)),
Line Of Fit(X, Y, Legend(8))
),
Elements(
Position(2, 1),
Points(X, Y, Legend(18))
)
);
gb << Add Element(2, 1, {Type("Bar"), X, Y, Bar Style("Float"), Label("Label by Value")});
Re: Función de bucle de elementos del generador de gráficosHola Jarmo,
Gracias por la ayuda. Funcionaría si el eje Y solo tuviera uno, pero quiero saber si, si hay varios ejes Y, puedo usar la función de bucle para que el elemento tenga un diagrama de caja y una barra. Intenté lo mismo que el primero, pero solo mostraba el diagrama de caja sin barras.
Re: Función de bucle de elementos del generador de gráficosNo estoy seguro de qué estás trazando, pero podría funcionar (o no). Aquí estoy usando "Añadir elemento" para añadir un gráfico de barras al eje X 2 y a los ejes Y 1 y 2.
Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
gb = dt << Graph Builder(
Size(528, 454),
Show Control Panel(0),
Variables(X(:height), X(:sex), Y(:name), Y(:weight)),
Elements(Position(1, 1), Points(X, Y, Legend(20))),
Elements(
Position(1, 2),
Points(X, Y, Legend(5)),
Smoother(X, Y, Legend(6)),
Line Of Fit(X, Y, Legend(8))
),
Elements(Position(2, 1), Points(X, Y, Legend(19))),
Elements(Position(2, 2), Points(X, Y, Legend(18)))
);
gb << Add Element(2, 1, {Type("Bar"), X, Y, Bar Style("Float"), Label("Label by Value")});
gb << Add Element(2, 2, {Type("Bar"), X, Y, Bar Style("Float"), Label("Label by Value")});

Re: Función de bucle de elementos del generador de gráficosFunciona y lo intento así.
Muchas gracias
Eval(
Substitute(
Expr(
gb = cdt << Graph Builder(
Size( 600, 800 ),
Show Control Panel( 0 ),
vvv,
Elements(Position( 1, 1 ),
Points( X, Y( 1 ), Y( 2 ), Y( 3 ), Legend( 3 ) ),
Smoother( X, Y( 1 ), Y( 2 ), Y( 3 ), Legend( 4 ) )
),
);
For( i = 1 , i <= n_mymetric , i++,
gb << Add Element(2, i, {Type("Bar"), X, Y, Bar Style("Float"), Label("Label by Value")});
),
),
Expr( vvv ),
Name Expr( var expr )
)
);