707228_ja-JP
変数モデリング タイプに応じてグラフ ビルダーのグラフ タイプを動的に変更する

このレシピでは、ユーザーが列スイッチャーで連続 x 軸変数を選択するかカテゴリカル x 軸変数を選択するかに応じて、グラフ ビルダーの要素タイプを動的に変更する方法を示します。要素は、グラフ ビルダー パレットの上部にアイコンとして表示されるグラフ タイプです。連続入力の場合、ラジオ ボタンが追加され、ユーザーは Line of Fit と Contour のどちらかを選択できます。このレシピは、JMP の専門家ではなく、限られた数のオプションしか必要としない人向けにインタラクティブなチャートを作成する場合に役立ちます。
材料:サンプルデータ表– ビッグクラス
の難易度– ハード
ステップ- Start with 名前のデフォルトはここ(1) and open ビッグクラス.
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
- Create a function which sends a message to the グラフビルダー platform that removes the existing element then adds a new one. It assumes that the ポイント element is already displayed and is element number 1, therefore the element to be removed is number 2.
// This function changes the type of chart being displayed.
// It takes a reference to a Graph Builder report (gbr) and the chart type required (gr)
// At the moment it assumes the Points element will always be included
changeElement = function( {gbr, gr},
{default local},
Eval(
Substitute(
Expr(
gbr << remove element( 1, 1, 2 ) << add element( 1, 1, {Type( __aa__ ), X, Y} )
), Expr( __aa__ ), gr
)
)
);
- Create the new window which contains the column switcher (cs) to change the x-axis, a radio box (RB) to control the element type for continuous variables, and the Graph Builder (ギガバイト).
rb_out = "Line of Fit";
win1 = New Window( "Demo",
Text Box(
"Column switching between continuous and nominal variables will change line of fit to box plots",
<<SET wrap=""></SET>
<P>列スイッチャーはグラフ ビルダーの外部で意図的に作成されるため、スイッチャーが変更されたときにアクションを実行する関数を後で作成できます。</P>
<OL start="6">
<LI>Link the column switcher <FONT face="courier new,courier">cs</FONT> to the Graph Builder <FONT face="courier new,courier">ギガバイト</FONT>
<PRE><CODE class=" language-jsl">cs << link platform( gb );
Create a Column Switch Handler. The function post is called by the handler once the change has been completed. The format comes directly from the Scripting Index.
post = Function( {previousColumn, currentColumn, switcher},
gbr = Report( gb )[GraphBuilderBox( 1 )];
If( Column( dt, cs << get current ) << get modeling type == "Continuous",
changeElement( gbr, rb_out ),
changeElement( gbr, "Box Plot" )
);
);
cs << Make Column Switch Handler( 1, post );
切り替えが完了するまでは何も起こる必要がないため、 Make Column Switch Handlerの最初の引数は何も行わないことに注意してください。
Finally, start the column switcher running for demo purposes.
cs << run();
潜在的な変動:
- 「事前」変更関数を作成します。この関数は、グラフ ビルダー内の既存の要素を反復処理し ( << Get Elementsを使用)、削除する必要がある要素を見つけて、 (それに依存するのではなく) <<削除要素の 3 番目の引数をプログラムで設定します。 2 番目の要素です)。
<LINGO-LABS id="lingo-labs-707228" slang="en-US" mode="UPDATE"><LINGO-LABEL>自動化とスクリプト作成</LINGO-LABEL><LINGO-LABEL>デザート</LINGO-LABEL></LINGO-LABS>
Comments
There are no comments yet