你好,
我正在试图编写一个脚本,根据“新窗口”提供的不同值重新运行。
这是方案:
1 /我打开一个带有按钮的窗口(“选择主文件”)。
2 /当我单击此按钮时,会启动“选择文件”,然后选择一个文件
3 /根据所选文件的内容,我应该运行一个脚本并生成图形
这是我的问题:
1 /每次选择新文件时如何制作,重新运行整个脚本并更新图形?
2 /如何在我选择文件的“新窗口”中嵌入图形?
3 /我必须运行的脚本相当长,必须生成几个图表。有没有办法调用这个脚本而不将所有代码放在“新窗口”代码中?(比如调用一个函数左右,......)
非常感谢。
在下面找到代码的简化版本(附带2个文件来测试代码):
// Collect location of the Master file and the data...
New Window( "Window Controls",
Lineup Box( N Col( 1 ), Spacing( 3 ),
Panel Box( "1/ Select location of Data...", Button Box( "Select Data", Folder = Pick Directory( "Please pick a folder", ShowFiles ) ) ),
Panel Box( "2/ Select Data Master File...", g1=Button Box( "Select Master File", MasterFile = Pick File()
) ),
Col List Box( all ); //g1 << updateWindow;
),
);
MasterTable = Open( MasterFile );
Lots = Column( MasterTable, "Lot" ) << GetAsMatrix;
Factors = Column( MasterTable, "Factor" ) << GetAsMatrix;
x = Factors * [10, 50, 90];
y = Factors * [10, 90, 10];
New Window( "Poly Seg Example", g = Graph Box( Poly Seg( x, y ) ) );
这是将图形保存为表达式的一种方法,然后在新窗口中使用它。
dt = open("$sample_data\Big Class.jmp");
g1_expr = expr(
gb1 = dt << Graph Builder(Show Control Panel( 0 ),
Variables( X( :weight ), Y( :height ), Overlay( :sex ) ),
Elements( Points( X, Y, Legend( 6 ) ) )
);
);
g2_expr = expr(
gb2 = dt << Graph Builder(Show Control Panel( 0 ),
Variables( X( :age ) ),
Elements( Pie( X, Legend( 3 ), Label( "Label by Value" ) ) ),
SendToReport( Dispatch( {}, "Y title", TextEditBox, {Set Wrap( 2 )} ) )
);
);
nw = new window("Sample Graphs",
hlistbox(
g1_expr,
g2_expr
),
);