我希望在圖表建構器中使用列切換器,選取其中一列後,它能動態地將對應資料表的列設定為「標籤」列。同時,它還應該取消標記之前已標記但未在列切換器中選取的資料表列。請問有什麼方法可以實現這個功能?我使用的是 JMP 19 版本。
使用“建立列切換處理程序”,您應該能夠在列切換器啟用時新增所需的 JSL 程式碼,以進行所需的變更。有關「建立列切換處理程序」的說明和範例,請參閱腳本索引。
謝謝吉姆。我修改了腳本索引中「建立列切換處理程序」的範例腳本,這段程式碼似乎可以滿足我的需求:
dt = Open( "$SAMPLE_DATA/Process Measurements.jmp" );
gb = Graph Builder( Variables( Y( :Process 1 ) ), Elements( Histogram( Y, Legend( 3 ) ) ) );
dt << Clear Column Selection();
columnSwitcher = gb << Column Switcher(
:Process 1,
{:Process 1, :Process 2, :Process 3, :Process 4, :Process 5, :Process 6, :Process 7}
);
dt << Set Label Columns();
dt << Set Label Columns( :Process 1 );
pre = Function( {currentColumn, nextColumn, switcher},
Print(
"Before switch: " || (currentColumn << get name) || " >> " || (nextColumn << get name) ||
" [Column Switcher] current: " || (columnSwitcher << Get Current)
);
currentColumn << Label( 1 );
);
post = Function( {previousColumn, currentColumn, switcher},
Print(
"After switch: " || (previousColumn << get name) || " >> " || (currentColumn << get name) ||
" [Column Switcher] current: " || (columnSwitcher << Get Current)
);
previousColumn << Label( 0 );
currentColumn << Label( 1 );
);
handler = columnSwitcher << Make Column Switch Handler( pre, post );