"On the fly" distribution-report and using variablesTwo issues:
1. How do I get the sigma value from the histogram I just ploted to re-scale the bin of the plot?
2. How do I add ref lines (from different table) to each test name plot?
Thank you very much in advance!
"STD"- is the std value from the statistics table
"???"- is a value from "limits" table.
dt1 <SPAN class="token operator">=</SPAN> <SPAN class="token function">Open</SPAN><SPAN class="token punctuation">(</SPAN><SPAN class="token punctuation">)</SPAN><SPAN class="token punctuation">;</SPAN>
<SPAN class="token punctuation">:</SPAN>result <SPAN class="token operator"><</SPAN><SPAN class="token operator"><</SPAN><SPAN class="token messages"> Set Data Type</SPAN><SPAN class="token punctuation">(</SPAN> Numeric<SPAN class="token punctuation">,</SPAN> <SPAN class="token string">"Continuous"</SPAN> <SPAN class="token punctuation">)</SPAN><SPAN class="token punctuation">;</SPAN>
limits <SPAN class="token operator">=</SPAN> dt1 <SPAN class="token operator"><</SPAN><SPAN class="token operator"><</SPAN><SPAN class="token messages"> Summary</SPAN><SPAN class="token punctuation">(</SPAN> Group<SPAN class="token punctuation">(</SPAN> <SPAN class="token punctuation">:</SPAN>test_name <SPAN class="token punctuation">)</SPAN><SPAN class="token punctuation">,</SPAN> <SPAN class="token function">Mean</SPAN><SPAN class="token punctuation">(</SPAN> <SPAN class="token function">Eval</SPAN><SPAN class="token punctuation">(</SPAN> <SPAN class="token string">"range_min"</SPAN> <SPAN class="token punctuation">)</SPAN> <SPAN class="token punctuation">)</SPAN><SPAN class="token punctuation">,</SPAN> <SPAN class="token function">Mean</SPAN><SPAN class="token punctuation">(</SPAN> <SPAN class="token function">Eval</SPAN><SPAN class="token punctuation">(</SPAN> <SPAN class="token string">"range_max"</SPAN> <SPAN class="token punctuation">)</SPAN> <SPAN class="token punctuation">)</SPAN><SPAN class="token punctuation">,</SPAN> <SPAN class="token punctuation">)</SPAN><SPAN class="token punctuation">;</SPAN>
Ntests <SPAN class="token operator">=</SPAN> N Rows<SPAN class="token punctuation">(</SPAN> limits <SPAN class="token punctuation">)</SPAN><SPAN class="token punctuation">;</SPAN>
vl <SPAN class="token operator">=</SPAN> <SPAN class="token function">V List Box</SPAN><SPAN class="token punctuation">(</SPAN> <SPAN class="token function">Text Box</SPAN><SPAN class="token punctuation">(</SPAN> <SPAN class="token string">"Spec Limits Script"</SPAN> <SPAN class="token punctuation">)</SPAN> <SPAN class="token punctuation">)</SPAN><SPAN class="token punctuation">;</SPAN>
dt1 <SPAN class="token operator"><</SPAN><SPAN class="token operator"><</SPAN><SPAN class="token messages"> Distribution</SPAN><SPAN class="token punctuation">(</SPAN>
Continuous Distribution<SPAN class="token punctuation">(</SPAN> <SPAN class="token function">Column</SPAN><SPAN class="token punctuation">(</SPAN> <SPAN class="token punctuation">:</SPAN>result <SPAN class="token punctuation">)</SPAN><SPAN class="token punctuation">,</SPAN> Horizontal Layout<SPAN class="token punctuation">(</SPAN> <SPAN class="token number">1</SPAN> <SPAN class="token punctuation">)</SPAN><SPAN class="token punctuation">,</SPAN> Vertical<SPAN class="token punctuation">(</SPAN> <SPAN class="token number">0</SPAN> <SPAN class="token punctuation">)</SPAN> <SPAN class="token punctuation">)</SPAN><SPAN class="token punctuation">,</SPAN>
By<SPAN class="token punctuation">(</SPAN> <SPAN class="token punctuation">:</SPAN>test_name <SPAN class="token punctuation">)</SPAN><SPAN class="token punctuation">,</SPAN>
SendToReport<SPAN class="token punctuation">(</SPAN>
Dispatch<SPAN class="token punctuation">(</SPAN>
<SPAN class="token punctuation">{</SPAN><SPAN class="token string">"result"</SPAN><SPAN class="token punctuation">}</SPAN><SPAN class="token punctuation">,</SPAN>
<SPAN class="token string">"1"</SPAN><SPAN class="token punctuation">,</SPAN>
ScaleBox<SPAN class="token punctuation">,</SPAN>
<SPAN class="token punctuation">{</SPAN>Min<SPAN class="token punctuation">(</SPAN> <SPAN class="token number">97.5173285198556</SPAN> <SPAN class="token punctuation">)</SPAN><SPAN class="token punctuation">,</SPAN> Max<SPAN class="token punctuation">(</SPAN> <SPAN class="token number">97.9576714801444</SPAN> <SPAN class="token punctuation">)</SPAN><SPAN class="token punctuation">,</SPAN> Inc<SPAN class="token punctuation">(?STD?</SPAN><SPAN class="token punctuation">)</SPAN><SPAN class="token punctuation">,</SPAN> Minor Ticks<SPAN class="token punctuation">(</SPAN> <SPAN class="token number">0</SPAN> <SPAN class="token punctuation">)</SPAN><SPAN class="token punctuation">,</SPAN>
Add Ref <SPAN class="token function">Line</SPAN><SPAN class="token punctuation">(</SPAN> limits<SPAN class="token punctuation">[</SPAN><SPAN class="token operator">?</SPAN><SPAN class="token operator">?</SPAN><SPAN class="token operator">?</SPAN><SPAN class="token punctuation">,</SPAN><SPAN class="token number">3</SPAN><SPAN class="token punctuation">]</SPAN><SPAN class="token punctuation">,</SPAN> <SPAN class="token string">"Solid"</SPAN><SPAN class="token punctuation">,</SPAN> <SPAN class="token string">"Black"</SPAN><SPAN class="token punctuation">,</SPAN> <SPAN class="token string">""</SPAN><SPAN class="token punctuation">,</SPAN> <SPAN class="token number">1</SPAN> <SPAN class="token punctuation">)</SPAN><SPAN class="token punctuation">,</SPAN> Add Ref <SPAN class="token function">Line</SPAN><SPAN class="token punctuation">(</SPAN> limits<SPAN class="token punctuation">[</SPAN><SPAN class="token operator">?</SPAN><SPAN class="token operator">?</SPAN><SPAN class="token operator">?</SPAN><SPAN class="token punctuation">,</SPAN><SPAN class="token number">4</SPAN><SPAN class="token punctuation">]</SPAN><SPAN class="token punctuation">,</SPAN> <SPAN class="token string">"Solid"</SPAN><SPAN class="token punctuation">,</SPAN> <SPAN class="token string">"Black"</SPAN><SPAN class="token punctuation">,</SPAN> <SPAN class="token string">""</SPAN><SPAN class="token punctuation">,</SPAN> <SPAN class="token number">1</SPAN> <SPAN class="token punctuation">)</SPAN><SPAN class="token punctuation">}</SPAN>
<SPAN class="token punctuation">)</SPAN>
<SPAN class="token punctuation">)</SPAN>
<SPAN class="token punctuation">)</SPAN><SPAN class="token punctuation">;</SPAN>
Re: "On the fly" distribution-report and using variablesThis seems to be the same question as that which is now addressed in a parallel thread.
Re: "On the fly" distribution-report and using variablesPlease see attached file.
Distribution by "test_name"
add line by range_max & range_min
bin size by std.
Thanks!
Re: "On the fly" distribution-report and using variablesOK. It seems like you then have two 'issues'; one is that the variables 'ref1Val', 'ref2Val' and 'IncVal' are assigned a priori, and the other is that you need to use a 'By' variable. But both are easily overcome.
The values mentioned could have been computed or looked up by other JSL (rather than given values through assignments, as above).
And when using a 'By' variable, the details may depend a little on whether or not you know the number of groups in advance. But the use of 'SubstituteInto()' will probably be the same. Some sample data and values would assist greatly if you need or want more help.
Re: "On the fly" distribution-report and using variablesThanks but this is not the problem.
My issue is that I would like to perform "By( :test_name )" so I will get many different plots. I would like to change each of them by the statistics of each Distribution.
In your example you a priory set the values, and for only one type/test_name.
ThanksRe: "On the fly" distribution-report and using variablesSee the relevant sections in 'Help > Books > Scripting Guide' and 'Help > Scripting Index'.
This shows the idea:
NamesDefaultToHere(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
// Auto-generated axis
dist1 = dt << Distribution( Continuous Distribution( Column( :height ) ), Histograms Only );
// Assign some values used to update the histogram axis
ref1Val = 55;
ref2Val = 65;
incVal = 10;
// Expression to make distribution with user axis
makeDist =
Expr(
dist2 = dt << Distribution(
Continuous Distribution( Column( :height ) ), Histograms Only,
SendToReport(
Dispatch(
{"height"},
"1",
ScaleBox,
{
Inc(IncValTBD),
Add Ref Line( ref1ValTBD, "Solid", "Red", "", 1 ),
Add Ref Line( ref2ValTBD, "Solid", "Red", "", 1 )
}
),
Dispatch(
{"height"},
"Distrib Histogram",
FrameBox,
{
Grid Line Order( 1 ),
Reference Line Order( 3 )
}
)
)
)
);
// Update the expression with by baking in the chosen values
SubstituteInto(
makeDist,
Expr(IncValTBD), IncVal,
Expr(ref1ValTBD), ref1Val,
Expr(ref2ValTBD), ref2Val
);
// Remake the distribution
makeDist;