Scripting Guide > Data Tables > Columns > Add a Column Switcher
发布日期: 11/15/2021

Add a Column Switcher

Use JSL to add a Column Switcher panel to a report window. The Column Switcher lets you quickly analyze different variables without having to re-create your analysis.

// add a Column Switcher to the report
obj << Column Switcher(<default_col>(<col1>, <col2>, ...);
 
// remove the Column Switcher from a report
obj << Remove Column Switcher();

For example, add the Column Switcher to a Contingency report for the Car Poll.jmp data:

dt = Open( "$SAMPLE_DATA/Car Poll.jmp" );
obj = dt << Contingency(
	Y( :size ),
	X( :marital status )
);
ColumnSwitcherObject = obj << Column Switcher(
	:marital status,
	{:sex, :country, :marital status}
);
// number of pixels for the switcher width
ColumnSwitcherObject << Set Size( 200 );
 

// number of columns to display in the switcher

ColumnSwitcherObject << Set NLines( 6 );

You can also share a Column Switcher between two platform reports:

dt = Open( "$SAMPLE_DATA/Nicardipine.jmp" );
New Window( "Column Switcher Example",
	H List Box(
		sexCS = dt << Column Switcher( :Sex, {:Sex, :Causality, :Race} ),
		nDist = Distribution( Nominal Distribution( Column( :Sex ) ) ),
		bar = Graph Builder(
			Show Control Panel( 0 ),
			Variables( X( :Sex ), Y( :Age ) ),
			Elements( Box Plot( X, Y, Legend( 5 ) ) )
		)
	)
);
 
sexCS << Link Platform( nDist );
sexCS << Link Platform( bar );

Note: If you are publishing reports that share a Column Switcher to JMP Public or JMP Live, add them to a dashboard instead of using JSL. See 使用仪表板组合和演示报表 in Using JMP.

For more information about the Column Switcher, see 列切换器 in Using JMP.

需要更多信息?有问题?从 JMP 用户社区得到解答 (community.jmp.com).