[Script JLS]:循環繪製多個圖形你好,
我是 JMP 的新手。 這是一個功能強大的軟件!
這就是為什麼我想編寫一個腳本,可以在一個 X 的函數中繪製來自不同列(實際上每 n 列)的幾個 Y。
由於圖形生成器界面,我寫了它,但我想在一個循環中編寫它的腳本。
我做了類似的事情來繪製分佈(但不幸的是它不是相同的比例......)
//Distributions Std Dev
New Window( "Side by Side",
H List Box(
Distribution(
Continuous Distribution( Column( :median_range_mm ))
);
for ( p = 2, p <= 64, p++,
nom = "median_range_mm " || char(p);
col = Column(nom);
Distribution(
Continuous Distribution( Column( col ), Std Error Bars( 1 ) );
/*SendToReport(
Dispatch(
{"Distributions", Column( col )},
"1",
ScaleBox,
{Min( 1450 ), Max( 1820 ), Inc( 20 ), Minor Ticks( 0 ),
Label Row Nesting( 1 )}
)
)*/
)
)
)
這是我嘗試解決我的主要問題的方法,結果只是一個打開的圖形生成器窗口。
我想在 Y 軸上繪製列 [ref, ref 1 , ref 2 until ref 64] 並在 X 軸上繪製 currentTimeMillis
New Window( "Ref",
H List Box(
Graph Builder(
For (r = 2 , r <= 64, r++,
name = "ref " || char(r);
col = Column(name);
Variables( X( :currentTimeMillis ), Y (Column (col), Position( 1 ) ) ),
Elements(
Points( X, Y(r) , Legend( 29 ) ),
Smoother( X , Y(r), Legend( 30 ) )
),
SendToReport(
Dispatch(
{},
"graph title",
TextEditBox,
{Set Text( strTitle )}
)
)
)
)
)
);感謝您的幫助。
乾杯
回复:[Script JLS]:用於一起繪製多個圖形的循環可以很容易地創建輸出對象,這些對象可以預先創建,然後根據用戶的請求顯示。或者,由於 JMP 的速度,我的許多應用程序都會在用戶請求時生成特定的輸出。您還應該探索 Column Switcher,它允許用戶從列表中選擇要分析和顯示的列。
回复:[Script JLS]:用於一起繪製多個圖形的循環是否可以保存單個圖形(如輕鬆訪問列表)供以後使用,而不是將它們全部繪製在一個 H 列錶框中?謝謝。
回复:[Script JLS]:用於一起繪製多個圖形的循環我有點困惑.....但我提供此代碼作為解決方案的可能示例。從您提供的最後一段代碼看來,您正在將數據表中的列名稱更改為“Ref”。由於 JMP 不允許您有 2 個同名的列,因此您嘗試重命名為“Ref”的第二列實際上被命名為“Ref 2”。這一直持續到“Ref 64”列。我還建議您重新檢查您的代碼以了解列“currentTimeMillis”的命名。在您的代碼中,您實際上將該列重命名(同名)64 次。
下面是我的新代碼......它使用了一個示例數據表......名為 Ref - Ref 64 的列都是連續的,但由於 JMP 真的不關心,代碼將也適用於您的數據表,其中的列分佈在 700 多列中
Names Default To Here( 1 );
// Build some sample data
dt = Open( "$SAMPLE_DATA/semiconductor capability.jmp" );
Column( dt, 6 ) << set name( "ref" );
For( i = 7, i <= 69, i++,
Column( dt, i ) << set name( "ref " || Char( i - 5 ) )
);
Column( dt, 5 ) << set name( "currentTimeMillis" );
// Build the JSL code for the Graph Builder
theExpr = "dt << Graph Builder(
Variables(
X( :currentTimeMillis ),
Y( :ref )";
For( i = 2, i <= 64, i++,
theExpr = theExpr || ",Y( :ref " || Char( i ) || ", Position( 1 ) )"
);
theExpr = theExpr || "),
Elements(
Points(
X";
For( i = 2, i <= 64, i++,
theExpr = theExpr || ",Y( " || Char( i ) || ")"
);
theExpr = theExpr || "
,Legend( 5 )
),
Smoother(
X";
For( i = 2, i <= 64, i++,
theExpr = theExpr || ",Y( " || Char( i ) || ")"
);
theExpr = theExpr || " ,
Legend( 6 )
)
)
)";
// Execute the generated code
Eval( Parse( theExpr ) );
回复:[Script JLS]:用於一起繪製多個圖形的循環謝謝你的回复吉姆!
但我可能歪曲了我的問題。
確實,我想擁有我所有的情節都在同一張圖上.
此外,我的 Y 列已經每 11 列設置一次,並且 currentTimeMillis 在開始時只出現一次:
//Set columns
For( i = 1, i <=709 , i++,
For ( j = 0, j <= 63, j++,
If ( i == 2, Column(i) << set name( "currentTimeMillis" ),i == 15 + 11*j, Column(i) << set name( "ref" ),
)
)
)最後,"__col__" 還沒有被定義("col" 被定義但是在另一個分配函數中),所以我不明白你為什麼在這裡使用它。
再次感謝。
回复:[Script JLS]:用於一起繪製多個圖形的循環這是我將如何做的一個例子
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/semiconductor capability.jmp" );
For( i = 6, i <= 69, i++,
Column( dt, i ) << set name( "ref " || Char( i - 5 ) )
);
Column( dt, 5 ) << set name( "currentTimeMillis" );
New Window( "Ref",
hlb = H List Box(
)
);
For( r = 2, r <= 64, r++,
name = "ref " || Char( r );
Eval(
Substitute(
Expr(
outputhlb = H List Box(
Graph Builder(
Variables(
X( :currentTimeMillis ),
Y( Column( __col__ ), Position( 1 ) )
),
Elements(
Points( X, Y( r ), Legend( 29 ) ),
Smoother( X, Y( r ), Legend( 30 ) )
),
SendToReport(
Dispatch(
{},
"graph title",
TextEditBox,
{Set Text( strTitle )}
)
)
)
)
),
Expr( __col__ ), Parse( ":" || name )
)
);
hlb << append( outputhlb );
);