[Script] Color Gradient OutputR1=(dt<< Tabulate(
Show Control Panel( 0 ),
Show Tooltip( 1 ),
Add Table(
Column Table( Statistics( N )),
Column Table( Grouping Columns( :Name( "TEST" ) ), Statistics( Row %, N )),
Row Table( Grouping Columns( :Radius ) )
)
)) << Make Into Data Table;
R1:"N(1)"<< Set Property( "Color Gradient", {"White to Orange", Range( {0, 547, 187.945945945946} )} )
<< Color Cell by Value;
R1:"N(8)"<< Set Property( "Color Gradient", {"White to Orange", Range( {0, 547, 187.945945945946} )} )
<< Color Cell by Value;
R1:"N(9)"<< Set Property( "Color Gradient", {"White to Orange", Range( {0, 547, 187.945945945946} )} )
<< Color Cell by Value;
The output of the script above is combined together. Therefore the colour gradient that is set for N(1), N(8), N(9) has combined, how do i seperate each N(s) to have their own specific colour gradient
Re: [Script] Color Gradient OutputHi, yes this was the issue i was trying to solve. Thanks alot for the help and guidance. Sorry for my poor english. Thanks
Re: [Script] Color Gradient OutputThe script fails because there is not a column defined called:
Zero to Three 3
The log issues the following error
Scoped data table access requires a data table column or variable in access or evaluation of 'dt:zero to three 3' , dt:zero to three 3/*###*/
This can be handled in several ways. If you want to continue using "Hard Coding" you can overcome the issue with the "Try" function:
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA\big class.jmp" );
dt << New Column( "zero to three", formula( Random Integer( 0, 3 ) ) );
dt << New Column( "zero to three 2", formula( Random Integer( 0, 3 ) ) );
dt << New Column( "zero to three 4", formula( Random Integer( 0, 3 ) ) );
Try( dt:zero to three << Set Property( "Color Gradient", {"White to Orange"} ) << Color Cell by Value );
Try( dt:zero to three 2 << Set Property( "Color Gradient", {"White to Orange"} ) << Color Cell by Value );
Try( dt:zero to three 3 << Set Property( "Color Gradient", {"White to Orange"} ) << Color Cell by Value );
Try( dt:zero to three 4 << Set Property( "Color Gradient", {"White to Orange"} ) << Color Cell by Value );
Or, you can get a little more advanced and look and see if what names match the pattern you want, and if it does match it, then apply the color gradient:
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA\big class.jmp" );
dt << New Column( "zero to three", formula( Random Integer( 0, 3 ) ) );
dt << New Column( "zero to three 2", formula( Random Integer( 0, 3 ) ) );
dt << New Column( "zero to three 4", formula( Random Integer( 0, 3 ) ) );
ColNames = dt << get column names( string, numeric );
For( i = 1, i <= N Items( ColNames ), i++,
If( Contains( Uppercase( ColNames[i] ), "ZERO TO THREE" ) == 1,
Column( dt, ColNames[i] ) << Set Property( "Color Gradient", {"White to Orange"} ) << Color Cell by Value
)
);
Is this the issue you are trying to work around?
Re: [Script] Color Gradient OutputOk, I have understood the problem of my script. Try running this.
<SPAN class="token function">Names default to here</SPAN><SPAN class="token punctuation">(</SPAN><SPAN class="token number">1</SPAN><SPAN class="token punctuation">)</SPAN><SPAN class="token punctuation">;</SPAN>
dt<SPAN class="token operator">=</SPAN><SPAN class="token function">open</SPAN><SPAN class="token punctuation">(</SPAN><SPAN class="token string">"$SAMPLE_DATA\big class.jmp"</SPAN><SPAN class="token punctuation">)</SPAN><SPAN class="token punctuation">;</SPAN>
dt<SPAN class="token operator"><</SPAN><SPAN class="token operator"><</SPAN><SPAN class="token function">new column</SPAN><SPAN class="token punctuation">(</SPAN><SPAN class="token string">"zero to three"</SPAN><SPAN class="token punctuation">,</SPAN> formula<SPAN class="token punctuation">(</SPAN><SPAN class="token function">random integer</SPAN><SPAN class="token punctuation">(</SPAN><SPAN class="token number">0</SPAN><SPAN class="token punctuation">,</SPAN><SPAN class="token number">3</SPAN><SPAN class="token punctuation">)</SPAN><SPAN class="token punctuation">)</SPAN><SPAN class="token punctuation">)</SPAN><SPAN class="token punctuation">;</SPAN>
dt<SPAN class="token operator"><</SPAN><SPAN class="token operator"><</SPAN><SPAN class="token function">new column</SPAN><SPAN class="token punctuation">(</SPAN><SPAN class="token string">"zero to three 2"</SPAN><SPAN class="token punctuation">,</SPAN> formula<SPAN class="token punctuation">(</SPAN><SPAN class="token function">random integer</SPAN><SPAN class="token punctuation">(</SPAN><SPAN class="token number">0</SPAN><SPAN class="token punctuation">,</SPAN><SPAN class="token number">3</SPAN><SPAN class="token punctuation">)</SPAN><SPAN class="token punctuation">)</SPAN><SPAN class="token punctuation">)</SPAN><SPAN class="token punctuation">;<BR /></SPAN>dt<<NEW column="">:zero to three <SPAN class="token operator"><</SPAN><SPAN class="token operator"><</SPAN> Set Property<SPAN class="token punctuation">(</SPAN> <SPAN class="token string">"Color Gradient"</SPAN><SPAN class="token punctuation">,</SPAN> <SPAN class="token punctuation">{</SPAN><SPAN class="token string">"White to Orange"</SPAN><SPAN class="token punctuation">}</SPAN> <SPAN class="token punctuation">)</SPAN> <SPAN class="token operator"><</SPAN><SPAN class="token operator"><</SPAN> Color Cell by Value<SPAN class="token punctuation">;</SPAN>
dt<SPAN class="token punctuation">:</SPAN>zero to three <SPAN class="token number">2</SPAN> <SPAN class="token operator"><</SPAN><SPAN class="token operator"><</SPAN> Set Property<SPAN class="token punctuation">(</SPAN> <SPAN class="token string">"Color Gradient"</SPAN><SPAN class="token punctuation">,</SPAN> <SPAN class="token punctuation">{</SPAN><SPAN class="token string">"White to Orange"</SPAN><SPAN class="token punctuation">}</SPAN><SPAN class="token punctuation">)</SPAN> <SPAN class="token operator"><</SPAN><SPAN class="token operator"><</SPAN> Color Cell by Value<SPAN class="token punctuation">;<BR />dt:zero to three 3 << Set Property( "Color Gradient", {"White to Orange"}) << Color Cell by Value;<BR />dt:zero to three 4 << Set Property( "Color Gradient", {"White to Orange"}) << Color Cell by Value</SPAN></NEW>
Re: [Script] Color Gradient OutputI must be missing something, because the color gradient, and the specified range you can control. So I don't see why there is an issue with the colors not being set as you desire. Below is an example of letting the coloring being set by JMP evalueating the range of the values, and a second example of you setting the values.
These values can be set by calculating the column means, or whatever method you want
Names default to here(1);
dt=open("$SAMPLE_DATA\big class.jmp");
dt<<NEW column=""></NEW>
Now, if you want to explicitly set a color to a specific cell, then you can do that.
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
:Age << Color Cells( "Red",5 );
Re: [Script] Color Gradient Output
This is run with the given scriptThis is run with the given scriptThis is run with the given script
This is the type colour gradient that i am talking aboutThis is the type colour gradient that i am talking aboutThis is the type colour gradient that i am talking about
I would like the output from picture 2
Re: [Script] Color Gradient OutputCan you please explain why going above 99 columns would be a limitation? I don't understand your comment.
Re: [Script] Color Gradient OutputHi,
Well I am doing it this way, but as the data size increases to N(99), all columns would not apply the colour patterns.
Is there another way to apply the colour patterns?
Re: [Script] Color Gradient OutputI hope this is what you are asking for.
To change the color pattern, all you have to do is to change the Gradient Pattern and/or the color range. Below I have taken the first column N(1) and changed it's gradient
R1:"N(1)" << Set Property( "Color Gradient", {"Blue to Green to Red", Range( {31, 284, 150} )} ) << Color Cell by Value;
R1:"N(8)" << Set Property( "Color Gradient", {"White to Orange", Range( {0, 547, 187.945945945946} )} ) << Color Cell by Value;
R1:"N(9)" << Set Property( "Color Gradient", {"White to Orange", Range( {0, 547, 187.945945945946} )} ) << Color Cell by Value;Re: [Script] Color Gradient OutputHi, the attachment is the R1 data table
Re: [Script] Color Gradient OutputCan you provide the R1 data table?