Subscribe Bookmark RSS Feed

Number Col Box << set conditional format

I see in JMP 9 there's a "conditional format" property of a Number Col Box, however I can't find any documentation on it.  Does anyone have any examples of its use, please?  In particular, I'd like to know if I can embolden, underline and/or change the text color of the contents of cells that fulfil the condition.

Many thanks

4 REPLIES
pmroz

Super User

Joined:

Jun 23, 2011

The help in JMP 10 provides a few more clues:

Set Conditional Format

obj << Set Conditional Format(

Correlation|Pvalue|Factor Pattern )

Sets the conditional format

Example program:

Names Default To Here( 1 );

Open( "$SAMPLE_DATA/Time Series/Oil.jmp" );

ts = Time Series( X( :Depth ), Y( :Response ) );

tsr = ts << report;

ncb = tsr[Number Col Box( 5 )];

ncb << Set Conditional Format( "PValue" );

Excellent - many thanks!  So... it is possible to change the font color on an individual cell basis within a Number Col Box: using the above example as a starting point, I've been playing around with the PValue and Correlation parameters to find out a bit more about them, and produced the following, which shows the color schemes that are used to highlight the significance of a list of P values (red for P<0.05, orange for P<0.01), and a list of correlations from +1 through 0 to -1 on a blue-gray-red scale:

PValueTable = Table Box();

CorrelTable = Table Box();

For( k = 1, k <= 15, k++,

       PValueList = {};

       CorrelList = {};

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

              Insert Into( PValueList, Random Uniform() / 5 );

              Insert Into( CorrelList, 1 - 2 * ((k - 8) ^ 2 + (i - 8) ^ 2) / 98 );

       );

       PValueTable << append(

              Number Col Box( "Col " || Char( k ),

                     PValueList,

                     set format( 6, 3 ),

                     set width( 12 ),

                     <<Set Conditional Format( "PValue" )

              )

       );

       CorrelTable << append(

              Number Col Box( "Col " || Char( k ),

                     CorrelList,

                     set format( 6, 3 ),

                     set width( 12 ),

                     <<Set Conditional Format( "Correlation" )

              )

       );

);

PValueTable << table style( "Embossed" );

CorrelTable << table style( "Embossed" );

nw = New Window( "My Window",

       Lineup Box( N Col( 2 ),

              Text Box( "Lots of P Values:  " ),

              PValueTable,

              Text Box( "Lots of Correlations:  " ),

              CorrelTable

       )

);

I'm now wondering if (a) the color scheme can be changed, and also (b) whether it's possible to define your own set of rules.  Does anyone know?

danschikore

Staff

Joined:

Sep 21, 2012

In Preferences, under Reports, there is a place to bring up the rule editor.  You can view / modify the existing rules, and also create your own rules.

You can also create a new rule from the Column Numeric Format dialog, shown when you double-click on a numeric column.  You have the option to select a Conditional Highlight scheme or "Add New..."

pmroz

Super User

Joined:

Jun 23, 2011

Played around with this a bit.  Here's how to set up a new rule using JSL.  This rule will show values greater than 0 in bold red, and values <= 0 in slightly dimmer text.

preferences(

    Conditional Formatting Rules(

        RuleSet(

            RuleName( "Alert Rule" ),

// Less than or equal to 0, dim the text 80%

            LessThan( Value( 0 ), Inclusive( 0 ), Format( TextAlpha( 0.8 ) ) ),

// Greater than 0, bold red

            GreaterThan(

                Value( 0 ),

                Inclusive( 0 ),

                Format( Text Color( "Dark Red" ), FontStyle( Bold ) )

            )

        )

    )

);

This code only needs to be run once for a user, btw.

Next, to assign this format to a number col box:

one_colbox << Set Conditional Format("Alert Rule");