Uniform axis scaling in Control Chart Builder Script
Mar 17, 2025 12:05 PM(543 views)
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
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