Allow ranges in graph builderHi,
When changing the X-axis settings in a graph is it possible to use the Allow Ranges and picking values based on the data set (in a script)? Or can this only be manually?
I´m trying to produce a plot with colour coded ranges (that are chosen from the data set), like a control chart but on the x-axis.
Br Julie
Re: Allow ranges in graph builderBelow is the code that I used to add in the range value
names default to here(1);
dt=open("$SAMPLE_DATA/semiconductor capability.jmp");
gb = Graph Builder(
Size( 534, 456 ),
Show Control Panel( 0 ),
Variables( X( :PNP1 ), Y( :NPN1 ) ),
Elements( Points( X, Y, Legend( 3 ) ) )
);
Eval(
Substitute(
Expr(
Report( gb )[AxisBox( 1 )] << Add Ref Line( {__LSL__, __USL__}, "Solid", "Black", "", 1, 0.25 )
),
Expr( __LSL__ ), (dt:PNP1 << get property( "spec limits" ))["LSL"],
Expr( __USL__ ), (dt:PNP1 << get property( "spec limits" ))["USL"]
)
);Re: Allow ranges in graph builderHi @JulieSAppel,
You should be able to replace the actual number, e.g. 119.84 with something like Eval(Col Min(:Column)) and the max with something like Eval(Col Max(:Column2)).
I did a quick test on one of my data tables, and this works. If the column is "lower limit", you might have to do something like
Eval(Col Min(:Name("lower limit"))). You might need to adjust the ticks in the JSL code to make for a more appealing graph, but I think an approach like this might work.
I'm sure @txnelson should be able to confirm if my approach is valid.
Hope this helps!,
DS
Re: Allow ranges in graph builderActually my ranges will differ from dataset to dataset so I´m trying to figure out how to have the ranges in the graph added based on limits in the data set and not one set of ranges. So basically, in the code where it says:
<SPAN class="token function">report</SPAN><SPAN class="token punctuation">(</SPAN>gb<SPAN class="token punctuation">)</SPAN><SPAN class="token punctuation">[</SPAN>AxisBox<SPAN class="token punctuation">(</SPAN><SPAN class="token number">1</SPAN><SPAN class="token punctuation">)</SPAN><SPAN class="token punctuation">]</SPAN><SPAN class="token operator"><</SPAN><SPAN class="token operator"><</SPAN><SPAN class="token messages">Add Ref Line</SPAN><SPAN class="token punctuation">(</SPAN> <SPAN class="token punctuation">{</SPAN><SPAN class="token number">119.84</SPAN><SPAN class="token punctuation">,</SPAN> <SPAN class="token number">130</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 number">0.25</SPAN> <SPAN class="token punctuation">)</SPAN><SPAN class="token punctuation">;</SPAN> Can you have references to specific data point instead of actual numbers (e.g.: dt(:lower limit, :upper limit) instead of <SPAN class="token number">119.84</SPAN><SPAN class="token punctuation">,</SPAN> <SPAN class="token number">130</SPAN>)?
Re: Allow ranges in graph builderThe easiest way to find out what the JSL to add such an option such as the "Allow Ranges" is to interactively run the graph, adding the option you want(Allow Ranges) and then to save the script from the graph. Here is a graph with Allow Ranges

and here is the script generated from the graph
Graph Builder(
Variables( X( :weight ), Y( :height ) ),
Elements( Points( X, Y, Legend( 3 ) ), Smoother( X, Y, Legend( 4 ) ) ),
SendToReport(
Dispatch(
{},
"weight",
ScaleBox,
{Add Ref Line( {119.84, 130}, "Solid", "Black", "", 1, 0.25 )}
)
)
);
And here is a modification to that script into a form that is more programmically easy to work with
gb = Graph Builder(
Variables( X( :weight ), Y( :height ) ),
Elements( Points( X, Y, Legend( 3 ) ), Smoother( X, Y, Legend( 4 ) ) ));
report(gb)[AxisBox(1)]<<ADD ref="" line=""></ADD>