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
SW
SW
Level III

Uniform axis scaling in Control Chart Builder Script

I am working on a script to cycle through a list of properties and make a pair of control charts for each.  The pair (by "Line") of charts must be displayed side-by-side and have the same Y-axis scaling.

I have a list of properties (a list variable called CCProperty), and a list of axis settings for each property (a matrix variable called CCFormat).  Even though I used the same numbers (as CCFormat[i,j]) for min, max, increment, and number of ticks for each graph, the scales do not consistently match.

 

Any help would be appreciated. I am using JMP Pro 18.1.1

 

The full data table with embedded script is attached.  Here's a snippet of the code:

For(i=1, i <= N Items(CCProperty), i += 1,  //  Loop through all the properties and make control charts using the graph min and max

Mainbox<<append(hb=H List Box()); //Append the horizontal box with the two graphs to the mainbox


//*********Generate the Control Chart for LINE 1:**************
	hb<<append(Control Chart Builder(
	Size( 650, 600 ),Graph Spacing( 10 ),
	Test Excluded Subgroups( 0 ),Show Limit Labels( 1 ),Show Capability( 0 ),Show Limit Summaries( 0 ),
	
	Variables( Subgroup( :Workorder ), Y(column(CCProperty[i])) ),
	Chart(Position( 1 ),Points( Statistic( "Average" ) ),Limits( Sigma( "Moving Range" ), Spec Limits( 1 ) )	),
	Chart(Position( 2 ),Points( Statistic( "Moving Range on Means" ) ),Limits( Sigma( "Moving Range" ) )	),
	Chart(Position( 3 ),Points( Statistic( "Standard Deviation" ) ),Limits( Sigma( "Standard Deviation" ) )	),
	Show Control Panel( 0 ),
	By( :Line ),

	Where( :Line == "Line 1" ),
	SendToReport(Dispatch(CCProperty, ScaleBox,{Min( CCFormat[i,1] ),Max( CCFormat[i,2] ),Inc( CCFormat[i,3] ),Minor Ticks( CCFormat[i,4] )}	),
			),
	));

	
//*********Generate the Control Chart for LINE 2:**************
	hb<<append(Control Chart Builder(
	Size( 650, 600 ),Graph Spacing( 10 ),
	Test Excluded Subgroups( 0 ),Show Limit Labels( 1 ),Show Capability( 0 ),Show Limit Summaries( 0 ),
	
	Variables( Subgroup( :Workorder ), Y(column(CCProperty[i])) ),
	Chart(Position( 1 ),Points( Statistic( "Average" ) ),Limits( Sigma( "Moving Range" ), Spec Limits( 1 ) )	),
	Chart(Position( 2 ),Points( Statistic( "Moving Range on Means" ) ),Limits( Sigma( "Moving Range" ) )	),
	Chart(Position( 3 ),Points( Statistic( "Standard Deviation" ) ),Limits( Sigma( "Standard Deviation" ) )	),
	Show Control Panel( 0 ),
	By( :Line ),
	Where( :Line == "Line 2" ),
	SendToReport(Dispatch(CCProperty, ScaleBox,{Min( CCFormat[i,1] ),Max( CCFormat[i,2] ),Inc( CCFormat[i,3] ),Minor Ticks( CCFormat[i,4] )}),
			),
		
	));
	
);  //end of For Loop
2 REPLIES 2
jthi
Super User

Re: Uniform axis scaling in Control Chart Builder Script

I did slight changes to your script which might solve the issue in this case. This part I changed the most

 

SendToReport(
	Dispatch({}, CCProperty[i], ScaleBox, {Min(CCFormat[i, 1]), Max(CCFormat[i, 2]), Inc(CCFormat[i, 3]), Minor Ticks(CCFormat[i, 4])}),
)

 

 

View more...
Names Default To Here(1);

CCProperty = {"Strength", "Elongation", "Weight", "Thickness"};

CCFormat = [60 66 1 4, 25 45.5 5 4, 3.4 4.0 0.1 4, 8 16 1 4];

outputwin = New Window("Control Charts", Outline Box("Control Charts", Mainbox = V List Box()));

For(i = 1, i <= N Items(CCProperty), i++,
	Mainbox << append(hb = H List Box());

	hb << append(
		Control Chart Builder(
			Size(650, 600),
			Graph Spacing(10),
			Test Excluded Subgroups(0),
			Show Limit Labels(1),
			Show Capability(0),
			Show Limit Summaries(0), 
	
			Variables(Subgroup(:Workorder), Y(Column(CCProperty[i]))),
			Chart(Position(1), Points(Statistic("Average")), Limits(Sigma("Moving Range"), Spec Limits(1))),
			Chart(Position(2), Points(Statistic("Moving Range on Means")), Limits(Sigma("Moving Range"))),
			Chart(Position(3), Points(Statistic("Standard Deviation")), Limits(Sigma("Standard Deviation"))),
			Show Control Panel(0),
			By(:Line), 

			Where(:Line == "Line 1"),
			SendToReport(
				Dispatch({}, CCProperty[i], ScaleBox, {Min(CCFormat[i, 1]), Max(CCFormat[i, 2]), Inc(CCFormat[i, 3]), Minor Ticks(CCFormat[i, 4])}),
			)
		)
	);

	hb << append(
		Control Chart Builder(
			Size(650, 600),
			Graph Spacing(10),
			Test Excluded Subgroups(0),
			Show Limit Labels(1),
			Show Capability(0),
			Show Limit Summaries(0), 
	
			Variables(Subgroup(:Workorder), Y(Column(CCProperty[i]))),
			Chart(Position(1), Points(Statistic("Average")), Limits(Sigma("Moving Range"), Spec Limits(1))),
			Chart(Position(2), Points(Statistic("Moving Range on Means")), Limits(Sigma("Moving Range"))),
			Chart(Position(3), Points(Statistic("Standard Deviation")), Limits(Sigma("Standard Deviation"))),
			Show Control Panel(0),
			By(:Line),
			Where(:Line == "Line 2"),
			SendToReport(
				Dispatch({}, CCProperty[i], ScaleBox, {Min(CCFormat[i, 1]), Max(CCFormat[i, 2]), Inc(CCFormat[i, 3]), Minor Ticks(CCFormat[i, 4])}),
			)
		)
	);
);  //end of For Loop

Generally I would suggest setting the axis values outside of the graph, but in simple case like this, using sendtoreport inside the graph message should be enough

 

-Jarmo
SW
SW
Level III

Re: Uniform axis scaling in Control Chart Builder Script

Thanks for the help!  I guess the missing subscript [i] in my CCProperty list variable was the cause of my issues.

Recommended Articles