こんにちは、jmp スクリプト言語は初めてです。 以下のコードは機能します(列3からnまでの棒グラフを表示します)が、やりたいことが1つあります。 出力がすべての縦棒の積み上げ棒グラフになるようにスクリプトを作成するにはどうすればよいですか?
for(i=3,i<=NItems(colList2),i++,
gb= dt4 <<グラフビルダー(
サイズ(534,454)、
コントロールパネルを表示(0)、
変数(
X(:ラベル),Y(eval(Column(dt4,colList2[i]))),
)、
要素(バー(X,Y))
));
異なる数の受信 Y 列をカバーするように拡張できる単一のステートメントはありません。したがって、基本的な形式を取得し、列数に応じて動的に作成する必要があります。
基本的な形はこちら
Graph Builder(
Size( 534, 450 ),
Show Control Panel( 0 ),
Variables(
X( :SITE ),
Y( :NPN1 ),
Y( :PNP1, Position( 1 ) ),
Y( :PNP2, Position( 1 ) ),
Y( :NPN2, Position( 1 ) ),
Y( :PNP3, Position( 1 ) )
),
Elements(
Bar(
X,
Y( 1 ),
Y( 2 ),
Y( 3 ),
Y( 4 ),
Y( 5 ),
Legend( 4 ),
Bar Style( "Stacked" )
)
)
);
これは私が作成した積み上げ棒グラフを動的に構築するサンプル スクリプトです。
names default to here(1);
dt=open("$SAMPLE_DATA/Blood Pressure.jmp");
// Get all of the continuous data columns
colList = dt << get column names(continuous,string);
// Create the JSL to create the script
theExpr = "Graph Builder(
Size( 534, 450 ),
Show Control Panel( 0 ),
Variables(
X( :Dose ),";
// Add the first Y entry
theExpr = theExpr || "Y( :" || colList[1] || " )";
// Add the remaining Y entries
For( i=2, i<= n items(colList), i++,
theExpr = theExpr || ", Y( :" || colList[i] || ", Position( 1 ) )";
);
// Finish up the Variables list, and start the Elements
theExpr = theExpr || "), Elements( Bar(X, Y( 1 )";
// Add the remaining Y elements
For( i=2, i<= n items(colList), i++,
theExpr = theExpr || ", Y( " || char(i) || " )";
);
// Finish up the required specifications
theExpr = theExpr || ",
Legend( 4 ),
Bar Style( \!"Stacked\!" )
)
)
);";
// Run the created JSL
eval(parse(theExpr));
それが生み出すのは

返信してくれてありがとう! グラフビルダーを対話的に使用せずに、異なる列名の異なるデータセットでスクリプトを自動的に実行するには、どうすればよいかわかりますか?
@txnelson書きました:
インタラクティブにグラフ ビルダーに移動し、希望どおりにグラフを作成したら、赤い三角形に移動して [スクリプトの保存] を選択するだけです。 JMP は JSL を作成します。