作為分析的一部分,我有一個腳本可以創建多達八個非常相似的圖。 圖的數量可以根據是否存在相應的列而有所不同。 圖中唯一的區別是用於 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] ) || "\!")" )
)
)
);