大家好,
我想用预定义的填充模式自动填充一些指定变量的条。但是,变量的数量正在变化,我想根据当前存储在数据表中的变量来进行迭代。在这种情况下,我需要向Fill Pattern()提供参数作为索引(似乎不起作用)或列表中的某些引用,但为此,我需要一个填充模式列表。然后我可以在列表中使用项目的索引。我将为您提供帮助,以帮助您完成此操作。
最好的祝福
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}
)}
)
)
);
编辑:
我开始通过使用可以将数据传递到的表达式来解决上述问题。
我想在“ for-loop”中设置条形图图例的属性,然后插入到for-loop之前定义的legend_model_expr中。然后,我将该表达式替换为Graph Builder中的适当位置。在这种情况下,发生了两个问题。首先,如果两个“插入”命令都被注释,则会发生错误:
名称未解析:访问或评估属性时的属性。我使用正确吗?其次,如果取消对两个“插入”(甚至其中一个)的注释,则会显示另一个错误: 访问或评估For时,参数过多。
我会很想得到我所缺少的提示。最好的祝福。
//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) );
);编辑:
好的,通过使用Eval JMP查找“属性”功能,该功能实际上不存在,因此很可能就是发生错误的原因。但是,第二个错误仍然存在。
好吧,我知道了。下面我粘贴了正确的代码。最好的祝福
//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) );
);