cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
JMP is taking Discovery online, April 16 and 18. Register today and join us for interactive sessions featuring popular presentation topics, networking, and discussions with the experts.
Choose Language Hide Translation Bar
ahchin5
Level I

JSL scripting question: How to put charts together into one same output

Hi all,

I am new to JSL scripting.

I have few column data to be chosen by user for analysis.

The code I written will generate several graphs equal to columns chosen.

May I know how to combine all the graphs into one output?

Can anybody help to provide me the code/syntax?

Code (I discarded those variable passing routines):

For(i=1,i<=tot_entry,i++,

MyDist=Distribution(

  Continuous Distribution(

  Column (eval(analyzelist)),Stack(1), Horizontal Layout(1), Normal Quantile Plot(1) , Stem and Leaf(1),

  Capability Analysis( LSL(eval(lsl)), USL(eval(usl)), Target(eval(target)))),

  SendToReport(

  Dispatch( {}, "Distributions", OutlineBox, {Set Title( "Distribution of " || title )} ),

  )

  );

);

1 ACCEPTED SOLUTION

Accepted Solutions
gzm
gzm
Level III

Re: JSL scripting question: How to put charts together into one same output

As PMRoz mentioned these nice scripts will not work in JMP9.  Below is a slight modification that will work in JMP9 and 10.  Note the panel box is not needed.  I just added it as demonstration.

The approach I like to take is to build the general structure or layout of my display window or dialogue then drop in the analyses, graphs and tables.

By wrapping a display box (an HListBox) around the distribution, it is still active.  Howver, once you assign it in one window any subsequent paste or append is a cloned or inactive display (like a journaled report).

So the 3 steps, my colleagues and I teach to new JSL users are :

     1) Create the layout,  a template for your general display, creating a handle for each placeholder in the window

     2) For each analysis or analysis group , create your display "hidden" within a displaybox (HListBox or VListBox or OutLineBox or PanelBox. etc.) , then 

     3) Append this display to the placeholder in the window created in step 1.

We call this building a display "bottom up."  This approach makes it much easier to manage special cases, like different spec limits for each variable LSL and USL, etc. and debug problems step by step.

//=================Good scripting!.

nw = New Window( "Capability Charts", lub );Open( "$SAMPLE_DATA/Big Class.jmp" );


analyzelist = {"height", "weight"};

tot_entry = N Items( analyzelist );

lsl = 80;

usl = 90;

target = 70;

title = "MY TITLE";

nw = New Window( "Capability Charts",
  pb = panel box("Capability",
    lub = Lineup Box( N Col( 1 ) )
  ));


For( i = 1, i <= tot_entry, i++,

  hlb = HlistBox( Distribution(

Continuous Distribution(

Column( Eval( analyzelist ) ),

Stack( 1 ), Horizontal Layout( 1 ), Normal Quantile Plot( 1), Stem and Leaf( 1 ),

Capability Analysis( LSL( Eval( lsl ) ), USL( Eval( usl ) ),
Target( Eval( target ) ) ) ),

SendToReport( Dispatch( {}, "Distributions",
OutlineBox, {Set Title( "Distribution of " || analyzelist )} ))

));
lub << append(hlb)

);

View solution in original post

4 REPLIES 4

Re: JSL scripting question: How to put charts together into one same output

Hi - rather than just creating an object called MyDist, you could append the Distribution to an initially empty Line Up Box, and then display that Line Up Box in a window.  The following shows the sort of thing, though obviously the actual numbers I've used here won't make sense in the context of your capability analysis.  Please note that I'm running this in JMP 10, as I think it won't work in JMP 9:

Open( "$SAMPLE_DATA/Big Class.jmp" );

analyzelist = {"height", "weight"};

tot_entry = N Items( analyzelist );

lsl = 80;

usl = 90;

target = 70;

title = "MY TITLE";

lub = Lineup Box( N Col( 1 ) );

For( i = 1, i <= tot_entry, i++,

lub << append( Distribution(

Continuous Distribution(

Column( Eval( analyzelist ) ),

Stack( 1 ), Horizontal Layout( 1 ), Normal Quantile Plot( 1), Stem and Leaf( 1 ),

Capability Analysis( LSL( Eval( lsl ) ), USL( Eval( usl ) ),
Target( Eval( target ) ) ) ),

SendToReport( Dispatch( {}, "Distributions",
OutlineBox, {Set Title( "Distribution of " || title )} ))

)));

nw = New Window( "Capability Charts", lub );


/*

I'm sorry I can't format this any better, but I seem to be unable to paste script directly into this window.  You can reformat it from the Edit menu once it's inside a script window, however.  Here's another example of the same sort of thing in which I've created a grid of outputs from the Graph Builder:

*/

dt = Open( "$SAMPLE_DATA/Car Physical Data.jmp" );

colnames = dt << get column names( numeric );

show(colnames);

lub = line up box(ncol(3));

for(i=1, i<=nItems(colnames), i++,

lub << append(Graph Builder(

Size(300, 200 ), Show Control Panel( 0 ), Show Legend( 0 ),

Variables( X( :Country ), Y( eval(char(colnames)) ) ),

Elements( Box Plot( X, Y, Legend( 0 ), Jitter( 1 ), Outliers( 1 ), Box Style( "Outlier" )))

))

);

nw = new window("Box Plots", lub);

pmroz
Super User

Re: JSL scripting question: How to put charts together into one same output

To paste a script with all of the formatting and colors intact, first copy it from JMP to MS-Word, then from Word to this forum.  I replace TAB characters with four spaces to get things to indent the proper amount.  For example:

dt = Open( "$SAMPLE_DATA/Car Physical Data.jmp" );

colnames = dt << get column names( numeric );

Show( colnames );

lub = Lineup Box( N Col( 3 ) );

For( i = 1, i <= N Items( colnames ), i++,

    lub << append(

        Graph Builder(

            Size( 300, 200 ),

            Show Control Panel( 0 ),

            Show Legend( 0 ),

            Variables( X( :Country ), Y( Eval( Char( colnames[i] ) ) ) ),

            Elements(

                Box Plot(

                    X,

                    Y,

                    Legend( 0 ),

                    Jitter( 1 ),

                    Outliers( 1 ),

                    Box Style( "Outlier" )

                )

            )

        )

    )

);

Re: JSL scripting question: How to put charts together into one same output

Hi - I tried that, and it doesn't seem to work for me for some reason.  I'm getting blank lines - possibly caused by invisible control characters - between every line of script, plus assorted cases of quite short lines being split into two, as if it thinks the line width is about 20 or 30 characters.  I'll keep experimenting though - and thanks for the tip: it suggests that I'm not attempting to do something impossible!

gzm
gzm
Level III

Re: JSL scripting question: How to put charts together into one same output

As PMRoz mentioned these nice scripts will not work in JMP9.  Below is a slight modification that will work in JMP9 and 10.  Note the panel box is not needed.  I just added it as demonstration.

The approach I like to take is to build the general structure or layout of my display window or dialogue then drop in the analyses, graphs and tables.

By wrapping a display box (an HListBox) around the distribution, it is still active.  Howver, once you assign it in one window any subsequent paste or append is a cloned or inactive display (like a journaled report).

So the 3 steps, my colleagues and I teach to new JSL users are :

     1) Create the layout,  a template for your general display, creating a handle for each placeholder in the window

     2) For each analysis or analysis group , create your display "hidden" within a displaybox (HListBox or VListBox or OutLineBox or PanelBox. etc.) , then 

     3) Append this display to the placeholder in the window created in step 1.

We call this building a display "bottom up."  This approach makes it much easier to manage special cases, like different spec limits for each variable LSL and USL, etc. and debug problems step by step.

//=================Good scripting!.

nw = New Window( "Capability Charts", lub );Open( "$SAMPLE_DATA/Big Class.jmp" );


analyzelist = {"height", "weight"};

tot_entry = N Items( analyzelist );

lsl = 80;

usl = 90;

target = 70;

title = "MY TITLE";

nw = New Window( "Capability Charts",
  pb = panel box("Capability",
    lub = Lineup Box( N Col( 1 ) )
  ));


For( i = 1, i <= tot_entry, i++,

  hlb = HlistBox( Distribution(

Continuous Distribution(

Column( Eval( analyzelist ) ),

Stack( 1 ), Horizontal Layout( 1 ), Normal Quantile Plot( 1), Stem and Leaf( 1 ),

Capability Analysis( LSL( Eval( lsl ) ), USL( Eval( usl ) ),
Target( Eval( target ) ) ) ),

SendToReport( Dispatch( {}, "Distributions",
OutlineBox, {Set Title( "Distribution of " || analyzelist )} ))

));
lub << append(hlb)

);