cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • New to JMP? Join us Sept. 23-24 for the Early User Edition of Discovery Summit, tailor-made for new users. Register now for free!
  • Your voice matters! Tell us how you prefer to receive JMP updates, so we can tailor our communication to your needs. Take short survey.
  • See how to access JMP Marketplace - and - find, create & share add-ins to extend your JMP. Watch video.

Discussions

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

Is it possible to script Graph Builder to bring reference lines to the front

Is there way through JSL to move reference lines to the front of the plot so that they are clearly visible over the datapoints?
I know I can right-click, customize on within individual frame boxes and manually reorder the items in the list, but i'd like to do this via JSL if possible.

Appreciate any suggestions/feedback you might have. 
Thanks,
Ray

rbfinner_2-1784647117397.png

 

Code to replicate the graph above.

 

names default to here(1);
dt = open ( "$SAMPLE_DATA/Aircraft Incidents.jmp" );
dt << Graph Builder( Size( 964, 585 ), Show Control Panel( 0 ), Graph Spacing( 3 ), Spacing Borders( 1 ), Variables( X( :Event Date ), X( :Amateur Built ), Y( :Latitude ) ), Elements( Position( 1, 1 ), Points( X, Y, Legend( 94 ) ), Smoother( X, Y, Legend( 95 ) ) ), Elements( Position( 2, 1 ), Points( X, Y, Legend( 96 ) ), Box Plot( X, Y, Legend( 97 ), Outliers( 0 ) ) ), SendToReport( Dispatch( {}, "Latitude", ScaleBox, {Min( 0 ), Max( 110.494221427167 ), Inc( 20 ), Minor Ticks( 3 ), Add Ref Line( 42.1037140060617, "Solid", "Red", "", 1 )} ), Dispatch( {}, "Graph Builder", FrameBox, {Marker Size( 4 ), Marker Drawing Mode( "Outlined" )} ), Dispatch( {}, "Graph Builder", FrameBox( 2 ), {Marker Size( 4 ), Marker Drawing Mode( "Outlined" )} ) ) )

 

 

2 ACCEPTED SOLUTIONS

Accepted Solutions
jthi
Super User

Re: Is it possible to script Graph Builder to bring reference lines to the front

If you change the order within customize graph, JMP will add Reference Line Order to your script (at least in JMP19). You can then search that from Scripting Index to get an idea what you could possibly do.

 

 

-Jarmo

View solution in original post

Re: Is it possible to script Graph Builder to bring reference lines to the front

Does this modified script work?

Graph Builder(
	Size( 964, 585 ),
	Show Control Panel( 0 ),
	Graph Spacing( 3 ),
	Spacing Borders( 1 ),
	Variables( X( :Event Date ), X( :Amateur Built ), Y( :Latitude ) ),
	Elements(
		Position( 1, 1 ),
		Points( X, Y, Legend( 94 ) ),
		Smoother( X, Y, Legend( 95 ) )
	),
	Elements(
		Position( 2, 1 ),
		Points( X, Y, Legend( 96 ) ),
		Box Plot( X, Y, Legend( 97 ), Outliers( 0 ) )
	),
	SendToReport(
		Dispatch( {}, "Latitude", ScaleBox,
			{Min( 0 ), Max( 110.494221427167 ), Inc( 20 ), Minor Ticks( 3 ),
			Add Ref Line( 42.1037140060617, "Solid", "Red", "", 1 )}
		),
		Dispatch( {}, "Graph Builder", FrameBox,
			{Marker Size( 4 ), Marker Drawing Mode( "Outlined" ),
			Reference Line Order( 3 )}
		),
		Dispatch( {}, "Graph Builder", FrameBox( 2 ),
			{Marker Size( 4 ), Marker Drawing Mode( "Outlined" ),
			Reference Line Order( 3 )}
		)
	)
);

If so, I simply clicked the Red Triangle at the top of GB and select Save Script > To Clipboard after interactively changing the rendering order so the Reference Lines followed the Markers.

View solution in original post

3 REPLIES 3
jthi
Super User

Re: Is it possible to script Graph Builder to bring reference lines to the front

If you change the order within customize graph, JMP will add Reference Line Order to your script (at least in JMP19). You can then search that from Scripting Index to get an idea what you could possibly do.

 

 

-Jarmo

Re: Is it possible to script Graph Builder to bring reference lines to the front

Does this modified script work?

Graph Builder(
	Size( 964, 585 ),
	Show Control Panel( 0 ),
	Graph Spacing( 3 ),
	Spacing Borders( 1 ),
	Variables( X( :Event Date ), X( :Amateur Built ), Y( :Latitude ) ),
	Elements(
		Position( 1, 1 ),
		Points( X, Y, Legend( 94 ) ),
		Smoother( X, Y, Legend( 95 ) )
	),
	Elements(
		Position( 2, 1 ),
		Points( X, Y, Legend( 96 ) ),
		Box Plot( X, Y, Legend( 97 ), Outliers( 0 ) )
	),
	SendToReport(
		Dispatch( {}, "Latitude", ScaleBox,
			{Min( 0 ), Max( 110.494221427167 ), Inc( 20 ), Minor Ticks( 3 ),
			Add Ref Line( 42.1037140060617, "Solid", "Red", "", 1 )}
		),
		Dispatch( {}, "Graph Builder", FrameBox,
			{Marker Size( 4 ), Marker Drawing Mode( "Outlined" ),
			Reference Line Order( 3 )}
		),
		Dispatch( {}, "Graph Builder", FrameBox( 2 ),
			{Marker Size( 4 ), Marker Drawing Mode( "Outlined" ),
			Reference Line Order( 3 )}
		)
	)
);

If so, I simply clicked the Red Triangle at the top of GB and select Save Script > To Clipboard after interactively changing the rendering order so the Reference Lines followed the Markers.

rbfinner
Level III

Re: Is it possible to script Graph Builder to bring reference lines to the front

@jthi & @Mark_Bailey - Thank you both.
Those answers led me to this

r = current report();

frameBoxList = r << XPath( "//FrameBox" );

// Giving a large enough number as input to Reference Line Order( ) 
// to ensure reference lines are brought to the front. 
frameBoxList << Reference Line Order( 100 );

// Or alternatively, I found seg count() which returns the number 
// of segs in a frame so could use that to set specific count for each one if needed. frameBoxList[1] << seg count();

Recommended Articles