cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Try the Materials Informatics Toolkit, which is designed to easily handle SMILES data. This and other helpful add-ins are available in the JMP® Marketplace
Choose Language Hide Translation Bar
KarenC
Super User (Alumni)

Is there a way to send a font color to a single value in a display? So if X > 10 color X purple (given I know how to determine if X > 10)

Is there a way to send a font color to a single value in a display?  So if X > 10 color X purple (given I know how to determine if X > 10)

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Is there a way to send a font color to a single value in a display? So if X > 10 color X purple (given I know how to determine if X > 10)

There are conditional highlighting rules for numbers displayed in a NumberColBox.  Double-click on the box and you can select a rule or create a new rule.  A rule consists of:

1) a name for the rule (e.g. "GT10Purple")

2) conditions on the values (e.g. " > 10 ")

3) format changes (text color, background color, annotation, font)

You can also edit the available rules through Preferences > Reports > Show conditional formatting.

Here is a picture of the dialog while creating a rule like you describe:

7026_ConditionalDialog.png

And this is what it looks like when applied to a column in a report:

7027_Conditional.png

Conditional formats can also be used for a MatrixBox, and can be set from JSL using the <<Set Conditional Format("name") method.

View solution in original post

4 REPLIES 4

Re: Is there a way to send a font color to a single value in a display? So if X > 10 color X purple (given I know how to determine if X > 10)

There are conditional highlighting rules for numbers displayed in a NumberColBox.  Double-click on the box and you can select a rule or create a new rule.  A rule consists of:

1) a name for the rule (e.g. "GT10Purple")

2) conditions on the values (e.g. " > 10 ")

3) format changes (text color, background color, annotation, font)

You can also edit the available rules through Preferences > Reports > Show conditional formatting.

Here is a picture of the dialog while creating a rule like you describe:

7026_ConditionalDialog.png

And this is what it looks like when applied to a column in a report:

7027_Conditional.png

Conditional formats can also be used for a MatrixBox, and can be set from JSL using the <<Set Conditional Format("name") method.

pmroz
Super User

Re: Is there a way to send a font color to a single value in a display? So if X > 10 color X purple (given I know how to determine if X > 10)

Here's how to create a conditional formatting rule via JSL.  The rule displays numbers greater than 0 in red with a yellow background.

preferences(

    Conditional Formatting Rules(

        RuleSet(

            RuleName( "Check Rule" ),

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

            GreaterThan(

Value( 0 ),

Inclusive( 0 ),

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

            )

        )

    )

);

abc_list = {1.23, 0, -1, 2.844};

def_list = {35.223, 0, 1, 2};

nw = new window("Example Conditional Formatting",

    panelbox("Interesting Data",

        tb = tablebox(

            s1      = stringcolbox("Some Text", {"AAA", "BBB", "CCC", "DDD"}),

            abc_col = numbercolbox("ABC", abc_list),

            def_col = numbercolbox("DEF", def_list),

        ),

    ),

abc_col << set format(4,0) << Set Conditional Format("Check Rule");

def_col << set format(4,0) << Set Conditional Format("Check Rule");

tb << Set Shade Alternate Rows( 1 )<< Set Underline Headings( 1 ) << set column borders(1);

);

Here's the output:

7031_CondFmtExample.png

KarenC
Super User (Alumni)

Re: Is there a way to send a font color to a single value in a display? So if X > 10 color X purple (given I know how to determine if X > 10)

Both, the conditional formatting is great. But for fun, let's go one step further...what if we want to color Y purple based on X being some value?? The thought was to flag a value as suspect if some assumption (say normality) was suspect.  So if the p-value from some test was bigger or smaller than some value I might want to apply conditional formatting to some other set of vales (such as Cpks). 

Re: Is there a way to send a font color to a single value in a display? So if X > 10 color X purple (given I know how to determine if X > 10)

Karen, this would be a nice capability, but it would require more of a scripting approach rather than the conditional formatting.

The scripting of course will depend on the level at which the font properties are exposed to JSL.  If the value you want to modify is in a Text Box, there is the <<Font Color message.  But if the value is one item within a Number Col Box, there is no way to directly set the color for a single cell.

With some creative scripting you might be able to generate a custom conditional format for each column that colors the rows correctly.  Provided that you don't have two numbers that are exactly the same value but need to display in different colors.