こんにちは皆さん、
私は 1 年前から JMP15 を使用していますが、スクリプトに興味を持ち始めたばかりです。
テーブルに基づいて、グラフに参照線を表示するスクリプトを作成したいと思います。
データ(スクリプトを実行して value=f(time) をプロットする)と日付の 2 つのテーブルがあり、グラフに表示したい参照線に対応する日付を含む 1 つの列が含まれています。
これらの表は私の投稿に添付されています。
これが現在のスクリプトで、テーブルの日付の最初の要素である列の日付に基づいて 1 つの参照行を表示しています。
ref1 = dates:name( "date" )[1];
Graph Builder(
Variables( X( :time ), Y( :value ),Page(:cat) ),
Elements( Points( X, Y, Legend( 4 ), Summary Statistic( "Mean" ) ) ),
SendToReport( Dispatch( {}, "time", ScaleBox( 2 ), {Add Ref Line( ref1, "Dotted", "Red", "", 2 )} ) )
);「For」ループを作成して、テーブル「日付」の各値の参照行を自動的に作成したいと考えています。
これが私が試したことです:
ref1 = dates:name( "date" )[1];
Graph Builder(
Variables( X( :time ), Y( :value ),Page(:cat) ),
Elements( Points( X, Y, Legend( 4 ), Summary Statistic( "Mean" ) ) ),
SendToReport( Dispatch( {}, "time", ScaleBox( 2 ),
{
For( i = 1, i <= N row( dates), i++,
f = dates [ i ];
Add Ref Line( f, "Dotted", "Blue", "", 2 )
);
})
);しかし、スクリプトを実行すると、参照線が表示されません。
この問題はどうすれば解決できますか?
最後の質問: グラフ変数に「Page(:cat)」を追加しないと、参照線が表示されません...
助けてくれてありがとう !!
ディスカッションコミュニティへようこそ!
参照線を追加する1つの方法は次のとおりです

表示ツリーを使用してJMP出力を操作する方法に関するドキュメントは、スクリプトインデックスにあります。
Names Default To Here( 1 );
dt = Data Table( "data" );
dates = Data Table( "dates" );
ref1 = dates:name( "date" )[1];
gb = Graph Builder(
Variables( X( :time ), Y( :value ), Page( :cat ) ),
Elements( Points( X, Y, Legend( 4 ), Summary Statistic( "Mean" ) ) ),
SendToReport(
Dispatch( {}, "time", ScaleBox( 2 ), {Add Ref Line( ref1, "Dotted", "Red", "", 2 )} )
)
);
// Add reference lines
For( i = 1, i <= N Rows( dates ), i++,
// Add for Cat = B
(Report( gb )[axisbox( 1 )]) << add ref line( dates:date[i], "Dotted", "Blue", "", 2 );
// Add for Cat = C
(Report( gb )[axisbox( 3 )]) << add ref line( dates:date[i], "Dotted", "Blue", "", 2 );
);