嗨,我已经尝试了一段时间,用JSL编写代码,其中根据某些变量的值,从图形生成器获得的图形会发生变化。
现在,我的特定示例非常简单,我有一个复选框,并且要根据用户选择(选中/未选中),使用本地过滤器向图中添加或删除组。 这是一个非常简单的例子
dt = Open( "$SAMPLE_DATA/Analgesics.jmp" );
// Open Analgesics
cb = 1; // Predefined value<BR /><BR />// Check box to Remove group A from the graph
usw = New Window("Ignore A?", << Modal,
//Check Box defaulted to checked ignore
checkIgnore = check box({"Ignore A?"},
<< Set(1,1),
cb = checkIgnore << Get())
);
// Answer to Cancel or close buttons
If( usw["button"] == -1, throw("User cancelled") );
show(cb); // I can see how the value of cb changes between 0 and 1
nw = New Window( "Example Report",
// Box plot with dots
dot_box_plot = dt << Graph Builder(
Show Control Panel( 0 ),
Show Legend( 0 ),
Show Title( 0 ),
Variables( X(:drug ), Y( :pain ), Color(:drug ) ),
Elements( Position( 1, 1 ), Points( X, Y, Legend( 2 ) ), Box Plot( X, Y, Legend( 3 ) ) ),
Elements( Position( 2, 1 ), Points( X, Y, Legend( 2 ) ), Box Plot( X, Y, Legend( 3 ) ) ),
SendToReport( Dispatch( {}, "X title", TextEditBox, {Set Text( "" )} ) ),
/* This is the part that I'd like to make interactive
to keep or remove A-group from the plot depending on
user selection */
if(cb == 1,
Local Data Filter(
Close Outline( 1 ),
Add Filter( columns( :drug ),
Where( :Drug != "A" )
)
)
)
)
);如您所见,如果没有任何变化,则if语句在我这部分应该有问题,该图将保留所有组。 当然,当我仅删除IF()部分时,我的绘图将忽略A组。
我将非常感谢您的任何建议。
处理对平台代码的修改的首选方法是在平台的初始处理之后将消息传递到平台。试图修改平台语句变得太混乱和太不稳定了。
下面是修改的脚本,以在Graph Builder平台运行后添加过滤器。然后隐藏本地数据过滤器的实际显示

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Analgesics.jmp" );
// Open Analgesics
cb = 1; // Predefined value// Check box to Remove group A from the graph
usw = New Window( "Ignore A?",
<<MODAL></MODAL>