cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Try the Materials Informatics Toolkit, which is designed to easily handle SMILES data. This and other helpful add-ins are available in the JMP® Marketplace
Choose Language Hide Translation Bar
Mikasa
Level II

How to define the control limits from a column using graph builder?

Hi everyone

I am using graph builder to make the graphs in a report. I like to add the refence lines on the graph as CL,LCL,UCL. I have them in the columns (eg. X) in my table. I am trying to call them in the script like,

{Add Ref Line(:X, "Solid", "Black", "LCL", 1 )}

But it does not work

Could you please help me

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
jthi
Super User

Re: How to define the control limits from a column using graph builder?

Could you provide some sort of an example data table? It doesn't have any real data as long as it shows the basic idea of the data. Depending on how the data looks, you could maybe ColMin/ColMax functions like ColMin(dt:UCL).

-Jarmo

View solution in original post

5 REPLIES 5
jthi
Super User

Re: How to define the control limits from a column using graph builder?

Depending on your data you could do it this way:

 

Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
//add limit columns
dt << New Column("UCL", Numeric, Continuous, Set Each Value(70));
dt << New Column("CL", Numeric, Continuous, Set Each Value(60));
dt << New Column("LCL", Numeric, Continuous, Set Each Value(50));

gb = Graph Builder(Variables(X(:age), Y(:height)), Elements(Points(X, Y, Legend(4))));

axisb = (report(gb)[axisbox(2)]);
axisb << ({
	Add Ref Line(dt:UCL[1], "Solid", "Black", "UCL", 1),
	Add Ref Line(dt:CL[1], "Solid", "Black", "CL", 1),
	Add Ref Line(dt:LCL[1], "Solid", "Black", "LCL", 1)
});

Or plot those columns directly:

 

jthi_0-1627925080072.png

or set those to column properties as spec limits:

jthi_1-1627925249262.png

jthi_2-1627925256368.png

All these can be scripted if needed.

 

Edit:

And if you meant you have Control Limit Column property set, it will require a bit extra scripting to get the limits out of column property (parse part will most depend a bit on case and how control limits are set, but the idea should be same):

Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Quality Control/Coating.jmp");
obj = dt << Control Chart(Sample Size(:Sample), KSigma(3), Chart Col(:Weight, XBar, R));
Wait(0);
obj << Save Limits(in Column);

gb = Graph Builder(
	Variables(X(:Sample), Y(:Weight)),
	Elements(Points(X, Y, Legend(3)), Smoother(X, Y, Legend(4)))
);

//get Control Limits column property and parse limits
colProp = dt:weight << Get Property("Control Limits");
xbarLimits = Words(Char(colProp[1]));
xbarCL = Num(Word(3, xbarLimits[1], "()"));
xbarLCL = Num(Word(2, xbarLimits[2], "()"));
xbarUCL = Num(Word(2, xbarLimits[3], "()"));

//add control limits
axisb = (report(gb)[axisbox(2)]);
axisb << ({
	Add Ref Line(xbarUCL, "Solid", "Black", "UCL", 1),
	Add Ref Line(xbarCL, "Solid", "Black", "CL", 1),
	Add Ref Line(xbarLCL, "Solid", "Black", "LCL", 1)
});
-Jarmo
Mikasa
Level II

Re: How to define the control limits from a column using graph builder?

@jthi, Thank you. 

I have the control limits as columns. I can call one cell as UCL[1], but the problem is, some of these columns have empty cells that might be the first or any other cell. I want to add the Ref line from the cell in the column which is not empty. 

Do you have any idea how I can do that?

Thanks

jthi
Super User

Re: How to define the control limits from a column using graph builder?

Could you provide some sort of an example data table? It doesn't have any real data as long as it shows the basic idea of the data. Depending on how the data looks, you could maybe ColMin/ColMax functions like ColMin(dt:UCL).

-Jarmo
Mikasa
Level II

Re: How to define the control limits from a column using graph builder?

Thank you. it worked, although I still do not know if I have some missing data in a column, how I can pick the cell with data. But in this case using the functions worked.

jthi
Super User

Re: How to define the control limits from a column using graph builder?

ColMin and ColMax will just take minimum or maximum value from the column and ignoring the missing value.

 

Some quick examples:

Names Default To Here(1);

dt = New Table("Untitled",
	Add Rows(5),
	New Column("Value", Numeric, "Continuous", Format("Best", 12), Set Values([., 1, ., ., 2]))
);

Show(ColMin(:Value));
Show(ColMax(:Value));

//A bit more complicated. Loc gets rows which have non missing value as a matrix
//Then we use that matrix to get values from Value column
//and finally from that we will use only the first index
Show(:Value[Loc(:Value << get as matrix)][1]);
//You can run this in parts to see how it works
//Loc(:Value << get as matrix)
//:Value[Loc(:Value << get as matrix)]

//Will return missing value
Show(:Value[1]);
-Jarmo