cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Try the Materials Informatics Toolkit, which is designed to easily handle SMILES data. This and other helpful add-ins are available in the JMP® Marketplace
Choose Language Hide Translation Bar
ReneeBay
Level II

using RGB values in JSL scripts instead of color name or whatever this (--16741343) is

Hello,

 

I'm new to using a basic JSL script that was saved after building a bar chart graphic. Although I set RGB values to assign colors to bars in Graph Builder, the resulting JSL script gives me this:

 

Properties( 1, {Fill Color( "yellow" )} ),
Properties( 2, {Fill Color( -16741343 )} ),
Properties( 3, {Fill Color( -11075814 )} ),
Properties( 4, {Fill Color( -16755200 )} ),

 

Can I use RGB values in this script instead and if so, what's the syntax? I tried "yellow" for example which works fine, but {Fill Color( 255,255,0 )} - the yellow I really want - does not.

 

Is it possible to use your own colors, or do you have to use JMPs table of colors?

 

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: using RGB values in JSL scripts instead of color name or whatever this (--16741343) is

You need to use the RGB Color() function. The Scripting Index gives a nice example of using the RGB Color() function to convert from RGB to the JMP color,.

Names Default To Here( 1 );
New Window( "RGB Color Example", 
/* 1 through 16 are good */ 
	division = 6;
	blocks = division + 1;
	ysize = 400 / Sqrt( division );
	xsize = ysize * blocks;
	fract = 1 / division;
/* 100 is default axis range */
	yBlockSize = 100 / blocks;
	xBlockSize = 100 / (blocks * blocks);
	Graph(
		frameSize( xsize, ysize ),
		For( blue = 0, blue <= 1, blue += fract,
			For( red = 0, red <= 1, red += fract,
				For( green = 0, green <= 1,
					green += fract,
					y = red / fract * yBlockSize;
					x = green / fract * xBlockSize
					+blue / fract * xBlockSize * blocks;
/* here's the example */
					Fill Color(
						RGB Color( red, green, blue )
					);
					Rect(
						x,
						y,
						x + xBlockSize,
						y + yBlockSize,
						1
					);
				)
			)
		)
	);
);

 

Jim

View solution in original post

2 REPLIES 2
txnelson
Super User

Re: using RGB values in JSL scripts instead of color name or whatever this (--16741343) is

You need to use the RGB Color() function. The Scripting Index gives a nice example of using the RGB Color() function to convert from RGB to the JMP color,.

Names Default To Here( 1 );
New Window( "RGB Color Example", 
/* 1 through 16 are good */ 
	division = 6;
	blocks = division + 1;
	ysize = 400 / Sqrt( division );
	xsize = ysize * blocks;
	fract = 1 / division;
/* 100 is default axis range */
	yBlockSize = 100 / blocks;
	xBlockSize = 100 / (blocks * blocks);
	Graph(
		frameSize( xsize, ysize ),
		For( blue = 0, blue <= 1, blue += fract,
			For( red = 0, red <= 1, red += fract,
				For( green = 0, green <= 1,
					green += fract,
					y = red / fract * yBlockSize;
					x = green / fract * xBlockSize
					+blue / fract * xBlockSize * blocks;
/* here's the example */
					Fill Color(
						RGB Color( red, green, blue )
					);
					Rect(
						x,
						y,
						x + xBlockSize,
						y + yBlockSize,
						1
					);
				)
			)
		)
	);
);

 

Jim
ReneeBay
Level II

Re: using RGB values in JSL scripts instead of color name or whatever this (--16741343) is

Thanks so much! Worked perfectly!!