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.
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}
Is there a specific reason to try and modify Graph Box within the Graphic Script?
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.
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()
Eval(EvalExpr(
fb << Add Graphics Script(
Transparency(0.2);
Pen Color("Green");
Fill Color("Green");
Rect(Expr(lslstart), Expr(uslend), 1);
);
));
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
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.
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)
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.
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?
What goes wrong with it (I don't have your data so I cannot check)?