cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Discussions

Solve problems, and share tips and tricks with other JMP users.
Choose Language Hide Translation Bar
cmarsh26
New Member

How can I get my graphing script to reference my row-wise control limits and add them automatically to my graph? WIP script included

Hi there! I am working on creating a script that graphs a numerical value (X) against Tools (Y) that includes given upper and lower control limits in the data table that vary by subgroup, and will automatically include the limits on the graphs when the script is run. I also need these graphs to be separated by "Layer". Here is what I have so far. I can get the graphs to generate, but I can't seem to get the control limit lines to show up. Also, the first graph has much smaller point sizes than the rest of the graphs. I'm still relatively new to writing scripts from scratch, so any help is much appreciated! Here is what I have so far. (JMP version: 17.2)

Names Default To Here( 1 );
dt = Current Data Table();
 
xCol = Column( dt, "Tool" );
yCol = Column( dt, "Value" );
uclCol = Column( dt, "UCL" );
lclCol = Column( dt, "LCL" );
LayerCol = Column( dt, "Layer" );
 
gb = Graph Builder(
	Size( 633, 6849 ),
	Show Control Panel( 0 ),
	Title Fill Color( "White" ),
	Level Fill Color( "White" ),
	Page Level Fill Color( "White" ),
	Variables( X( :Tool ), Y( :Value ), Page( :Layer ) ),
	Elements( Points( X, Y, Legend( 1 ) ) ),
	Elements( Line( X( xCol ), Y( uclCol ), Legend( 2 ) ) ),
	Elements( Line( X( xCol ), Y( lclCol ), Legend( 3 ) ) ), 
 
	SendToReport(
		Dispatch( {}, "Graph", ScaleBox, {Format( "Best", 12 ), Inc( 1 ), Minor Ticks( 1 )} ),
		Dispatch( {}, "Graph Builder", FrameBox, {Marker Size( 2 ), Line Width( 2 )} ), 
   
	)
);
 
 
rep = gb << Report();
fr = rep[FrameBox( 1 )];
leg = rep[LegendBox( 1 )];
leg = rep[Legend Box( 1 )];
 
Try( leg << Set Item Name( 1, "Value" ) );
Try( leg << Set Item Color( 1, "Steel Blue" ) );
Try( fr << Set Marker Size( 1, 3 ) );
Try( fr << Set Marker Style( 1, "FilledCircle" ) );
Try( leg << Set Item Name( 2, "UCL" ) );
Try( leg << Set Item Name( 3, "LCL" ) );
Try( leg << Set Item Color( 2, "Red" ) );
Try( leg << Set Item Color( 3, "Red" ) );
Try( leg << Set Item Line Style( 2, "Solid" ) );
Try( leg << Set Item Line Style( 3, "Solid" ) );
Try( fr << Set Line Width( 2, 2 ) );       // UCL
Try( fr << Set Line Width( 3, 2 ) );       // LCL

Edited by txnelson JSL into JSL Display Box

 
1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: How can I get my graphing script to reference my row-wise control limits and add them automatically to my graph? WIP script included

You just need to add the UCL and LCL to the Y axis and then add a line, specifying that Value is the only variable to be used for the points and that LCL and UCL are the only variables to be used for the lines

txnelson_0-1768519864213.png


Graph Builder(
	Size( 633, 6849 ),
	Show Control Panel( 0 ),
	Title Fill Color( "White" ),
	Level Fill Color( "White" ),
	Page Level Fill Color( "White" ),
	Variables(
		X( :Tool ),
		Y( :Value ),
		Y( :UCL, Position( 1 ) ),
		Y( :LCL, Position( 1 ) ),
		Page( :Layer )
	),
	Elements(
		Points( X, Y( 1 ), Legend( 1 ) ),
		Line( X, Y( 2 ), Y( 3 ), Legend( 2 ) )
	),
	SendToReport(
		Dispatch( {}, "Graph Builder", FrameBox,
			{Marker Size( 2 ), Marker Drawing Mode( "Normal" )}
		)
	)
);
Jim

View solution in original post

6 REPLIES 6
txnelson
Super User

Re: How can I get my graphing script to reference my row-wise control limits and add them automatically to my graph? WIP script included

If you generate the graph you want using the interactive capabilities of Graph Builder, you can then simply specify to save the script, and it will generate a script that will replicate the graph.

Jim
cmarsh26
New Member

Re: How can I get my graphing script to reference my row-wise control limits and add them automatically to my graph? WIP script included

Hi Jim, thank you for your reply! I was able to get the graphs to generate, but the biggest issue I'm running into now is that I still can't figure out how to add in the UCL and LCL reference lines into my script so that when it's run, the graphs are separated by layer and each graph has its respective LCL and UCL reference lines included on it. The UCL and LCL are columns in my data table, just can't seem to figure out the correct way to reference them.

txnelson
Super User

Re: How can I get my graphing script to reference my row-wise control limits and add them automatically to my graph? WIP script included

Can you attach a sample file?

Jim
cmarsh26
New Member

Re: How can I get my graphing script to reference my row-wise control limits and add them automatically to my graph? WIP script included

Hi Jim,

Data table attached, with the original script I pasted above in the table scripts section.

txnelson
Super User

Re: How can I get my graphing script to reference my row-wise control limits and add them automatically to my graph? WIP script included

You just need to add the UCL and LCL to the Y axis and then add a line, specifying that Value is the only variable to be used for the points and that LCL and UCL are the only variables to be used for the lines

txnelson_0-1768519864213.png


Graph Builder(
	Size( 633, 6849 ),
	Show Control Panel( 0 ),
	Title Fill Color( "White" ),
	Level Fill Color( "White" ),
	Page Level Fill Color( "White" ),
	Variables(
		X( :Tool ),
		Y( :Value ),
		Y( :UCL, Position( 1 ) ),
		Y( :LCL, Position( 1 ) ),
		Page( :Layer )
	),
	Elements(
		Points( X, Y( 1 ), Legend( 1 ) ),
		Line( X, Y( 2 ), Y( 3 ), Legend( 2 ) )
	),
	SendToReport(
		Dispatch( {}, "Graph Builder", FrameBox,
			{Marker Size( 2 ), Marker Drawing Mode( "Normal" )}
		)
	)
);
Jim
cmarsh26
New Member

Re: How can I get my graphing script to reference my row-wise control limits and add them automatically to my graph? WIP script included

Got it, this worked! Thank you!

Recommended Articles