Plotting gradient colors in JSL, how to use variables to represent specific parameters?For example, the maximum and minimum values of this:
{gradient({Scale Values([200000 0 -200000])})}mx=200000
mn=-200000
{gradient({Scale Values([ma 0 -ma])})}</CODE></P><P><CODE class=" language-jsl">
Automation and ScriptingRe: Plotting gradient colors in JSL, how to use variables to represent specific parameters?This is my old school way of handling this:
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Cities.jmp" );
obj = dt << Treemap( Categories( :city ), Sizes( :POP ), Coloring( :CO ) );
treemapGBPref = Get Platform Preference( treemap( "Use Graph Builder" ) );
prefVal = Arg( Arg( Arg( treemapGBPref, 1 ) ) );
mx = 20;
mn = 1;
report = obj << report;
Eval(
Parse(
"report << Dispatch(
{},
\!"400\!",
ScaleBox,
{Legend Model(
1,
Properties(
0,
{gradient( {Scale Values( ["
|| Char( mn ) || " " || Char( mx ) || "] )} )},
Item ID( \!"CO\!", 1 )
)
)}
);"
)
);
When all else fails, this method always works. You need to learn it and put it into your tool box.
Re: Plotting gradient colors in JSL, how to use variables to represent specific parameters?Thank Jim!
{gradient( {Scale Values( ["
|| Char( mn ) || " " || Char( mx ) || "] )} )}
Re: Plotting gradient colors in JSL, how to use variables to represent specific parameters?As an alternative you could create the matrix outside of the command and use it via Name Expr(range)
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Cities.jmp" );
obj = dt << Treemap( Categories( :city ), Sizes( :POP ), Coloring( :CO ) );
range = [1 20];
(obj << Get Legend Server()) << Legend Model(
1,
Properties(
0,
{gradient( Scale Values( Name Expr( range ) ) )}
)
);