如何將預先製作的腳本圖嵌入到 Application Builder 模組中?大家好,
我正在應用程式生成器中編寫腳本。 在我的一個模組中,我有一個圖錶框,目的是將其設定為顯示預製圖表,但我運氣不佳。 我最初認為最簡單的事情就是以某種方式將我預先製作的圖形嵌入到模組視窗中,所以我一直在嘗試使用圖形框作為佔位符,嘗試如下:
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 中編寫,該解決方案都可能有助於編寫報告腳本。當您啟動沒有包含視窗的平台時,系統會為您建立該視窗。「即時」平台只能有一個報告,因此如果您嘗試將報告附加到現有窗口,則會建立該報告的副本。這比創建圖片更具互動性,但這也不是您想要的。
在下面的範例腳本中,我展示了將內容附加到現有視窗的三種方法,其結果具有不同程度的互動性:
- 在第一種情況下,即時圖形產生器平台直接嵌入現有視窗中。平台不會創建另一個窗口,也不會進行複製。
- 在第二個視窗中,新增了報告的副本,其互動性較低。這是報告本身的副本,沒有平台物件。它與數據表沒有任何連接。
- 在第三個視窗中,我附加了圖形生成器的圖像,該圖像的交互性最低。
// 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 應用程式中,您應該能夠使用這些方法中的任何一種。第一種方法可以讓您附加到您在應用程式中建立的任何框,只需確保您在 <