嗨,我一直在嘗試用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>