Subscribe Bookmark RSS Feed

Control Chart Builder y axis scale - can I set dynamically using JSL?

jmpbeginner

Community Trekker

Joined:

Sep 11, 2013

New to Control Chart Builder, but I am liking it so far!  It appears that local data filters work with this platform (whereas control charts prior to CCB did not support them?).  Only issue I am having is that when a local data filter is used, the selection in the filter does not prompt a scale adjustment.  I notice the LCL/Avg/UCL are updated based on the local data filter selection, but the scale stays static.

First question, is there a way to force a scale recalc?  If not, I thought of the following option:

  • I can send scale changes via this jsl snippet when I generate the chart initially:

<!--

SendToReport(

Dispatch(

{},

"area",

ScaleBox,

{Min( 0 ), Max( 500 ), Inc( 50 ), Minor Ticks( 1 )}

)

)

-->

but what I really need is for the scale to be set based on the local data filter selection.

My thought is I could use the dynamically calculated LCL and UCL to adjust the Min and Max scale settings:

  • Is there a way to access the UCL and LCL values dynamically(with each recalc)?
  • If so, I could set them as variables and then use a formula to set the scale:

<!--

//define variables

LCLvar = reference to LCL value

UCLvar = reference to UCL value

//change scale based on those variables

SendToReport(

Dispatch(

{},

"area",

ScaleBox,

{Min( LCLvar - 50), Max( UCLvar + 50), Inc( UCLvar-LCLvar/50), Minor Ticks( 1 )}

)

)

-->


Is this the right approach? or is there an easier way to accomplish the desired result?  thanks

1 ACCEPTED SOLUTION

Accepted Solutions
Solution

I have worked my example a little further.  It now dynamically changes the axis when the data filter is changed.  The data filter is now a global filter, so the code can pick up the changes in the selection in the data table

 

Names Default To Here( 1 );

 

dt = Open( "$SAMPLE_DATA\semiconductor capability.jmp" );

 

f = Function( {a},

   

// Capture the LCL and UCL from the Limit Summaries Outline Box in the Report Output 

       myLCL = (Report( ccb )["NPN1 Limit Summaries"][Table Box( 1 )][2] << get)[1]; 

       myUCL = (Report( ccb )["NPN1 Limit Summaries"][Table Box( 1 )][4] << get)[1];

// Apply back to the Control Chart the new axis settings

       Report( ccb )[Axis Box( 3 )] << Min( myLCL );

       Report( ccb )[Axis Box( 3 )] << Max( myUCL );

);

   

rs = dt << make rowstate handler( f );

   

New Window( "Working Example",

       Data Filter Context Box(

              H List Box(

                     dt << Data Filter( Add Filter( Columns( :SITE ) ),Mode(select(1),show(1),include(1)) ),

                     Platform(dt,

                           ccb = Control Chart Builder(

                                  Size( 534, 453 ),

                                  Show Control Panel( 0 ), 

                                  Variables( Y( :NPN1 ) ), 

                                  Chart( Position( 1 ), Limits ), 

                                  Chart( Position( 2 ) ), 

                                  SendToReport( 

                                         Dispatch( 

                                                {}, 

                                                "NPN1", 

                                                ScaleBox,

                                                {Min( 96.6346153846154 ), Max( 131.634615384615 ), Inc( 5 ), Minor Ticks( 0 ),

                                                Add Ref Line( 104.412948990151, "Solid", "Blue", "LSL", 1 ), 

                                                Add Ref Line( 131.893493064355, "Solid", "Blue", "USL", 1 ), 

                                                Add Ref Line( 118.153221027253, "Solid", "Blue", "Target", 1 )}

                                           ) 

                                  )

                           )

                     )

              )

       )

);

 

Jim
3 REPLIES
txnelson

Super User

Joined:

Jun 22, 2012

The report output from the platforms is available to jsl.  The script below runs a control chart builder and then captures the UCL and the LCL from the output, and applies it to the axis setting of the report.

The Tree Structure of the report output can be seen by rt. mouse clicking on the Expand/Collapse (gray triangle) for the Outline Box of the report, and then selecting Edit==>Show Tree Structure.

 

Names default to here(1);

 

dt = open("$SAMPLE_DATA\semiconductor capability.jmp");

 

ccb=Control Chart Builder(

       Size( 534, 453 ),

       Show Control Panel( 0 ), 

       Variables( Y( :NPN1 ) ), 

       Chart( Position( 1 ), Limits ), 

       Chart( Position( 2 ) ),

       Local Data Filter( Add Filter( columns( :SITE ) ) ),

       SendToReport(

             Dispatch(

                     {},

                     "NPN1",

                     ScaleBox,

                     {Min( 96.6346153846154 ), Max( 131.634615384615 ), Inc( 5 ),

                     Minor Ticks( 0 ), Add Ref Line(

                           104.412948990151,

                           "Solid",

                           "Blue",

                           "LSL",

                           1

                     ), Add Ref Line( 131.893493064355, "Solid", "Blue", "USL", 1 ),

                     Add Ref Line( 118.153221027253, "Solid", "Blue", "Target", 1 )}

              )

       )

);

 

// Capture the LCL and UCL from the Limit Summaries Outline Box in the Report Output

myLCL = (report(ccb)["NPN1 Limit Summaries"][Table Box(1)][2]<<get)[1]; 

myUCL = (report(ccb)["NPN1 Limit Summaries"][Table Box(1)][4]<<get)[1];

 

// Apply back to the Control Chart the new axis settings 

report(ccb)[Axis Box(3)]<< min(myLCL); 

report(ccb)[Axis Box(3)]<< max(myUCL);

Jim
Solution

I have worked my example a little further.  It now dynamically changes the axis when the data filter is changed.  The data filter is now a global filter, so the code can pick up the changes in the selection in the data table

 

Names Default To Here( 1 );

 

dt = Open( "$SAMPLE_DATA\semiconductor capability.jmp" );

 

f = Function( {a},

   

// Capture the LCL and UCL from the Limit Summaries Outline Box in the Report Output 

       myLCL = (Report( ccb )["NPN1 Limit Summaries"][Table Box( 1 )][2] << get)[1]; 

       myUCL = (Report( ccb )["NPN1 Limit Summaries"][Table Box( 1 )][4] << get)[1];

// Apply back to the Control Chart the new axis settings

       Report( ccb )[Axis Box( 3 )] << Min( myLCL );

       Report( ccb )[Axis Box( 3 )] << Max( myUCL );

);

   

rs = dt << make rowstate handler( f );

   

New Window( "Working Example",

       Data Filter Context Box(

              H List Box(

                     dt << Data Filter( Add Filter( Columns( :SITE ) ),Mode(select(1),show(1),include(1)) ),

                     Platform(dt,

                           ccb = Control Chart Builder(

                                  Size( 534, 453 ),

                                  Show Control Panel( 0 ), 

                                  Variables( Y( :NPN1 ) ), 

                                  Chart( Position( 1 ), Limits ), 

                                  Chart( Position( 2 ) ), 

                                  SendToReport( 

                                         Dispatch( 

                                                {}, 

                                                "NPN1", 

                                                ScaleBox,

                                                {Min( 96.6346153846154 ), Max( 131.634615384615 ), Inc( 5 ), Minor Ticks( 0 ),

                                                Add Ref Line( 104.412948990151, "Solid", "Blue", "LSL", 1 ), 

                                                Add Ref Line( 131.893493064355, "Solid", "Blue", "USL", 1 ), 

                                                Add Ref Line( 118.153221027253, "Solid", "Blue", "Target", 1 )}

                                           ) 

                                  )

                           )

                     )

              )

       )

);

 

Jim
jmpbeginner

Community Trekker

Joined:

Sep 11, 2013

Thanks Jim!  got the above portion to work!!