如何將預製的腳本圖嵌入到應用程序生成器模塊中?大家好,
我在應用程序生成器中編寫腳本。 在我的一個模塊中,我有一個圖錶框,旨在將其設置為顯示預製圖表,但我運氣不佳。 我最初認為最簡單的方法就是以某種方式將我的預製圖嵌入到模塊窗口中,所以我一直在嘗試使用 Graph Box 作為佔位符,嘗試類似:
graphBox << Visibility("Collapse");
panelBox << Append( /*graph*/ ) );...但這一直沒有奏效。 可能最簡單的方法實際上是將不同的圖形項目單獨編寫到圖形框中? 我對 JSL 很陌生,所以我知道我的方法/語法在某些方面一定是錯誤的,但我不確定最好/最簡單的方法是什麼!
創建我想要的圖表的代碼(感謝樂於助人的用戶我發布的另一個問題) 是:
Names Default To Here(1);
datafile = Open( "Data.xlsx" );
x_col = Column(datafile, 1);
y_cols = (datafile << Get Column Names())[2::N Cols(datafile)];
var_expr = EvalExpr(
Variables(X(Expr(x_col))
));
var_line = Expr(Line(X));
For Each({col, idx}, y_cols,
y_expr = Expr(Y(Position(1)));
Insert Into(y_expr, NameExpr(col), 1);
Insert Into(var_expr, Name Expr(y_expr));
yline_expr = Parse("Y("||char(idx)||")");
Insert Into(var_line, Name Expr(yline_expr));
);
graphbuild = Eval(Substitute(
Expr(
graphbuild = datafile << Graph Builder(
Size(838, 391),
Show Control Panel(0),
vvv,
Elements(yyy)
)
),
Expr(vvv), Name Expr(var_expr),
Expr(yyy), Name Expr(var_line)
));
/*gb_image = graphbuild << get picture;
graphbuild << Close Window;
New window("time-series plot",
gb_image
);*/我註釋掉了這段代碼的最後一部分,因為我實際上更喜歡簡單地抑制控制面板的結果圖(“顯示控制面板(0)”),而不是“<<獲取圖片”,因為這隱藏了圖表生成器用戶的功能,但仍然允許動態圖形(可抓取和可移動的軸等)。 如果可以以這種方式嵌入圖形,那麼這就是我的理想路線。
我很感激任何幫助。
謝謝,
埃斯特爾
圖形腳本回复:如何將預製的腳本圖嵌入到應用程序生成器模塊中?嗨 Estelle - 無論您是在 Application Builder 中還是直接在 JSL 中編寫,我都會提供一種可能有助於編寫報告腳本的解決方案。當您啟動沒有包含窗口的平台時,將為您創建該窗口。“實時”平台只能有一個報表,因此如果您嘗試將報表附加到現有窗口,則會創建報表的副本。這比創建圖片更具交互性,但也不是您想要的。
在下面的示例腳本中,我展示了將內容附加到現有窗口的三種方法,結果具有不同級別的交互性:
- 在第一種情況下,實時 Graph Builder 平台直接嵌入到現有窗口中。平台不會創建另一個窗口,也不會進行複制。
- 在第二個窗口中,添加了一份報告的副本,它的交互性較低。這是報表本身的副本,沒有平台對象。它與數據表無關。
- 在第三個窗口中,我添加了 Graph Builder 的圖像,它具有最少的交互性。
// Create an empty window first
New Window("Interactive Report",
panel = Panel Box("Interactive Report")
);
Wait(2);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
// Append a Graph Builder to the existing window
// This report will be entirely interactive
// Axes can be changed, and points can be selected
panel << Append(gb = dt << Graph Builder(
Show Control Panel( 0 ),
Variables( X( :height ), Y( :weight ), Overlay( :sex ) ),
Elements( Points( X, Y, Legend( 1 ) ), Smoother( X, Y, Legend( 2 ) ) )
));
// We could try to create windows from existing platforms
// This will lose some interactivity
// Axes can change, but the selection is fixed
New Window("Report Copy",
panel2 = Panel Box("Report Copy",
)
);
Wait(2);
panel2 << Append(Report(gb)); // creates a copy of the report
// Or we could take a picture of the report
// This is the least interactive result - nothing can change
New Window("Report Picture",
panel3 = Panel Box("Report Picture",
)
);
Wait(2);
panel3 << Append(gb << Get Picture);<BR />
在 JMP 應用程序中,您應該能夠使用這些方法中的任何一種。第一種方法可以讓您附加到您在應用程序中創建的任何框,只需確保您在 <