如何将预制的脚本图嵌入到应用程序生成器模块中?大家好,
我在应用程序生成器中编写脚本。 在我的一个模块中,我有一个图表框,旨在将其设置为显示预制图表,但我运气不佳。 我最初认为最简单的方法就是以某种方式将我的预制图嵌入到模块窗口中,所以我一直在尝试使用 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 应用程序中,您应该能够使用这些方法中的任何一种。第一种方法可以让您附加到您在应用程序中创建的任何框,只需确保您在 <