I have a code "sample.jsl" which has a loop to create a bi-var plot for each column. I am trying to add a range slider box to this loop so that once I run the script it creates one graph for all the columns with separate range slider box for each graph.
The limits for all the x-axis columns are in "limits.jmp" and the datafile is "Data.jmp". The code "sample.jsl" creates one graph each for all the parameters at once. I want to modifly the code so that it also adds a range slider box to all the graphs.
The range slider box should have the upper control limits (ucl) and lcl as the two dynamic sliders.
I have this code which creates the range slider box but it just works for a single graph. I need a script which creates all the graphs together with the dynamic range slider boxes.
@txnelson
myFinalDisplay = expr(
myLimitCol = column(dt, "ColA"); //new
myLimitMin = colMinimum(myLimitCol); show(myLimitMin); //new
myLimitMax = colMaximum(myLimitCol); show(myLimitMax); //new
mylcl = globalLCL["ColA];
myucl = globalUCL["ColA];
myGbDispObj = dt << Bivariate(
Size( 550, 400 ),
Y( "res" ),
X( "ColA" ),
Automatic Recalc( 1 ),
Histogram Borders( 1 ),
Summary Statistics( 1 ),
Fit Spline( 2, {Line Color( {212, 73, 88} )} ),
SendToReport(
Dispatch(
{},
"Bivar Plot",
FrameBox,
{Row Legend(
"Grouping",
Color( 1 ),
Color Theme( "JMP Default" ),
Marker( 1 ),
Marker Theme( "Solid" ),
Continuous Scale( 1 ),
Reverse Scale( 0 ),
Excluded Rows( 0 )
)}
),
Dispatch(
{},
"1",
ScaleBox,
{Add Ref Line({mylcl, myucl}, "Solid", "Light YellowGreen", "", 1, 0.20 )}
),
Dispatch( {}, "Summary Statistics", OutlineBox, {Close( 1 )} )
)
);
myTbLo = textBox(Char(round(myLimitMin, 2)) || " (OOC = " || char(0.00, 10, 2) || "%)");
myTbHi = textBox(Char(round(myLimitMax, 2)) || " (OOC = " || char(0.00, 10, 2) || "%)");
mySbDispObj = rangeSliderBox();
mySbDispObj = rangeSliderBox(
myLimitMin,
myLimitMax,
mylcl,
myucl,
//script
mySelectedLower = mySbDispObj << getLower;
mySelectedUpper = mySbDispObj << getUpper;
myGbDispObj << Dispatch( {}, "1", ScaleBox, {Add Ref Line( mySelectedLower, "Dashed", "blue", "LCL", 4 )} );
myGbDispObj << Dispatch( {}, "1", ScaleBox, {Add Ref Line( mySelectedUpper, "Dashed", "blue", "UCL", 4 )} );
rUpper = dt << Get Rows Where( myLimitCol[] > mySelectedUpper );
OOC_valUpper = (N Items(rUpper) / Col Number( Column(dt, "ColA") ))*100;
myTbHi << setText(Char(round(mySelectedUpper, 1)) || " (OOC = " || char(OOC_valUpper, 10, 2) || "%)");
rLower = dt << Get Rows Where( myLimitCol[] < mySelectedLower );
OOC_valLower = (N Items(rLower) / Col Number( Column(dt, "ColA") ))*100;
myTbLo << setText(Char(round(mySelectedLower, 1)) || " (OOC = " || char(OOC_valLower, 10, 2) || "%)");
);
mySbDispObj << Set Width( 275 );
myLayout = vListBox(
myGbDispObj,
hListBox(myTbLo, spacerBox(size(50,0)), myTbHi),
mySbDispObj
);
);@pmroz
I think the message you posted is not being displayed?
You might try creating a window first with an empty list box where you want the graphs to go, and then append your graphs to that list box using a for loop.
The graphs are working fine and appending into the new window. But I am not able to add a range slider box() object to each of the graphs created using the loop;.
Here's an example of it affecting some reference lines with a sliderbox for each list. It doesn't delete the previous reference line so you'd have to figure out how you want to do that if that's what you're going for.
Names default to here( 1 );
dt = open("$SAMPLE_DATA\Big Class.jmp");
summarize(dt, ages = By(:age)); // just some list
nw = new window("Some box");
for(i=1, i<=nitems(ages), i++,
olb = outlinebox("Age = " || char(ages[i]),
hlistbox(
rsb = rangesliderbox(colmin(:height), colmax(:height), colquantile(:height, .25), colquantile(:height, .75)),
gb = dt << Graph Builder(
Show Control Panel( 0 ),
Variables( X( :weight ), Y( :height ) ),
where(char(:age) == ages[i])
);
)
);
(gb<<PARENT></PARENT>OP, this can be relatively easily done, but I don't think many people will want to help you with this as you're asking too much and seem to be too inexperienced to really understand it all.
Some things to look into while you're filling out your experience level here is the following
- JSL doesn't really do much automatic scope control -- in particular, it doesn't remember scope states and hierarchies for functions and such -- if you're used to Python for example, then JSL will be quite frustrating and cause you great pains until you internalize this and start doing all of your own scope control
- For multiple interactive and mostly identical elements (like graphs with slider boxes, where only the graph X/Y / Grouping are changing), expressions will not serve you well. Use instead a function generator or something as you will need to distinguish the slider boxes and which object they link to. Of course this can be done with expressions, but in general it is the more complicated setup with only negligible speed gains in most circumstances
- Start small, with only one graph and one rangeSliderBox. Learn how to link them using explicit scoping
- You will need a separate data table for each plot as a table can only have one row state per row
- With this, if you create multiple sub-tables for each plot, it would be best to make them invisible to prevent the user being flooded with data tables. But keep in mind that data table are never implicitly deleted by JMP. You need to tie the closing of the window to the cleanup of the script -- close all relevant data tables and delete any namespaces used for scoping.
- Many people on the community pages here are willing to help but questions should be small and succinct.