大家好
我有用戶輸入腳本的以下部分。 該腳本實際上運行良好。 問題來自當我嘗試使用 jsl 將網格線添加到繪圖中時,該部分似乎不起作用。 我嘗試用 x1col 替換 X1,用 y1col 替換 Y1(等等),但似乎也不起作用。 例如,當我將滑鼠懸停在 X1 上時,它會顯示正確的列。 我知道我可以拖放,但由於我正在處理大型資料集並產生繪圖,因此將它們自動化是很好的。 請告訴我如何克服這個問題。
x1col = Column(dt, X1);
y1col = Column(dt, Y1);
y2col = Column(dt, Y2);
y3col = Column(dt, Y3);
y4col = Column(dt, Y4);
Graph Builder(
Variables(X(Column(dt, X1)), Y(Column(dt, Y1)), Y(Column(dt, Y2)),Y(Column(dt, Y3)),Y(Column(dt, Y4)),
Group X( :Title )
),
Elements( Position( 1, 1 ), Line( X, Y )),
Elements( Position( 1, 2 ), Line( X, Y )),
Elements( Position( 1, 3 ), Line( X, Y )),
Elements( Position( 1, 4 ),
//Bar( X, Y, Legend( 36 ), Summary Statistic( "N" ) )
Bar( X, Y, Summary Statistic( "N" ))),
SendToReport(
Dispatch(
{},
<EM>X1</EM>,
ScaleBox,
{Label Row( Label Orientation( "Vertical" ) )}
),
Dispatch( {}, :<EM>Y1</EM>, ScaleBox, {Label Row( Show Major Grid( 1 ) )} ),
Dispatch(
//{},
<EM>Y2</EM>,
ScaleBox,
{Label Row( Show Major Grid( 1 ) )}
),
Dispatch( {}, <EM>Y3</EM>, ScaleBox, {Label Row( Show Major Grid( 1 ) )} ),
Dispatch( {}, <EM>Y4</EM>, ScaleBox, {Label Row( Show Major Grid( 1 ) )} )
)
),謝謝。
GraphBuilder Scale Box Dispatch 語句需要列名。一個簡單的方法是使用
colref << 取得名稱。
以下是使用 JMP 範例資料表 Candy Bars.jmp 對您提供的腳本進行的輕微修改
Names Default to Here(1);
//Open the JMP Sample Data table Candy Bars, create a 4x2 display
dt = Open("$Sample_Data/Candy Bars.jmp");
dt << select where(!Contains({"M&M/Mars","Hershey"}, :Brand) );
dt << delete rows();
:Brand << set name("Title");
x1col = Column(dt, "Carbohydrate g");
y1col = Column(dt, "Sugars g");
y2col = Column(dt, "Total fat g");
y3col = Column(dt, "Saturated fat g");
y4col = Column(dt, "Protein g");
candy_gb1 = dt << Graph Builder(
Variables(
X(x1col), Y(y1col), Y(y2col),Y(y3col),Y(y4col),
Group X( :Title )
),
Elements( Position( 1, 1 ), Line( X, Y ) ),
Elements( Position( 1, 2 ), Line( X, Y ) ),
Elements( Position( 1, 3 ), Line( X, Y ) ),
Elements( Position( 1, 4 ),
//Bar( X, Y, Legend( 36 ), Summary Statistic( "N" ) )
Bar( X, Y, Summary Statistic( "N" )) ),
SendToReport(
Dispatch(
{},
x1col<<GETNAME></GETNAME>