使用JSL在图构建器中删除并添加换行变量当我通过窗口中的服装图形脚本功能在图形生成器中手动添加一条线,然后用标称变量包装或分组时,堆叠的窗口将复制相同的服装线。
在图形窗口中右键单击->自定义->单击“ +”按钮(添加“脚本”条目)并添加线脚本(例如,使用“样本”->“拖动线”选项)。
但是,如果我随后将脚本保存到数据表中,则每个窗口现在都有一个用于添加服装图形的条目,并且可能会变得很长。 我将需要编写一个复杂的for循环,以将图形代码添加到每个窗口中。
我想在JSL中进行与手工相同的步骤:
-创建图
-设置服装线
-添加换行列
图形学脚本编写回复:使用JSL在图形生成器中删除并添加换行变量下面的示例使用<< << Add Graphics Script()消息来添加拖动线。
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA\Big Class.jmp" );
gb = dt << Graph Builder(
Size( 534, 456 ),
Show Control Panel( 0 ),
Variables( X( :height ), Y( :weight ) ),
Elements( Points( X, Y, Legend( 2 ) ), Smoother( X, Y, Legend( 4 ) ) )
);
Report( gb )[FrameBox( 1 )] << Add Graphics Script(
If( Is Empty( g_x1 ),
g_x1 = [50.53, 66.28, 64.49];
g_y1 = [102.99, 45.69, 106.10];
);
Drag Line( g_x1, g_y1 );
);
Report( gb )[Graph Builder Box( 1 )] << Add Variable( {:age, Role( "Wrap" )} );
希望对您有所帮助。
回复:使用JSL在图形生成器中删除并添加换行变量用于添加和删除包装变量的代码段。 这来自2021年在线发现峰会的未会话JSL脚本。
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
//make initial graph
gb = Graph Builder(
Variables( X( :height ), Y( :weight ) ),
Elements( Points( X, Y ), Smoother( X, Y ) )
);
//get a reference to the grab builder box
gbb = Report( gb )[Graph Builder Box( 1 )];
Wait( 1 );
//add a wrap variable to demonstrate adding
gbb << Add Variable( {:age, Role( "Wrap" )} );
Wait( 1 );
//remove wrap variable
gbb << Remove Variable( {:age, Role( "Wrap" )});
Wait( 1 );
//add graphics script
gbb[frame box( 1 )] << Add Graphics Script(
2,
Description( "" ),
If( Is Empty( g_x4 ),
g_x4 = [52.92, 68.48, 70.56];
g_y4 = [119.69, 139.30, 124.01];
);
Drag Line( g_x4, g_y4 );
);
//add wrap variable
gbb << Add Variable( {:age, Role( "Wrap" )} );脚本作者@朱利安多谢。