- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
RGB colors of rows in JMP datatable
I am working on a C# application the can be invoked by jsl JMP scripts. The JMP script is a table script in a JMP datatable. I am trying to figure out how to get the RGB color values from a row in the JMP datable. Basically, if the user color codes rows in JMP, my C# application needs to know the RGB color values for each row, is there a way with JSL programming to get the RGB color values for a row in a JMP table?
Thanks!
Chris
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: RGB colors of rows in JMP datatable
Colors and other information are stored in Row States. Check out the Color Of() function.
Here's an example from the Scripting Index:
Names Default To Here( 1 );
Open( "$SAMPLE_DATA/Big Class.jmp" ) << Color By Column( :height );
Color To RGB( Color Of( Row State( 3 ) ) );
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: RGB colors of rows in JMP datatable
RowStates = dt << Get Row States() ;
ColorList = list() ;
for( i = 1 , i <= N Items(RowStates), i ++,
Insert Into(ColorList ,Color Of(RowStates[i]);
)
Uday
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: RGB colors of rows in JMP datatable
You can use the script from this post to translate the color values into colors . Hope this helps .
Uday
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: RGB colors of rows in JMP datatable
Colors and other information are stored in Row States. Check out the Color Of() function.
Here's an example from the Scripting Index:
Names Default To Here( 1 );
Open( "$SAMPLE_DATA/Big Class.jmp" ) << Color By Column( :height );
Color To RGB( Color Of( Row State( 3 ) ) );
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: RGB colors of rows in JMP datatable
Here's what I ran:
Names Default To Here( 1 );
dt=current datatable(); \
dt<< Color By Column( :COL);
it=Color To RGB( Color Of( Row State( 3 ) ) );
show(it);
it = {0.988235294117647, 0.0431372549019608, 0.0431372549019608};
I was expecting 3 integers, so do I multiple these by 255 and round each number?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: RGB colors of rows in JMP datatable
I confirmed Jeff solution works!!
Names Default To Here( 1 );
dt=current datatable();
dt<< Color By Column( :COL);
it=Color To RGB( Color Of( Row State( 1 ) ) );
show(it);
it = {0.164705882352941, 0.247058823529412, 1};
You just need to multiple 3 numbers by 255 to get RGB color values.
This forum rocks! Thanks for the quick replies!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: RGB colors of rows in JMP datatable
Just thought I'd add a note about the values being 0.0-1.0. This is called normalized color space. Often times we think of color values in the range 0 to 255, but that implies an 8-bit color space, where 8 bits are used to represent each of the red, green and blue color components. But not all color spaces are 8 bits. Some color spaces and some image formats actually support more than 8 bits for each color component, such as 16. That is why normalized color space is useful. It doesn't matter how many bits you are working with. You can simply multiply the normalized values by the appropriate value based on your color space (255 for 8-bit or 65535 for 16-bit). Also, in graphics or image analysis often times you are doing lots of math. With integer values every operation incurs some rounding error. With normalized color space there is no error incurred. Hope this helps explain why you might want to work in normalized color space and why JMP returns the values as 0.0-1.0.