cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Submit your abstract to the call for content for Discovery Summit Americas by April 23. Selected abstracts will be presented at Discovery Summit, Oct. 21- 24.
Discovery is online this week, April 16 and 18. Join us for these exciting interactive sessions.
Choose Language Hide Translation Bar
lwx228
Level VIII

How to use JSL to color local cells by value?

For example, in the "weight" column of "Big class.jMP ", take the data in rows 1-10 and make the gradient color by data height, as in the Image.So can start and stop any color  want.

 

2020-07-05_21-55.png

26 REPLIES 26
lwx228
Level VIII

Re: How to use JSL to color local cells by value?

Thank Jim!

 

I have the code to try out that post.But I'm still not going to get there.

 

2020-07-10_18-49.png

txnelson
Super User

Re: How to use JSL to color local cells by value?

Here is a formula that works if the cells have been colored using Color Cells().  But cell coloring that has been set by Value Colors, or Color and Mark by Column()..  So it is not a very adequate formula 


// Define formula to retrieve cell colors
If( Row() == 1,
	get_cell_color = Function( {col, r},
		s = col << get script;
  
     //Locate argument "Color Cells" in column script
		For( i = 1, i <= N Arg( s ), i++,
			If( Head Name( Arg( s, i ) ) == "Color Cells",
				p = i;
				Break();
			);
		);

     //Identify the sublist that contains the color of row r
		if( p==i,
		L = Arg( Arg( s, p ), 1 );
		For( i = 1, N Items( L ), i++,
			If( N Row( Loc( L[i][2], r ) ) == 1,
				color = L[i][1];
				Break();
			)
		);
		color,
		color=.
		)
	)
);

cellcolor = get_cell_color( Column( :Height ), Row() );
Jim

Re: How to use JSL to color local cells by value?

Great function, Jim! Thanks for sharing.

 

This is a good place to promote your JMP Wish List idea: << get cell color 

to have this built into JMP, so that anyone stumbling onto this discussion could vote it up. 

 

Thanks,

~John

lwx228
Level VIII

Re: How to use JSL to color local cells by value?

Thank Jim!

 

  • I still don't know how to use this formula. Not running correctly.2020-07-11_07-47.png

txnelson
Super User

Re: How to use JSL to color local cells by value?

Attached is a data table with the formula column added, retrieving the cell colors from the Height column.  The colors were set by right clicking on each cell and selecting Cell Color.  The formula will can not retrieve the colors set with Color or Mark by Column, Value Colors or Gradient Color

ColorNumber.PNG

Jim
lwx228
Level VIII

Re: How to use JSL to color local cells by value?

Thank Jim!

It's hard to get a color number like this directly from the color of the cell:
"-2768895, -5530606, -6582759, -8094941, -9147350, -10462158, -11514567, -12237762,
-13344414, -14575206"
lwx228
Level VIII

Re: How to use JSL to color local cells by value?

Use this stupid method to select the color number I want.

 

2020-07-12_18-27.png