cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
The Discovery Summit 2025 Call for Content is open! Submit an abstract today to present at our premier analytics conference.
See how to use to use Text Explorer to glean valuable information from text data at April 25 webinar.
Choose Language Hide Translation Bar
wilsonliao233
Level II

How do I define spec limits by data category in variability chart

Hi,

How can I draw spec limits(red line) by data category in variability chart as below example?  The red line was done by manual in pptx.

Attach jmp file data for reference. Appreciate for your reply. Thanks.

 

wilsonliao233_0-1742462046122.png

 

22 REPLIES 22
wilsonliao233
Level II

Re: How do I define spec limits by data category in variability chart

Hi Jarmo,

I try to change to Graph Box from line, but it's not work with the modified script below. how could I modify?

	Eval(EvalExpr(
			fb << Add Graphics Script(
		    Fill Color("Green");
			Transparency( 0.3 );
			Graph Box(Expr(lslstart), Expr(lslend)); // {x1, y1}, {x2, y2}
			Graph Box(Expr(uslstart), Expr(uslend)); // {x1, y1}, {x2, y2}
jthi
Super User

Re: How do I define spec limits by data category in variability chart

Is there a specific reason to try and modify Graph Box within the Graphic Script?

-Jarmo
wilsonliao233
Level II

Re: How do I define spec limits by data category in variability chart

Hi Jarmo,

When there are multiple sets of X-Axis phase/groups, this line may obscure the boxplot data points. I would like to use the following image instead.

wilsonliao233_0-1742994978375.png

 

jthi
Super User

Re: How do I define spec limits by data category in variability chart

Then you could use Rect instead of Line(), no need for graph box (graph box basically is already there). You will have to manage missing values someway if you go with this option as missing points will cause issues with Rect()

jthi_0-1742998988291.png

Eval(EvalExpr(
	fb << Add Graphics Script(
		Transparency(0.2);
		Pen Color("Green");
		Fill Color("Green");
		Rect(Expr(lslstart), Expr(uslend), 1);
	);
));
-Jarmo
wilsonliao233
Level II

Re: How do I define spec limits by data category in variability chart

Hi Jarmo,

 

Thanks for your prompt reply. 

One more question for adding additional X-Axis value.

When I input other X value(SampleA), I modified script below. But the result of limit line is incorrect, how can I modify it?

var = dt << Variability Chart(Y(:Data), X(:Phase, :SampleGroup, :SampleA));

dt_summary = dt << Summary(
	Group(:Phase),
	Max(:LSL),
	Mean(:Target),
	Min(:USL),
	N Categories(:SampleGroup, :SampleA),
	Freq("None"),
	Weight("None"),
	statistics column name format("column"),
	Link to original data table(0)
);
dt_summary << Delete Columns("N Rows");

// We need access to the framebox
fb = Report(var)[Outline Box("Variability Chart for Data"), Frame Box(1)];

//Get phases count (this was missing)
Summarize(dt, phases = By(:Phase));

// Using graphic scripts most likely easiest option
xidx = 0;
For(i = 1, i <= N Items(phases), i++,
	curphase = dt_summary[i, "Phase"];
	curlsl = dt_summary[i, "LSL"];
	curusl = dt_summary[i, "USL"];
	curtarget = dt_summary[i, "Target"];
	curcount = dt_summary[i, "SampleGroup", "SampleA"];
	
	xend = xidx + curcount;
	
	lslstart = Eval List({xidx, curlsl});
	lslend = Eval List({xend, curlsl});

	uslstart = Eval List({xidx, curusl});
	uslend = Eval List({xend, curusl});

	targetstart = Eval List({xidx, curtarget});
	targetend = Eval List({xend, curtarget});
	
	xidx = xend;
	
	Eval(EvalExpr(
			fb << Add Graphics Script(
			Pen Color("Red");
			Pen Size(1);
			Line(Expr(lslstart), Expr(lslend)); // {x1, y1}, {x2, y2}
			Line(Expr(uslstart), Expr(uslend)); // {x1, y1}, {x2, y2}
			Pen Color("Blue");
			Line(Expr(targetstart), Expr(targetend)); // {x1, y1}, {x2, y2}
		);
	));
);

fb << Y Axis(Max(1.1*Max(Col Max(Column(dt, "Data")), Col Max(Column(dt_summary, "USL"))))); // adjust yaxis
jthi
Super User

Re: How do I define spec limits by data category in variability chart

How are the limits formed (based on which groups)? What is going wrong? Most likely you have to adjust Summary, possible Summarize and curcount value.

-Jarmo
wilsonliao233
Level II

Re: How do I define spec limits by data category in variability chart

Yes, I noticed that, so I modified script for Summarize and curcount value. But limit line cannot completely cover all the conditions under phase. Limits are still based on "phase".  (Please ignore that there is no new SampleA X-Axis)

 

wilsonliao233_0-1744506428168.png

 

jthi
Super User

Re: How do I define spec limits by data category in variability chart

You could create new column into your main table which is combination of SampleGroup, :SampleA for example by concatenating them. Then use that for the N Categories in Summary and for curcount to get the correct counts.

-Jarmo
wilsonliao233
Level II

Re: How do I define spec limits by data category in variability chart

var = dt << Variability Chart(Y(:Data), X(:Phase, :SampleGroup, :SampleA));

dt_summary = dt << Summary(
	Group(:Phase),
	Max(:LSL),
	Mean(:Target),
	Min(:USL),
	N Categories(:SampleGroup, :SampleA),
	Freq("None"),
	Weight("None"),
	statistics column name format("column"),
	Link to original data table(0)
);
dt_summary << Delete Columns("N Rows");

// We need access to the framebox
fb = Report(var)[Outline Box("Variability Chart for Data"), Frame Box(1)];

//Get phases count (this was missing)
Summarize(dt, phases = By(:Phase));

// Using graphic scripts most likely easiest option
xidx = 0;
For(i = 1, i <= N Items(phases), i++,
	curphase = dt_summary[i, "Phase"];
	curlsl = dt_summary[i, "LSL"];
	curusl = dt_summary[i, "USL"];
	curtarget = dt_summary[i, "Target"];
	curcount = dt_summary[i, "N Rows"];

I modified script above, but limit line can't generate. How could I modify it?

jthi
Super User

Re: How do I define spec limits by data category in variability chart

What goes wrong with it (I don't have your data so I cannot check)?

-Jarmo

Recommended Articles