Help Pulling Data for Dynamic Axis Limit SettingHello,
I am attempting to determine the axis limits on a graph depending on the current data plotted so that all reference lines and data points are visible after user inputs.
The axis limit set will either be the value of the USL / LSL reference line or the highest / lowest data point plotted. The graph in use in a Variability Chart and the data are the values in Column 2 grouped by Column 1.
Initially I thought I could do this by determining the min/max of the two values where the reference to the data was determined by the Col Minimum function with the
Var1_Min = Eval( Min((LSL[1]*0.95), Col Minimum( :Column 2, :Column 1["Group1"] )));
I've spent a lot of time searching and can't seem to find a function that does what I need to - any ides?
GraphicsScriptingRe: Help Pulling Data for Dynamic Axis Limit SettingIf you have your spec limits saved as column properties, and have indicated to "Show Limits", Graph Builder will automatically expand the axes range to include the USL and LSL.

However, you can easily override the axis values, as shown below, where the maximum X axis value is changed to the USL plus 10% of the range of USL-LSL

Here is the simple script
names default to here(1);
// Open Data Table: semiconductor capability.jmp
// → Data Table( "semiconductor capability" )
dt = Open( "\Example.jmp" );
// Change column property: NPN1
Data Table( "Example" ):NPN1 << Set Property(
"Spec Limits",
{LSL( 104.41 ), USL( 131.89 ), Target( 118.15 ), Show Limits( 1 )}
);
// Change column property: NPN2
Data Table( "Example" ):NPN2 << Set Property(
"Spec Limits",
{LSL( 96.59 ), USL( 130.9 ), Target( 113.75 ), Show Limits( 1 )}
);
// Report snapshot: semiconductor capability - Graph Builder
gb = Data Table( "Example" ) <<
Graph Builder(
Variables( X( :NPN2 ), Y( :NPN1 ) ),
Elements( Points( X, Y, Legend( 3 ) ) )
);
// Set Maximum Y axis value to be displayed
specs = dt:NPN1 << get property( "Spec Limits" );
maxY = Max( Col Maximum( :NPN1 ), specs["USL"] + .1 * (specs["USL"] - specs["LSL"]) );
Report( gb )[AxisBox( 2 )] << Max( maxY );Re: Help Pulling Data for Dynamic Axis Limit SettingThank you for your response Jim!
Unfortunately, I don't have a single spec limit for my column as there's a distinction between the values based on another column so I haven't found a way to do traditional column spec limits yet without completely splitting my data into two tables.
I was ultimately able to find the solution to my problem by using Get Rows Where:
dt = Current Data Table();
G1 = dt << Get Rows Where (:Column 1 == "Group1");
G1_Min = Eval( Min((LSL[1]*0.95), Min(:Column 2[G1])));
G1_Max = Eval( Max((USL[1]*1.05), Max(:Column 2[G1])));<BR />dt << clear select;
<BR />dt = Current Data Table();
G2 = dt << Get Rows Where (:Column 1 == "Group2");
G2_Min = Eval( Min((LSL[2]*0.95), Min(:Column 2[G2])));
G2_Max = Eval( Max((USL[2]*1.05), Max(:Column 2[G2])));<BR />dt << clear select;<BR /><BR />Then to graph within dispatch section (for the first graph, second is duplicate with 1->2):<BR /><BR />Dispatch ({Min(G1_Min), Max(G1_Max), Inc( Eval((G1_Max - G1_Min) / 7))),<BR />Add Ref Line( LSL[1], "Solid", "Medium Dark Blue", "LSL", 1 ),<BR />Add Ref Line( USL[1], "Solid", "Medium Dark Blue", "USL", 1 )}* Note I forgot to mention in my original question that the USL/LSL are already defined in a lists and used for the reference lines.