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
kayne
Level II

Coloring selective cells

Hi there, how do I color the cells red for values that are lower than the limits? Thanks.

dt = New Table( "Marks",

    Add Rows( 2 ),

    New Column( "Name", Character, Nominal, Set Values( {"Peter", "Leslie"} ) ),

    New Column( "Limits",

        Numeric,

        Continuous,

        Format( "Best", 12 ),

        Set Values( [20, 30] )

    ),

    New Column( "Column 1",

        Numeric,

        Continuous,

        Format( "Best", 12 ),

        Set Values( [10, 15] )

    ),

    New Column( "Column 2",

        Numeric,

        Continuous,

        Format( "Best", 12 ),

        Set Values( [30, 40] )

    ),

    New Column( "Column 3",

        Numeric,

        Continuous,

        Format( "Best", 12 ),

        Set Values( [20, 55] )

    ),

    New Column( "Column 4",

        Numeric,

        Continuous,

        Format( "Best", 12 ),

        Set Values( [53, 24] )

    ),

    Set Row States( [0, 1] )

)

fail = dt << Get Rows Where( :Column 1 < :Limits );

:Column 1 << color cells(Red, fail);

10 REPLIES 10
pmroz
Super User

Re: Coloring selective cells

You have to color by column.  This code will do the trick.  The color "73" is a bit lighter than "Yellow"

for (i = 1, i <= ncols(dinout), i++,
	column(dinout, i) << Color Cells( {73, {40}} );
);