こんにちは。 標準のグラフを使用しても、グラフ ビルダーのように空のバーが削除されないため、グラフ ビルダーで棒グラフのスクリプトを作成しています。 X ファクターとして連続モデリング タイプを使用できるようにしています。 私がこれにどのようにアプローチしているかを説明しましょう。
ユーザーは、棒グラフをプロットするためのいくつかの列を選択します。 グラフ ビルダーを使用してグラフを作成し、最初の列を選択します。 次に、複数の列が選択されている場合は、グラフ ビルダーに移動し、<<変数を追加します。 これは、選択した列の1つが連続している場合を除いて、私が望むとおりに機能します。 次に、グラフビルダーは X 全体を連続変数に置き換え、そこにはさらに変数があると言いますが、それは 1 つに対してプロットするだけです。 このように、連続変数を序数に変更して手動でチャートを作成すると、希望どおりに機能します。 したがって、各連続列を元の列に変更しますが、グラフは変数を追加せずに置き換えます。
これを希望どおりに機能させる方法を知っている人はいますか? これが私のスクリプトの簡略版です。
myWin = Column Dialog( FactorCol = Col List( "Multivariate Factor(s)" ) );
myFactor = myWin["FactorCol"];
myPlot = Graph Builder(
Show Control Panel( 0 ),
Show Legend( 0 ),
Variables( X( Eval( myFactor[1] ) ), Y( yCol ), Color( Eval( myColor ) ) ),
Elements( Bar( X, Y, Summary Statistic( "Std Dev" ), Label( "Label by Value" ) ) ),
SendToReport(
Dispatch(
{},
ScaleBox,
{Label Row( 1, {Automatic Tick Marks( 0 ), Show Major Ticks( 1 ), Lower Frame( 1 ), Tick Mark Style( "Long Divider" )} )}
)
)
);
//If there is more than one factor then need to add variables to the graph
If( N Items( myFactor ) > 1,
myRep = Report( myPlot )[Graph Builder Box( 1 )];
For( j = 2, j <= N Items( myFactor ), j++,
xcol = Column( dtmm, myFactor[j] );
If( xcol << Get Modeling Type == "Continuous",
//set a column property so I can change it back later
xcol << Set Property( "change", 1 );
xcol << Modeling Type( "Ordinal" );
);
myRep << Add Variable( {xcol, Role( "X" ), Position( 1 )} );
);
//now I have to adjust all the x-axis for the way I want it
For( j = 1, j <= N Items( myFactor ), j++,
Report( myPlot )[Axisbox( 1 )] << {Label Row(
j,
{Automatic Tick Marks( 0 ), Show Major Ticks( 1 ), Lower Frame( 1 ), Tick Mark Style( "Long Divider" )}
)}
);
);
実際、グラフビルダーボックスの変数を段階的にチェックすることで、これを行う方法を見つけました。 列が連続している場合は序数に変更し、変数を追加するときに内部位置項を追加する必要があります。 関連するスクリプト ビットを次に示します。
//graph builder can not add factors unless they are ordinal or nominal
//so if it is continuous, change to ordinal, and set a column property to change back later
If( xcol << Get Modeling Type == "Continuous",
xcol << Set Property( "change", {1} );
xcol << Modeling Type( "Ordinal" );
myRep << Add Variable( {xcol, Role( "X" ), Position( 1 ), Inner Position[i]} ),
,
myRep << Add Variable( {xcol, Role( "X" ), Position( 1 )} )
);これはまさに私がやりたいことです。
H
ありがとうございました。 はい、文字列スクリプトを作成するオプションがあることは知っていますが、私はいつもそれをするのをためらっています。 しかし、この場合は必要かもしれません。がっかりです。
一番
H