我希望在图表构建器中使用列切换器,选中其中一列后,它能动态地将对应数据表的列设置为“标签”列。同时,它还应该取消标记之前已标记但未在列切换器中选中的数据表列。请问有什么方法可以实现这个功能?我使用的是 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 );