やあ、
(コンテキストに関する注意:データセット内の各ラベル(A、B、C、D、およびE)のグラフの作成を自動化するグラフテンプレート(添付のスクリプトを参照)に取り組んでおり、それを同じ出力ウィンドウに追加します簡単にエクスポートして共有できます。 ここでは、スクリプトの何が問題になっているのかを証明するための例として、ラベル「A」の単一のグラフを使用しています。 )。
モーダルウィンドウでのユーザー選択から選択したGroup-by変数をJMPスクリプトが読み取れないという問題が発生しています。 以下の例のように、任意のgroup-by変数であり、凡例と色分けスキームを持つデータから「groupby」列名を選択するようにユーザーに求めています。

添付のJMPデータテーブルでは、おもちゃのデータに一般的な「グループ」列があります。 ただし、ユーザーはテーブルから任意の文字変数(製造サイト、バッチ、プロセス、定式化など)を選択し、グループ化された凡例と色分けスキームを使用できる必要があります。
これが私のJMPスクリプトです。
//select the data in the original data table
Names Default To Here( 1 );
dt = Current Data Table();
/*
2/28/2022 Edit
get column names to
1. get x-axis variable
2. get grouping variable for coloring the dots
- needs to be a none option for when there is no group
- logic statement later if set_groupby is "none", then no
-
Also, ask user what coloring scheme should be used.
JMP auto color (blue and red) or none (if manually coloring by, for example, batch ID)
see source: https://www.jmp.com/support/help/zh-cn/15.2/index.shtml#page/jmp/get-column-names.shtml
*/
column_names = dt << Get Column Names( Numeric, character, String );
//TO DO:
//names_for_groupby_select =
//group by should be a character variable only, so
<FONT color="#FF0000">groupby_col_names = dt << Get Column names(character, String);</FONT>
nw1 = New Window("Set X-axis and group by variable",
<<MODAL>groupby_col = Radio Box(groupby_col_names),
H List Box(
Button Box("OK",
answers = Eval List({set_xlabel = xaxisselect << get selected,
<FONT color="#FF0000">set_groupby = groupby_col << get selected</FONT>
});
nw1 << close window;
),
Button Box("Cancel")),
//change popup window size
<<SIZE window=""> 9, 5);
// generic chart (can be control chart or process chart)
Oneway(
SendToByGroup( {:Name("Label (y-axis)") == label_val},
Y( :Result ),
X( char(set_xlabel) ), //:Name("x axis") ),
Connect Means( 1 ),
Grand Mean( 0 ),
SendToReport(
Dispatch(
{},
"Result",
TextEditBox,
{Set Text( label_val || units_formatted )}
),
//font size:
Dispatch(
{},
"2",
ScaleBox,
{Label Row( Set Font Size( font_size ) )}
),
//graph stuff:
Dispatch(
{},
"Oneway Plot",
FrameBox,
{Frame Size( 1000, 300 ), DispatchSeg(
CustomStreamSeg( 6 ),
{Line Color( "Gray" )}
),
<FONT color="#FF0000">Row Legend(
//group by this
//:Name("Group"), //or just Group works too
char(set_groupby), // << need to be specified by user.
//set_groupby, // TO DO: fix this bug!</FONT>
Color( 1 ),
Color Theme( "JMP default" ), // TO DO: << needs to be specified by user.
Marker( 0 ),
Marker Theme( "" ),
Continuous Scale( 0 ),
Reverse Scale( 0 ),
Excluded Rows( 0 )
)}
)
)
)
);
);
container << Append(content)
);</SIZE></MODAL>
このJMPスクリプトでは、x軸の列の選択が機能するため(モーダルウィンドウの例と以下の結果のグラフを参照)、group-by変数の参照も機能すると想定しました。 ただし、出力には、group-by変数または凡例がないグラフが生成されます。 私のコードはここで間違って何をしていますか?
モーダルウィンドウ:

ラベル「A」のJMP出力例グラフ

私は経由で問題を理解しましたこの郵便受け。
char(set_groupby)の代わりにColumn(listDT、set_groupby)を使用する。
Row Legend(
//group by this
Column(listDT,set_groupby),
Color( 1 ),
Color Theme( "JMP default" ),
Marker( 0 ),
Marker Theme( "" ),
Continuous Scale( 0 ),
Reverse Scale( 0 ),
Excluded Rows( 0 )
)}Eval()を使用することもできます
Row Legend(
//group by this
Eval(set_groupby),
Color( 1 ),
Color Theme( "JMP default" ),
Marker( 0 ),
Marker Theme( "" ),
Continuous Scale( 0 ),
Reverse Scale( 0 ),
Excluded Rows( 0 )
)}