Hola todos,
Me gustaría llenar algunas barras para variables específicas automáticamente con patrones de relleno predefinidos. Sin embargo, el número de variables está cambiando y me gustaría hacerlo en iteración dependiendo de qué variables se guardan actualmente en una tabla de datos. En este caso, necesito proporcionar un argumento para el Patrón de relleno () como un índice (que no parece funcionar) o alguna referencia de una lista, pero para eso necesitaría una lista de patrones de relleno. Entonces podría usar el índice del elemento en una lista. Agradecería ayuda para hacer eso.
Atentamente
Graph Builder(
Size( 734, 660 ),
Variables( //that would be good to have it in iteration
X( :Run ),
Y( :Param0 ),
Y( :Param1, Position( 2 ) ),
Y( :Param2, Position( 2 ) ),
Y( :Param3, Position( 2 ) ),
// there is much more of such variables to be displayed
),
Elements( Position( 1, 1 ), Points( X, Y, Legend( 455 ) ) ),
Elements( //that would be good to have it in iteration
Position( 1, 2 ),
Bar(
X,
Y( 3 ),
Y( 5 ),
Y( 6 ),
Y( 7 ),
Legend( 454 ),
Bar Style( "Stacked" )
)
),
SendToReport(
Dispatch(
{},
"400",
ScaleBox,
{Legend Model(
455,
Properties( 0, {Line Color( 25 )}, Item ID( "Param0", 1 ) )
), Legend Model(
454,
//that would be good to have it in iteration
Properties(
0,
{Fill Pattern( "left slant light" )},
Item ID( "Mittelwert(Param1)", 1 )
),
Properties(
2,
{Fill Pattern( "right slant light" )},
Item ID( "Mittelwert(Param2)", 1 )
),
Properties(
3,
{Fill Pattern( "grid heavy" )},
Item ID( "Mittelwert(Param3)", 1 )
),
// there is much more of such properties
)}
),
Dispatch( {}, "graph title", TextEditBox, {Set Text( "" )} ),
Dispatch(
{},
"400",
LegendBox,
{Legend Position(
{455, [0], 454, [10, -1, 1, 11]}
), Position(
{0, 10, -1, 1, 11}
)}
)
)
);
EDITAR:
Comencé a resolver el problema anterior mediante el uso de expresiones a las que se pueden pasar datos.
Quería establecer las propiedades de una leyenda de un gráfico de barras en "for-loop" e insertar en legend_model_expr definido antes del for-loop. Luego sustituiría esa expresión en un lugar apropiado en Graph Builder. En este caso ocurrieron dos problemas. En primer lugar, si ambos comentarios de "insertar en" están comentados, se produce un error:
Nombre no resuelto: Propiedades al acceder o evaluar propiedades. ¿Estoy usando eso correctamente? En segundo lugar, si descomento ambos "insertar en" (o incluso uno de ellos), se muestra otro error: Demasiados argumentos al acceder o evaluar For.
Agradecería por pistas de lo que me estoy perdiendo. Atentamente.
//pattern list
fill_patterns_shuffled = {"left slant light", "horizontal light", "right slant light", "vertical light"};
//list of parameters, it can change depending on data available
list2 = {"Param1", "Param2", "Param3"};
legend_model_expr = Expr( Legend Model (53) );
For( c = 1, c <= N Items( list2 ), c++,
y_expr3 = Eval(Parse( "Properties( " || char(c-1) || ", {Fill Pattern( \!"" || fill_patterns_shuffled[ c ] || "\!") }, Item ID( \!"Mittelwert(" || char(list2[ c ]) || ")\!", 1 ) ),"
),
),
//write(y_expr3);
//Insert Into( y_expr3, 1 );
//Insert Into( legend_model_expr, Name Expr( y_expr3) );
);EDITAR:
Ok, al usar Eval JMP busca la función "Propiedades", que en realidad no existe, por lo que probablemente es por eso que ocurre un error. Sin embargo, queda el segundo error.
Ok, lo tengo funcionando. A continuación pegué un código correcto. Atentamente
//legend
legend_model_expr = Expr( Legend Model (26) );
For( c = 1, c <= N Items( list2 ), c++,
y_expr3 = substitute(expr( Properties( c1, {Fill Pattern( fill ) }, Item ID( "Mittelwert(" || name || ")" , 1 ), ), ), expr(c1), c, expr(fill), char(fill_patterns_shuffled[c]), expr(name), list2[c]);
//show(y_expr3);
Insert Into( y_expr3, "");
Insert Into( legend_model_expr, Name Expr( y_expr3) );
);