我有兩個資料來源定期更新,從而產生新的列。這些是透過 JSL 腳本合併的,效果很好,但我想嵌入一個帶有列切換器的圖表,隨著更多列的添加,該圖表也會增大。
例如,假設 HPLC 數據來自儀器 A 和儀器 B。每列都是一個單獨的樣本,隨著時間的推移會添加更多樣本。我想在最終數據表中為我的“A”樣本創建一個簡單的 XY 圖表,以便隨著更多列的添加,列切換器也會隨之增長。 (與 B 類似,甚至與 C 類似,如果稍後添加第三種樂器)。

在將資料與 B 合併之前,我已經從 A 表創建了一個變量,但是如何傳遞列表(或對其進行評估)以便最終表識別變量或具有明確的列名?
A_columns = dt_A <<GET column="" names=""></GET><BR />//Merge A and B based on time column<BR /><BR />Final_Table =dt_B << Update(<BR />With(dt_A)),<BR />Match Columns( :Time = :Time)<BR />);<BR />Final_Table <<NEW script=""></NEW>Graph Builder(<BR />Size( 546, 565 ),<BR />Show Control Panel( 0 ),<BR />Variables( X( :Time ), Y( A_columns[1] ) ),<BR />Elements( Points( X, Y, Legend( 3 ) ), Smoother( X, Y, Legend( 4 ) ) ),<BR />Column Switcher( A_columns[1], A_columns)<BR />);
當我從最終表中獲取列的列表時,這似乎運作良好,但嘗試使用從另一個表建立的變數會導致問題。
您是否總是希望使用列切換器中除第一列(:時間)之外的所有內容?
在這種情況下是的 - 始終是第一列,並且始終具有相同的名稱。
在這種情況下,我考慮在表腳本中動態建立列表
Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Semiconductor Capability.jmp");
table_script_expr = Expr(
cols = Current Data Table() << Get Column Names();
Remove From(cols, 1); // drop first column
gb = Graph Builder(
Size(528, 448),
Show Control Panel(0),
Variables(X(:lot_id), Y(Eval(cols[1]))),
Elements(Points(X, Y, Legend(3)))
);
gb << Column Switcher(
cols[1],
Remove(cols, 1)
)
);
Eval(EvalExpr(
dt << New Script("Graph",
Expr(NameExpr(table_script_expr))
);
));
如果您僅建立圖表並將其儲存為腳本,則可以避免評估(我經常使用這個「技巧」)
Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Semiconductor Capability.jmp");
cols = dt << Get Column Names();
Remove From(cols, 1); // drop first column
gb = dt << Graph Builder(
Size(528, 448),
Show Control Panel(0),
Variables(X(:lot_id), Y(Eval(cols[1]))),
Elements(Points(X, Y, Legend(3))),
Column Switcher(
cols[1],
Remove(cols, 1)
),
Invisible
);
gb << Save Script to Data Table("Graph"); // this will remove the need for evaluation
wait(0);
gb << close window;
如果你想評估
// If you wish to evaluate, this should work even though the script will look a bit weird due to lack of ":" in columns
// If it doesn't you for some reason, you will have to build the list in a bit different manner for evaluation
Eval(EvalExpr(
dt << New Script("Graph2",
Graph Builder(
Size(528, 448),
Show Control Panel(0),
Variables(X(:lot_id), Y(Expr(cols[1]))),
Elements(Points(X, Y, Legend(3))),
Column Switcher(
Expr(cols[1]),
Expr(Remove(cols, 1))
)
)
)
));