フィルター変更ハンドラーを使用してグラフ ビルダーのページ オプションを操作するにはどうすればよいですか?データテーブルの例を添付します。以下のスクリプトは、ローカル データ フィルターを介して選択された各パラメーターをグラフ ビルダーの新しい「ページ」にプロットしようとします。現状では、ローカル データ フィルターで新しい「パラメーター」が選択されるたびに、y 軸のタイトルが「中央値」として表示されます。
新しいパラメータが選択されて新しい「ページ」にプロットされるときに、パラメータ名をY軸のタイトルにしたいと考えています。
これにフィルター変更ハンドラーを使用しようとしましたが、スクリプトが完全に機能しません。新しいパラメータが選択されるたびに、以下のインデックスiを更新する必要があると思います。または、別の方法があるかもしれません。どの方向でも役に立ちます。
XPath( "//TextEditBox" ))[i]
これが私のスクリプトです
Names Default To Here (1);
Clear Log ();
gb = Graph Builder(
Size( 531, 325 ),
Show Control Panel( 0 ),
Variables( X( :PartID ), Y( :Median ), Page( :Parameter ), Color( :TestStage ) ),
Elements( Points( X, Y, Legend( 34 ) ) ),
Local Data Filter(
Conditional,
Add Filter(
columns( :TestStage, :Parameter ),
Where( :TestStage == {"A", "B"} ),
Where( :Parameter == {"BKDVoltage", "Capacitance"} )
)
),
SendToReport( Dispatch( {}, "graph title", TextEditBox, {Set Text( "myTitleGoesHere" )} ) )
);
ldf = Current Report()["Local Data Filter"] << get scriptable object;
changeTitle = Function( {this},
print(this);
ldfText = Regex(ldf << get where clause(),"\(?\s*(:Parameter == .*?)\)","\1");
if(ismissing(ldfText),ldfText = " Selected Test Parameter ");
(Report( gb ) << XPath( "//TextEditBox" ))[6] << Set Text(ldfText);
);
fsh = ldf << Make Filter Change Handler(changeTitle());自動化とスクリプト作成ウィンドウズRe: フィルター変更ハンドラーを使用してグラフ ビルダーのページ オプションを操作する方法は?XPath クエリをより正確にすることを試みることができます (XML とプロパティ ツリーを調べます)。このようなものはうまくいくかもしれません
Report(gb) << XPath("//GraphBuilderTitleBox/TextEditBox[text()='Median']")Re: フィルター変更ハンドラーを使用してグラフ ビルダーのページ オプションを操作する方法は?@jthiこれは部分的には機能しますが、選択されたすべてのパラメータは、すべてのプロットされたチャートのY軸タイトルとして相互に表示されます。
私が変更され
(Report( gb ) << XPath( "//TextEditBox" ))[6] << Set Text(ldfText);
に
(Report(gb) << XPath("//GraphBuilderTitleBox/TextEditBox[text()='Median']")) << Set Text(ldfText);そして手に入れる

各グラフの Y 軸タイトルとしてプロットされたパラメータ名のみが必要です。
Re: フィルター変更ハンドラーを使用してグラフ ビルダーのページ オプションを操作する方法は?1 つのオプションは、get where 句を解析することです
ldfText = Regex(ldf << get where clause(),"\(?\s*(:Parameter == .*?)\)","\1");
別々の項目に分割し、それらをループして、ループ内でタイトルを設定します。
編集:
これには、y 軸のテキスト編集ボックスへの参照を取得する部分にも少し変更を加える必要があります。以下は機能する可能性のあるオプションの1つです
Names Default To Here (1);
dt = Open("$DOWNLOADS/exampleSummaryTable.jmp");
gb = dt << Graph Builder(
Size( 531, 325 ),
Show Control Panel( 0 ),
Variables( X( :PartID ), Y( :Median ), Page( :Parameter ), Color( :TestStage ) ),
Elements( Points( X, Y, Legend( 34 ) ) ),
Local Data Filter(
Conditional,
Add Filter(
columns( :TestStage, :Parameter ),
Where( :TestStage == {"A", "B"} ),
Where( :Parameter == {"BKDVoltage", "Capacitance"} )
)
),
SendToReport( Dispatch( {}, "graph title", TextEditBox, {Set Text( "myTitleGoesHere" )} ) )
);
update_title = Function( {this},
param_where = Regex(local_filter << get where clause(),"\(?\s*(:Parameter == .*?)\)","\1");
param_where_list = Words(param_where, "|");
tebs = Report(gb) << XPath("//GraphBuilderTitleBox/TextEditBox");
y_tebs= tebs[4::N Items(tebs)::2];
If(N Items(y_tebs) != N Items(param_where_list),
return(); // some problem
);
For Each({where_str, idx}, param_where_list,
title = Trim Whitespace(Word(-1, where_str, "="));
Substitute Into(title, "\!"", "");
y_tebs[idx] << Set Text(title);
);
);
local_filter = Current Report()["Local Data Filter"] << get scriptable object;
filter_handler = local_filter << Make Filter Change Handler(update_title());
Re: フィルター変更ハンドラーを使用してグラフ ビルダーのページ オプションを操作する方法は?@jthiこれは、最初のグラフ(フィルター変更ハンドラーの子供の前)がまだy軸タイトルとして中央値を持っていることを除いて機能します。これを修正する方法はありますか?

Re: フィルター変更ハンドラーを使用してグラフ ビルダーのページ オプションを操作する方法は?フィルター変更ハンドラーを作成する前に関数を 1 回トリガーします。
update_title(local_filter);

Re: フィルター変更ハンドラーを使用してグラフ ビルダーのページ オプションを操作する方法は?@jthiわかりました。トリガーに注目しました。パラメーター名にアンダースコアが含まれている場合、スクリプトは機能しません (実際のデータのパラメーター名にはアンダースコアがほとんどありません)。パラメータ名にアンダースコアを付けたデータテーブルの例。以下のスクリプトは、データ テーブルが添付されているWords関数でエラーをスローします。
また、 Size()をコメントする必要がありました。コメントなしでは、最初のチャートが奇妙に見えました。
Names Default To Here (1);
clear log ();
dt = Current Data Table();
gb = dt << Graph Builder(
//Size( 531, 525 ),
Show Control Panel( 0 ),
Variables( X( :PartID ), Y( :Median ), Page( :Parameter ), Color( :TestStage ) ),
Elements( Points( X, Y, Legend( 34 ) ) ),
Local Data Filter(
Conditional,
Add Filter(
columns( :TestStage, :Parameter ),
Where( :TestStage == {"A", "B"} ),
Where( :Parameter == {"BKDVoltage_1", "Capacitance_1"} )
)
),
SendToReport( Dispatch( {}, "graph title", TextEditBox, {Set Text( "myTitleGoesHere" )} ) )
);
update_title = Function( {this},
param_where = Regex(local_filter << get where clause(),"\(?\s*(:Parameter == .*?)\)","\1");
param_where_list = Words(param_where, "|");
tebs = Report(gb) << XPath("//GraphBuilderTitleBox/TextEditBox");
y_tebs= tebs[4::N Items(tebs)::2];
If(N Items(y_tebs) != N Items(param_where_list),
return();
);
For Each({where_str, idx}, param_where_list,
title = Trim Whitespace(Word(-1, where_str, "="));
Substitute Into(title, "\!"", "");
y_tebs[idx] << Set Text(title);
);
);
local_filter = Current Report()["Local Data Filter"] << get scriptable object;
update_title(local_filter);
filter_handler = local_filter << Make Filter Change Handler(update_title());Re: フィルター変更ハンドラーを使用してグラフ ビルダーのページ オプションを操作する方法は?問題は、パラメーターとして複数の応答列があることが最も考えられます。


Re: フィルター変更ハンドラーを使用してグラフ ビルダーのページ オプションを操作する方法は?@jthiありがとうございます。パラメーターのプロパティから複数の応答を削除すると、サンプル データ (examplesummaryTable2) に対してスクリプトが機能するようになります。しかし、複数応答セットが設定された列がないという実際のデータセットでは依然として問題が発生しています(残念ながら実際のデータを共有できません)。他に何があるでしょうか?

Re: フィルター変更ハンドラーを使用してグラフ ビルダーのページ オプションを操作する方法は?これは本来のものを返していません
param_where = Regex(local_filter << get where clause(),"\(?\s*(:Parameter == .*?)\)","\1");
理由の 1 つは、ローカル データ フィルターで値が選択されていないことです。欠損値の追加チェックを追加し、param_where が欠落している場合は、何もせずに関数から早期に戻ることができます (または、すべての値がパラメータとしてあり、パラメータ値を他の方法で取得する必要があります)
Re: フィルター変更ハンドラーを使用してグラフ ビルダーのページ オプションを操作する方法は?@jthi実際のデータの場合、コメントアウトすると
update_title(local_filter);
のように
local_filter = Current Report()["Local Data Filter"] << get scriptable object;
//update_title(local_filter);
filter_handler = local_filter << Make Filter Change Handler(update_title());
最初のグラフに正しい Y 軸タイトルがないことを除いて、すべてが期待どおりに機能します。 Y 軸のタイトルは、別の TestStage が選択された後にのみ正しくなります。私の配置は
update_title(local_filter);
正しいですか、それとも別の場所に配置する必要がありますか?