cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Sign-in to the JMP Community will be unavailable intermittently Dec. 6-7 due to a system update. Thank you for your understanding!
  • We’re retiring the File Exchange at the end of this year. The JMP Marketplace is now your destination for add-ins and extensions.
  • JMP 19 is here! Learn more about the new features.

Discussions

Solve problems, and share tips and tricks with other JMP users.
Choose Language Hide Translation Bar
danielrbiber
Level III

Scripting the Width of Column Switcher in Graph Builder

I am scripting several visuals with column switchers and am finding that they default to a larger size than I would expect.  I took the example JSL from another similar post Scripting-column-switcher-using-variable  but tried to get change the column switcher width.  I added a local data filter as I know that one can manipulate the sizes of those objects with "Display()".  You may notice that I added this to column switcher below.

Can this be accomplished?

I am asking as users are not able to change this width once posted to JMP Live.

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/semiconductor capability.jmp" );
col_list3 = dt << get column names( Numeric );

For( i = N Items( col_list3 ), i > 0, i--,
	If( !Contains( col_list3[i], "PN" ),
		Remove From( col_list3, i )
	)
);

Graph Builder(
	Size( 534, 572 ),
	Show Control Panel( 0 ),
	Variables( X( :PNP1 ), Y( :NPN1 ) ),
	Elements( Points( X, Y, Legend( 3 ) ), Smoother( X, Y, Legend( 4 ) ) ),
	Local Data Filter(
		Add Filter(
			columns( :lot_id ),
			Display( :lot_id, Size( 178, 221 ), Height( 221 ) )
		)
	),
	Column Switcher(
		:NPN1,
		{:NPN1, :PNP2, :NPN2, :PNP3, :PNP4, :NPN3, :NPN4, :NPN5, :PNP5, :NPN6, :PNP6,
		:PNP7, :NPN7, :PNP8, :PNP9, :NPN8, :NPN9, :NPN10, :PNM1, :NPN11, :PNP10},
		Display( Width( 100 ) )
	)
);
1 ACCEPTED SOLUTION

Accepted Solutions
jthi
Super User

Re: Scripting the Width of Column Switcher in Graph Builder

I would add the column switcher in a little bit different manner so you can get reference and then use << Set Size to that reference:

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/semiconductor capability.jmp" );
col_list3 = dt << get column names( Numeric );

For( i = N Items( col_list3 ), i > 0, i--,
	If( !Contains( col_list3[i], "PN" ),
		Remove From( col_list3, i )
	)
);

gb = dt << Graph Builder(
	Size( 534, 572 ),
	Show Control Panel( 0 ),
	Variables( X( :PNP1 ), Y( :NPN1 ) ),
	Elements( Points( X, Y, Legend( 3 ) ), Smoother( X, Y, Legend( 4 ) ) ),
	Local Data Filter(
		Add Filter(
			columns( :lot_id ),
			Display( :lot_id, Size( 178, 221 ), Height( 221 ) )
		)
	),
);

colswitcher = gb << Column Switcher(
	:NPN1,
	{:NPN1, :PNP2, :NPN2, :PNP3, :PNP4, :NPN3, :NPN4, :NPN5, :PNP5, :NPN6, :PNP6,
	:PNP7, :NPN7, :PNP8, :PNP9, :NPN8, :NPN9, :NPN10, :PNM1, :NPN11, :PNP10}
);

colswitcher << set size(300,300);

You could also check from Right click -> Edit -> Show Properties how to reference Column Switcher that way.

-Jarmo

View solution in original post

3 REPLIES 3
jthi
Super User

Re: Scripting the Width of Column Switcher in Graph Builder

I would add the column switcher in a little bit different manner so you can get reference and then use << Set Size to that reference:

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/semiconductor capability.jmp" );
col_list3 = dt << get column names( Numeric );

For( i = N Items( col_list3 ), i > 0, i--,
	If( !Contains( col_list3[i], "PN" ),
		Remove From( col_list3, i )
	)
);

gb = dt << Graph Builder(
	Size( 534, 572 ),
	Show Control Panel( 0 ),
	Variables( X( :PNP1 ), Y( :NPN1 ) ),
	Elements( Points( X, Y, Legend( 3 ) ), Smoother( X, Y, Legend( 4 ) ) ),
	Local Data Filter(
		Add Filter(
			columns( :lot_id ),
			Display( :lot_id, Size( 178, 221 ), Height( 221 ) )
		)
	),
);

colswitcher = gb << Column Switcher(
	:NPN1,
	{:NPN1, :PNP2, :NPN2, :PNP3, :PNP4, :NPN3, :NPN4, :NPN5, :PNP5, :NPN6, :PNP6,
	:PNP7, :NPN7, :PNP8, :PNP9, :NPN8, :NPN9, :NPN10, :PNM1, :NPN11, :PNP10}
);

colswitcher << set size(300,300);

You could also check from Right click -> Edit -> Show Properties how to reference Column Switcher that way.

-Jarmo
danielrbiber
Level III

Re: Scripting the Width of Column Switcher in Graph Builder

That did the trick.  Starting to finally wrap my head around how JSL works.

jthi
Super User

Re: Scripting the Width of Column Switcher in Graph Builder

Couple of good ways to see how you can affect things are for example (using gb as example reference):

 

 

gb << Show Properties;
gb << Show Tree STructure;
gb  << Get Xml; //use with XPath

Also checking JMP Scripting Guide and using Scripting Index will help a lot.

 

There are also some excellent topics on element/display manipulation can be found from JMP Community. Couple examples:

 

Supercharge Your User Interfaces in JSL ( US 2018 113 ) 

Navigating your reports using XPath 

 

-Jarmo

Recommended Articles