Subscribe Bookmark RSS Feed

Script data to color code where it is from specification limitt

alexhemmert1

Community Member

Joined:

Mar 17, 2016

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
Solution

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
1 REPLY
Solution

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