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
lwx228
Level VIII

How to use JSL to automatically select the specified color gradient form?

For example, the height column of "Big Class. JMP ", select the color gradient specified by ②.

 

Thanks!

 

2020-07-15_17-53.png

1 ACCEPTED SOLUTION

Accepted Solutions

Re: How to use JSL to automatically select the specified color gradient form?

OK, now I see what you want. It takes two steps: (1) specify color gradient and (2) color the cells. This example code illustrates the two steps and the syntax:

 

Names Default to Here( 1 );

// example data set
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );

// add color gradient as a column property
:height
	<< Set Property( "Color Gradient", {"Green Yellow Red", Range( {51, 70, 62.55} )} )
	<< Color Cell by Value;

View solution in original post

8 REPLIES 8

Re: How to use JSL to automatically select the specified color gradient form?

lwx228
Level VIII

Re: How to use JSL to automatically select the specified color gradient form?

Thank !

 

2020-07-15_19-53.png

lwx228
Level VIII

Re: How to use JSL to automatically select the specified color gradient form?

Thank markbailey!


I have tried several methods, but still have no solution.

 

dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
dt:height<<Set Property( "Value Colors", {"Female" = 3, "Male" = 5} );Wait(0);
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
dt:height<<Set Property( "Value Colors", Color Theme( "White to Blue" ) );Wait(0);

Re: How to use JSL to automatically select the specified color gradient form?

That failure is because you are using the wrong property. The documentation that I cited clearly distinguished between associating colors and gradients:

 

Specify the gradient and the range and midpoint for Value Gradient:

 

col << Set Property( "Color Gradient", { "White to Blue", Range( { 18, 60, 25 } ) } );
lwx228
Level VIII

Re: How to use JSL to automatically select the specified color gradient form?

Thank markbailey!


I still don't understand. That's all I can write.But the table doesn't change at all.

 

2020-07-19_20-55.png

lwx228
Level VIII

Re: How to use JSL to automatically select the specified color gradient form?

I want to use JSL to directly achieve the effect of height column loading color gradient.

Re: How to use JSL to automatically select the specified color gradient form?

The only change in the data table will be observed in the Columns panel after you add a column property. That change is indicated by the asterisk after the column name height in the panel. The data column and data table do not display a color gradient. The Graph Builder uses the color gradient. This script illustrates the effect.

 

Names Default to Here( 1 );

// sample data
dt = Open( "$SAMPLE_DATA/Fitness.jmp" );

// sample plot using defaut color role
gb = dt << Graph Builder(
	Size( 531, 454 ),
	Show Control Panel( 0 ),
	Variables( X( :Runtime ), Y( :Oxy ), Color( :Weight ) ),
	Elements( Points( X, Y, Legend( 9 ) ), Smoother( X, Y, Legend( 10 ) ) )
);

// look at default result
Wait( 2 );

// change color gradient
:Weight << Set Property( "Color Gradient", {"White to Blue", Range( {18, 60, 25} )} );

// observe new gradient in Graph Builder

Re: How to use JSL to automatically select the specified color gradient form?

OK, now I see what you want. It takes two steps: (1) specify color gradient and (2) color the cells. This example code illustrates the two steps and the syntax:

 

Names Default to Here( 1 );

// example data set
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );

// add color gradient as a column property
:height
	<< Set Property( "Color Gradient", {"Green Yellow Red", Range( {51, 70, 62.55} )} )
	<< Color Cell by Value;