如何限制列切换器中显示的选项数量,并通过滚动访问其余选项?当列切换器的选项太长时,图表的长度就会变长。我们如何设置列切换器,使其最初显示较少的选项,最多只显示 5 个项目?然后,用户可以根据需要向下滚动以查找更多选项。如下例所示,一次显示太多选项会拉伸整个图表。
dt = Open( "$SAMPLE_DATA/Employee Master.jmp" );
Graph Builder(
Size( 534, 658 ),
Show Control Panel( 0 ),
Variables( X( :Unique Id ), Y( :Employee Id ) ),
Elements( Points( X, Y, Legend( 3 ) ) ),
Column Switcher(
:Employee Id,
{:Employee Id, :Job Code, :Position Code, :Intorg Hr, :Intorg Mgr, :Employee Name, :Address Line1,
:Address Line2, :City, :State, :Citizenship Country, :Gender, :Gender Code, :Ethnicity Code,
:Marital Status Code, :Minority Flag, :County, :Postal Code, :Valid From Date, :Hire Date, :Start Date,
:Employee Number, :Birth Date, :Disability Flag, :Military Exp Date, :Minimum Amt, :Midpoint Amt,
:Maximum Amt, :Pay Level Type, :Manager Name, :Intorg Hr1, :Mnmlev1, :Mnmlev2, :Mnmlev3, :Manager Id,
:Job Title Txt, :Job Group Code, :Job Group Desc, :EEO Class Code, :Emp Level, :Exempt Status Code,
:Employee Type Code, :Hours Per Week, :Employee Status Code, :Performance, :Disciplinary Action Flag,
:FLSA Status Code, :Hourly Salary, :Monthly Salary, :Annual Salary, :Annual Salary Z, :Payroll,
:Comratio, :Age, :Over40, :Age Range, :Yrs Of Service, :Length Of Service}
)
);
例如,在上图中,仅显示五个项目,而其余项目则隐藏在滚动菜单下方。
自动化和脚本回复:如何限制列切换器中显示的选项数量,其余选项可通过滚动访问?您可以使用<<设置N行

Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Employee Master.jmp");
gb = dt << Graph Builder(
Size(534, 658),
Show Control Panel(0),
Variables(X(:Unique Id), Y(:Employee Id)),
Elements(Points(X, Y, Legend(3)))
);
cw = gb << Column Switcher(
:Employee Id,
{:Employee Id, :Job Code, :Position Code, :Intorg Hr, :Intorg Mgr, :Employee Name,
:Address Line1, :Address Line2, :City, :State, :Citizenship Country, :Gender, :Gender Code,
:Ethnicity Code, :Marital Status Code, :Minority Flag, :County, :Postal Code,
:Valid From Date, :Hire Date, :Start Date, :Employee Number, :Birth Date, :Disability Flag,
:Military Exp Date, :Minimum Amt, :Midpoint Amt, :Maximum Amt, :Pay Level Type,
:Manager Name, :Intorg Hr1, :Mnmlev1, :Mnmlev2, :Mnmlev3, :Manager Id, :Job Title Txt,
:Job Group Code, :Job Group Desc, :EEO Class Code, :Emp Level, :Exempt Status Code,
:Employee Type Code, :Hours Per Week, :Employee Status Code, :Performance,
:Disciplinary Action Flag, :FLSA Status Code, :Hourly Salary, :Monthly Salary,
:Annual Salary, :Annual Salary Z, :Payroll, :Comratio, :Age, :Over40, :Age Range,
:Yrs Of Service, :Length Of Service}
);
cw << Set N Lines(5);