作为分析的一部分,我有一个脚本可以创建多达八个非常相似的图。 图的数量可以根据是否存在相应的列而有所不同。 图中唯一的区别是用于 y 轴数据和标题的列。 为了提高效率,我试图避免只按顺序编写每个情节的脚本。 我尝试使用从预先建立的列名和标题列表中提取的 for 循环,但我无法让它工作。 这在 JMP 13 中真的可能吗? 我附上了我尝试过的脚本部分。
几个问题。
1. 您的 Graph Builder 代码有一个错位的“)”,它以解析错误结束代码。
2. :Name() 函数不解析元素,所以你不能有类似的东西: cols[f] 作为函数的值。它只需要传递一个带引号的字符串,
下面的代码解决了这两个问题
For( f = 1, f <= N Items( plots ), f++,
Eval(
Substitute(
Expr(
__plots__ = Graph Builder(
Size( 1267, 905 ),
Show Control Panel( 0 ),
Show Legend( 0 ),
Variables( X( :RPN, Order By( __col__ ), Descending, Order Statistic( "Mean" ) ) ),
Y( __col__ ),
Elements( Bar( X, Y, Legend( 4 ), Label( "Label by Value" ) ) ),
SendToReport(
Dispatch( {}, "Graph Builder", OutlineBox, {Set Title( outline titles[f] )} ),
Dispatch( {}, "RPN", ScaleBox, {Max( 10.5 ), Label Row( Label Orientation( "Angled" ) )} ),
Dispatch( {}, "400", ScaleBox, {Legend Model( 4, Properties( 0, {Fill Color( 53 )} ) )} ),
Dispatch( {}, "graph title", TextEditBox, {Set Text( plot titles[f] )} ),
Dispatch( {}, "X title", TextEditBox, {Set Text( "RPN" )} ),
Dispatch( {}, "Y title", TextEditBox, {Set Text( "Affected Lots" )} ),
Dispatch( {}, "400", LegendBox, {Set Title( "" )} )
)
)
),
Expr( __plots__ ), Parse( "Plots" || Char( f ) ),
Expr( __col__ ), Parse( ":Name(\!"" || Char( cols[f] ) || "\!")" )
)
)
);