cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Check out the JMP® Marketplace featured Capability Explorer add-in
Choose Language Hide Translation Bar
alexhemmert1
Level II

Script data to color code where it is from specification limitt

Hey All,

I'm wanting to color code data based on where it is from the specification limit. Ideally, I would want data that is in spec to be colored green, below spec by ,<10% to be yellow, ≥10% to be red and above the spec to be blue. Does anyone have a script to complete this?

1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: Script data to color code where it is from specification limitt

Here is a script that does what you want....assuming that what you want is for the colors to be displayed on chart.  If you want the colors to be displayed in the data table, and what you are requesting is that the Cell Colors to be colored based upon your specification, then that would be a little different.

Names Default To Here( 1 );

// Open the Semiconductor Capability sample data table since it

// contains spec limits

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

// Create a new column to setup the groupings in

dt << New Column( "Color Groupings",

      Modeling Type( Nominal ),

      formula(

            USL = (dt:PNP3 << get property( "Spec Limits" ))["USL"];

            LSL = (dt:PNP3 << get property( "Spec Limits" ))["LSL"];

            If(

                  LSL <= dt:PNP3 <= USL, 1,

                  (LSL - .1 * (USL - LSL)) <= dt:PNP3 < LSL, 2,

                  (LSL - .2 * (USL - LSL)) <= dt:PNP3 < (LSL - .1 * (USL - LSL)), 3,

                  dt:PNP3 > USL, 4

            );

      )

);

// Add the color options

dt:Color Groupings << set property( "Value Colors", {1 = "Green", 2 = "Yellow", 3 = "Red", 4 = "Blue"} );

// Copy the value colors to the rowstates, so the platforms will

// use the colors

dt << Color by Column( Color Groupings );

// Get rid of the new column since it's use is no longer needed

dt << delete columns( "Color Groupings" );

// Show a chart using the new color options

dt << Control Chart Builder(

      Size( 534, 453 ),

      Show Control Panel( 0 ),

      Variables( Y( :PNP3 ) ),

      Chart( Position( 1 ), Limits ),

      Chart( Position( 2 ) ),

      SendToReport(

            Dispatch(

                  {},

                  "PNP3",

                  ScaleBox,

                  {Add Ref Line( 118.677820430348, "Solid", "Blue", "LSL", 1 ), Add Ref Line(

                        141.901766142544,

                        "Solid",

                        "Blue",

                        "USL",

                        1

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

            )

      )

);

Jim

View solution in original post

4 REPLIES 4
txnelson
Super User

Re: Script data to color code where it is from specification limitt

Here is a script that does what you want....assuming that what you want is for the colors to be displayed on chart.  If you want the colors to be displayed in the data table, and what you are requesting is that the Cell Colors to be colored based upon your specification, then that would be a little different.

Names Default To Here( 1 );

// Open the Semiconductor Capability sample data table since it

// contains spec limits

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

// Create a new column to setup the groupings in

dt << New Column( "Color Groupings",

      Modeling Type( Nominal ),

      formula(

            USL = (dt:PNP3 << get property( "Spec Limits" ))["USL"];

            LSL = (dt:PNP3 << get property( "Spec Limits" ))["LSL"];

            If(

                  LSL <= dt:PNP3 <= USL, 1,

                  (LSL - .1 * (USL - LSL)) <= dt:PNP3 < LSL, 2,

                  (LSL - .2 * (USL - LSL)) <= dt:PNP3 < (LSL - .1 * (USL - LSL)), 3,

                  dt:PNP3 > USL, 4

            );

      )

);

// Add the color options

dt:Color Groupings << set property( "Value Colors", {1 = "Green", 2 = "Yellow", 3 = "Red", 4 = "Blue"} );

// Copy the value colors to the rowstates, so the platforms will

// use the colors

dt << Color by Column( Color Groupings );

// Get rid of the new column since it's use is no longer needed

dt << delete columns( "Color Groupings" );

// Show a chart using the new color options

dt << Control Chart Builder(

      Size( 534, 453 ),

      Show Control Panel( 0 ),

      Variables( Y( :PNP3 ) ),

      Chart( Position( 1 ), Limits ),

      Chart( Position( 2 ) ),

      SendToReport(

            Dispatch(

                  {},

                  "PNP3",

                  ScaleBox,

                  {Add Ref Line( 118.677820430348, "Solid", "Blue", "LSL", 1 ), Add Ref Line(

                        141.901766142544,

                        "Solid",

                        "Blue",

                        "USL",

                        1

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

            )

      )

);

Jim
RBILLC
Level II

Re: Script data to color code where it is from specification limitt

Excellent. Is it possible to have different row states (specifically marker color) by column? Or would I have to split the datatable? Thank you.

Stefan
Level III

Re: Script data to color code where it is from specification limitt

I'd be interested in this as well, I am trying to create a dashboard with 7-8 variables of different spec limits, and would like to colour them according to their individual spec limits. Thank you

hogi
Level XII

Re: Script data to color code where it is from specification limitt

With is out of spec(value), this task will get super easy

- you can vote for it together with:🙏 is in spec (value)