cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Sign-in to the JMP Community will be unavailable intermittently Dec. 6-7 due to a system update. Thank you for your understanding!
  • We’re retiring the File Exchange at the end of this year. The JMP Marketplace is now your destination for add-ins and extensions.
  • JMP 19 is here! Learn more about the new features.

Discussions

Solve problems, and share tips and tricks with other JMP users.
Choose Language Hide Translation Bar
jearls11
Level III

Color by cell

for each row(

Hi folks, 

I want to colour my cells by value,

so if the row is <=  25 red, if > 25 and < 50 orange , if> 50 < 70 yellow.

and >75 green.

i am breaking it down to test first and when i run the first 2 arguments, the second condition changes all the rows to orange

For Each Row(
	If(
		:CDO 4 week Avg <= 25, dt:CDO 4 week Avg << color cells( "Red", Row() ),
		:CDO 4 week Avg > 25 <= 50,
			dt:CDO 4 week Avg << color cells( "orange", Row() )
	)
);

 

I cant understand why I am overwriting the condition and changing all cells colors to orange

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
jthi
Super User

Re: Color by cell

Second comparison seems wrong.

Try changing:

:CDO 4 week Avg > 25 <=50,

to

25 < :CDO 4 week Avg <=50,
-Jarmo

View solution in original post

3 REPLIES 3
jthi
Super User

Re: Color by cell

Second comparison seems wrong.

Try changing:

:CDO 4 week Avg > 25 <=50,

to

25 < :CDO 4 week Avg <=50,
-Jarmo
jearls11
Level III

Re: Color by cell

And is it possible to loop this for each column or do i have to make a for loop for each of the columns?

 

 

txnelson
Super User

Re: Color by cell

Here is a simple example of coloring cells across multiple columns, without having to process the cells row by row.  

txnelson_0-1633533845201.png

Names Default To Here( 1 );
// Open Data Table: Blood Pressure.jmp
// → Data Table( "Blood Pressure" )
dt = Open( "$SAMPLE_DATA/Blood Pressure.jmp" );

For( i = 3, i <= N Cols( dt ), i++,
	theRows = dt << get rows where( As Column( dt, i ) > 180 );
	Column( dt, i ) << color cells( "red", theRows );
);

 

Jim

Recommended Articles