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.

Mass CustomizationRe: How to use JSL to color local cells by value?Use this stupid method to select the color number I want.

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"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

Re: How to use JSL to color local cells by value?Thank 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
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() );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.

Re: How to use JSL to color local cells by value?Did you read the entry that I posted in my previous reply about how to retrieve Cell Colors? It has a function that can provide you with how to access the cell colors. If the colors have been set by the use of "Color or Mark by Column" then the only way I know to get the colors, is to create a rowstate column, copy the current rowstates to the new column, and then use the Color Of( Row State( row#)) to retrieve the color value.
Re: How to use JSL to color local cells by value?Thank Jim!
I still haven't learned to write "Functions".
I want to get a color number like this:

Re: How to use JSL to color local cells by value?You can easily create a similar pattern in JSL. But in JSL you create Functions.

Re: How to use JSL to color local cells by value?Re: How to use JSL to color local cells by value?Thank Jim!
You have given me a lot of help and have made rapid progress.
I used to use VBA, and I was able to record most of the code for each step.
Now using JSL, also want to achieve fully automatic operation.Re: How to use JSL to color local cells by value?A few years ago I asked the same question,
Here it is:
You basically have to extract it from the extracted script for the column you are interested in
Re: How to use JSL to color local cells by value?But to do it manually in order to show this?
In addition, could use JSL to automatically get the color number of each row cell in the column of "height"?

Re: How to use JSL to color local cells by value?Thank pmroz!
I did it.
Re: How to use JSL to color local cells by value?What OS and JMP version(s) are you using? I'm using JMP 14 on Windows 10, 64-bit.
Try these steps:
- Open Big Class
- Right click on height > Column Properties > Color Gradient

- Check "Color Cell by Value", then OK

- You should end up with this:

If this still doesn't work you'll need to contact the JMP helpdesk.
Re: How to use JSL to color local cells by value?Re: How to use JSL to color local cells by value?Thank pmroz!
Strange, I still don't see 1-10 lines of color here.Lines 11 to 40 are white.

Re: How to use JSL to color local cells by value?Here's how to only show the color gradient for rows 1-10. Note that the min, max and mean are calculated on the entire column. You can adjust that.
dt = open("$sample_data\Big Class.jmp");
bmin = col min(dt:height);
bmax = col max(dt:height);
bavg = col mean(dt:height);
dt:height << set property("Color Gradient", {"Light Spectral", Range( {bmin, bmax, bavg} )});
dt:height << Color Cell by Value(1);
reset_rows = 11::40;
dt:height << color cells ("White", reset_rows);

Re: How to use JSL to color local cells by value?You should see this:

Re: How to use JSL to color local cells by value?Thank pmroz!
Is your code complete?I didn't see any results when I ran it, and I didn't know how to perfect the code.Thanks for your help!Re: How to use JSL to color local cells by value?You can also try color gradient.
dt = open("$sample_data\Big Class.jmp");
bmin = col min(dt:height);
bmax = col max(dt:height);
bavg = col mean(dt:height);
dt:height << set property("Color Gradient", {"Light Spectral", Range( {bmin, bmax, bavg} )});
dt:height << Color Cell by Value(1);
This will color the entire column. You can use color cells for rows 11 to the end to remove the color.
Re: How to use JSL to color local cells by value?Look in the Scripting Guide.......not just the Scripting IndexRe: How to use JSL to color local cells by value?Thank Jim!
I searched the index and saw only this.
Where I can see a more complete color code?

Re: How to use JSL to color local cells by value?
Here is a script that will color the column weight's first 10 rows in the data table.
names default to here(1);
dt=Open("$SAMPLE_DATA/big class.jmp");
// Set the gradient list of colors
colorList = {-2768895, -5530606, -6582759, -8094941, -9147350, -10462158, -11514567, -12237762,
-13344414, -14575206};
// Color first 10 rows
// find the range
weightMin= col min(if(Row()<=10,:weight,.));
weightMax= col max(if(Row()<=10,:weight,.));
weightInc= (weightMax-weightmin)/10;
// Loop across and set the colors
For(i=1,i<=10,i++,
Bin=floor((:weight[i]-weightMin)/weightInc)+1;
if(Bin>10,Bin=10);
:weight << color cells( colorList[bin],i)
);
To understand all of the concepts behind the colors in JMP, you need to read the documentation in the Scripting Guide on Specifying Colors
Re: How to use JSL to color local cells by value?"Color scales" were not found on the script index.