cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Check out the JMP® Marketplace featured Capability Explorer add-in
Choose Language Hide Translation Bar
Valerio
Level II

JSL Functions Syntax Information (for Example: "Legend Model( )")

I literally just started learning JMP and JSL.

I am having a very hard time finding syntax information of functions, commands, etc..

I cannot find most things neither on the "JSL Syntax Reference" document or online. Do you have any suggestions for a comprehensive list of all JSL functions and commands?

For example, right now I am just trying to plot a graph specifying the legend names and colors. I want the "Legend 1" to appear at the second-last slot.

Stealing some different scripts online, I put together the following:

Graph Builder(
	Size( 779, 677 ),
	Show Control Panel( 0 ),
	Variables( X( :X ), Y( :Y ), Wrap( :Items ), Color( :Name( "Legends" ) ) ),
	Elements( Points( X, Y, Legend( 8 ) ) ),
	SendToReport(
		Dispatch(
			{},
			"400",
			ScaleBox,
			{Legend Model(
				8,
				Level Name( 0, "Legend 7", Item ID( "Legend 7", 1 ) ),
				Level Name( 1, "Legend 2", Item ID( "Legend 2", 1 ) ),
				Level Name( 2, "Legend 3", Item ID( "Legend 3", 1 ) ),
				Level Name( 3, "Legend 4", Item ID( "Legend 4", 1 ) ),
				Level Name( 4, "Legend 5", Item ID( "Legend 5", 1 ) ),
				Level Name( 5, "Legend 6", Item ID( "Legend 6", 1 ) ),
				Level Name( 6, "Legend 1", Item ID( "Legend 1", 1 ) ),
				Level Name( 7, "Legend 8", Item ID( "Legend 8", 1 ) ),
				Properties( 0, {Line Color( 36 )} ),
				Properties( 1, {Line Color( -15343117 )} ),
				Properties( 2, {Line Color( -15343117 )} ),
				Properties( 3, {Line Color( -15343117 )} ),
				Properties( 4, {Line Color( -15343117 )} ),
				Properties( 5, {Line Color( -15343117 )} ),
				Properties( 6, {Line Color( 40 )} ),
				Properties( 7, {Line Color( 24 )} )
			)}
		)
	)
);

It doesn't work... It calls "Legend 1", "Legend 7" and that's it.

Thank you in advance for any help!

1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: JSL Functions Syntax Information (for Example: "Legend Model( )")

You are making a major mistake.   You are writing the JSL, rather than letting JMP write the JSL for you.  If you create the graph interactively, just the way you want it, you can then request to have the JSL saved that will recreate the graph just the way you specified.

That is, if you have the graph

txnelson_5-1656269571687.png

 

 

which has everything, except for the Legend specification, you can go to the red triangle and select Legend Settings

txnelson_2-1656269051282.png

and then in the dialog window that pops up, you can change the position of the legend 1.

txnelson_3-1656269224121.png

then go to the red triangle and select save script and it saves the script with the commands required to reproduce it

Graph Builder(
	Size( 779, 677 ),
	Show Control Panel( 0 ),
	Variables( X( :X ), Y( :Y ), Wrap( :Items ), Color( :Legends ) ),
	Elements( Points( X, Y, Legend( 8 ) ) ),
	SendToReport(
		Dispatch(
			{},
			"400",
			ScaleBox,
			{Legend Model(
				8,
				Properties( 0, {Line Color( 36 )}, Item ID( "Legend 1", 1 ) ),
				Properties( 1, {Line Color( -15343117 )}, Item ID( "Legend 2", 1 ) ),
				Properties( 2, {Line Color( -15343117 )}, Item ID( "Legend 3", 1 ) ),
				Properties( 3, {Line Color( -15343117 )}, Item ID( "Legend 4", 1 ) ),
				Properties( 4, {Line Color( -15343117 )}, Item ID( "Legend 5", 1 ) ),
				Properties( 5, {Line Color( -15343117 )}, Item ID( "Legend 6", 1 ) ),
				Properties( 6, {Line Color( 40 )}, Item ID( "Legend 7", 1 ) ),
				Properties( 7, {Line Color( 24 )}, Item ID( "Legend 8", 1 ) )
			)}
		),
		Dispatch(
			{},
			"400",
			LegendBox,
			{Legend Position( {8, [6, 0, 1, 2, 3, 4, 5, 7]} )}
		)
	)
);

txnelson_4-1656269479315.png

 

I find the Scripting Index to be the best reference for all of the functions and platform syntax.  It has all of the messages that can be sent to a platform and functions, along with live examples.

 

Jim

View solution in original post

2 REPLIES 2
txnelson
Super User

Re: JSL Functions Syntax Information (for Example: "Legend Model( )")

You are making a major mistake.   You are writing the JSL, rather than letting JMP write the JSL for you.  If you create the graph interactively, just the way you want it, you can then request to have the JSL saved that will recreate the graph just the way you specified.

That is, if you have the graph

txnelson_5-1656269571687.png

 

 

which has everything, except for the Legend specification, you can go to the red triangle and select Legend Settings

txnelson_2-1656269051282.png

and then in the dialog window that pops up, you can change the position of the legend 1.

txnelson_3-1656269224121.png

then go to the red triangle and select save script and it saves the script with the commands required to reproduce it

Graph Builder(
	Size( 779, 677 ),
	Show Control Panel( 0 ),
	Variables( X( :X ), Y( :Y ), Wrap( :Items ), Color( :Legends ) ),
	Elements( Points( X, Y, Legend( 8 ) ) ),
	SendToReport(
		Dispatch(
			{},
			"400",
			ScaleBox,
			{Legend Model(
				8,
				Properties( 0, {Line Color( 36 )}, Item ID( "Legend 1", 1 ) ),
				Properties( 1, {Line Color( -15343117 )}, Item ID( "Legend 2", 1 ) ),
				Properties( 2, {Line Color( -15343117 )}, Item ID( "Legend 3", 1 ) ),
				Properties( 3, {Line Color( -15343117 )}, Item ID( "Legend 4", 1 ) ),
				Properties( 4, {Line Color( -15343117 )}, Item ID( "Legend 5", 1 ) ),
				Properties( 5, {Line Color( -15343117 )}, Item ID( "Legend 6", 1 ) ),
				Properties( 6, {Line Color( 40 )}, Item ID( "Legend 7", 1 ) ),
				Properties( 7, {Line Color( 24 )}, Item ID( "Legend 8", 1 ) )
			)}
		),
		Dispatch(
			{},
			"400",
			LegendBox,
			{Legend Position( {8, [6, 0, 1, 2, 3, 4, 5, 7]} )}
		)
	)
);

txnelson_4-1656269479315.png

 

I find the Scripting Index to be the best reference for all of the functions and platform syntax.  It has all of the messages that can be sent to a platform and functions, along with live examples.

 

Jim
Valerio
Level II

Re: JSL Functions Syntax Information (for Example: "Legend Model( )")

Thank you very much!