如何為圖形產生器編寫移動 Y 變數的腳本?大家好,
我正在做一個帶有移動 Y 變數的圖形產生器,圖形的輸出將如下所示:

但是,我正在努力在 JSL 中編寫 Y 軸腳本。我怎樣才能這樣做呢?
For( i = 1, i <= N Items( NamesList ), i++,
obj = Graph Builder(
Size( 534, 464 ),
Show Control Panel( 0 ),
Variables(
X( :TETEST_MONTH ),
X( :TETEST_WEEK, Position( 1 ) ),
Y( :Name ("Y")) , // how do I insert the moving Y variable here ?
Y( :Name ("Y")), // how do I insert the moving Y variable here ?
Color( :TETEST_MONTH )
),
Elements( Position( 1, 1 ), Histogram( X( 2 ), X( 1 ), Y, Legend( 14 ) ) ),
Elements(
Position( 1, 2 ),
Box Plot( X( 2 ), X( 1 ), Y, Legend( 16 ) ),
Line( X( 2 ), X( 1 ), Y, Legend( 17 ) )
),
SendToReport( Dispatch( {}, "400", LegendBox, {Set Title( "" )} ) )
));回覆:如何為圖形產生器編寫移動 Y 變數的腳本?謝謝你,吉姆。 現在效果很好。回覆:如何為圖形產生器編寫移動 Y 變數的腳本?我的錯誤......刪除所有 gb[i] 引用並將它們更改為 gb。
回覆:如何為圖形產生器編寫移動 Y 變數的腳本?謝謝,吉姆。 但我仍然遇到錯誤。 我想我的分割可能有問題。
/* Open a sample data table */
dt = Open( "C:\Users\1.jmp", invisible );
// Find the Y Columns
numericColNamesList = dt << get column names( string, numeric );
For( i = N Items( numericColNamesList ), i >= 1, i--,
If(
Not(
Is Missing( Num( Word( 1, numericColNamesList[i], ":" ) ) ) == 0 &
Word( 2, numericColNamesList[i], ":" ) != ""
),
numericColNamesList = Remove( numericColNamesList, i, 1 )
)
);
// Run the Variance Charts
// With dynamic Y columns and fixed X columns
Fo( i = 1, i <= N Items( numericColNamesList ), i++,
gb = dt << Graph Builder(
Invisible,
Size( 752, 508 ),
Show Control Panel( 0 ),
Show Legend( 0 ),
Variables(
X( :Month ),
Y( Column ( numericColNamesList[i] ) ),
Overlay( :Month )
),
Elements(
Box Plot(
X,
Y,
Legend( 15 ),
Jitter( 0 ),
Outliers( 0 ),
Box Style( "Solid" )
),
Histogram( X, Y, Legend( 12 ) )
));
gb = LIST (gb[i]);
If( i == 1,
Report( gb ) << Save Presentation( "C:\Users\Ann Ann\1.pptx" ),
Report( gb[i] << Save Presentation( "C:\Users\Ann Ann\1.pptx", Append ) )
));
回覆:如何為圖形產生器編寫移動 Y 變數的腳本?您正在使用
gb = dt << 圖形產生器(.........
對於圖形生成器平台的每次執行。它不是值的向量。每次執行圖形產生器腳本時,您都會為變數“gb”建立一個新值。也就是說,指向 Graph Builder 的最後一個實例的指標會被移到指向 Graph Builder 的新實例。您的程式碼設定方式不存在 gb[1]、gb[2] 等。
解決這個問題的一種方法是將程式碼的保存演示區域移至初始 For() 迴圈內。
解決此問題的另一種方法是在初始 For() 迴圈中,在建立後將「gb」的值儲存到清單中。然後,在第二個 For() 迴圈中指向列表中的元素,而不是 gb[i] 等。
For( i = 1, i <= N Items( numericColNamesList ), i++,
gb = dt << Graph Builder(
Size( 900, 850 ),
Show Control Panel( 0 ),
Variables(
X( :MONTH ),
X( :WEEK, Position( 1 ) ),
Y( Column( numericColNamesList[i] ) ),
Y( Column( numericColNamesList[i] ) ),
Color( :MONTH )
),
Elements( Position( 1, 1 ), Histogram( X( 2 ), X( 1 ), Y, Legend( 14 ) ) ),
Elements(
Position( 1, 2 ),
Box Plot( X( 2 ), X( 1 ), Y, Legend( 16 ) ),
Line( X( 2 ), X( 1 ), Y, Legend( 17 ) )
),
SendToReport( Dispatch( {}, "400", LegendBox, {Set Title( "" )} ) )
);
If( i == 1,
Report( gb ) << Save Presentation( "C:\Users\Ann Ann\1.pptx" ),
Report( gb[i] << Save Presentation( "C:\Users\Ann Ann\1.pptx", Append ) )
);
);
Open( "C:\Users\Ann Ann\1.pptx" );回覆:如何為圖形產生器編寫移動 Y 變數的腳本?謝謝吉姆。
但我不知道為什麼這個錯誤在調試過程中不斷提示我。

For( i = 1, i <= N Items( numericColNamesList ), i++,
gb = dt << Graph Builder(
Size( 900, 850 ),
Show Control Panel( 0 ),
Variables(
X( :MONTH ),
X( :WEEK, Position( 1 ) ),
Y( Column( numericColNamesList[i])) ,
Y( Column( numericColNamesList[i])) ,
Color( :MONTH )
),
Elements( Position( 1, 1 ), Histogram( X( 2 ), X( 1 ), Y, Legend( 14 ) ) ),
Elements(
Position( 1, 2 ),
Box Plot( X( 2 ), X( 1 ), Y, Legend( 16 ) ),
Line( X( 2 ), X( 1 ), Y, Legend( 17 ) )
),
SendToReport( Dispatch( {}, "400", LegendBox, {Set Title( "" )} ) )
));
Report(gb[1]) << Save Presentation( "C:\Users\Ann Ann\1.pptx" );
For( i = 2, i <= N Items( numericColNamesList ), i++,
Report (gb[i] << Save Presentation( "C:\Users\Ann Ann\1.pptx", Append )
));
Open( "C:\Users\Ann Ann\1.pptx" );
//wait(0);
//obj << close window();
回覆:如何為圖形產生器編寫移動 Y 變數的腳本?假設「NamesList」包含您要用作 Y 列的 Y 列,然後替換
:名稱(“Y”)
和:
作為列(NamesList[i])