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
Robbb
Level III

Graph Builder: Additional Y variables with the same color

Hi JMP Community,

 

currently, I am writing a script that creates a plot template among other stuff in form of a pre-filled graph builder. Script below. The open graph builder is supposed to be used by the user who usually wants to have a look at other signals in addition to the existing 4 in the plot. So he usually starts to drags another column and drop it on top or at the bottom of the existing 4 signals.

The problem is that the new signals that are dropped onto the y axis manually are assigned standard colors. I would like all signals in the plot to have the same color that is defined by :State, no matter how many signals are dropped on and dragged off the y axis without having to manually assign the correct colors via the legend properties.

How to achieve that?

 

Thanks

Rob

 

Graph Builder(
	Variables(
		X( :Time ),
		Y( :Signal 1 ),
		Y( :Signal 2 ),
		Y( :Signal 3 ),
		Y( :Signal 4 ),
		Color( :State )
	),
	Elements( Position( 1, 1 ), Line( X, Y, Legend( 4 ) ) ),
	Elements( Position( 1, 2 ), Line( X, Y, Legend( 5 ) ) ),
	Elements( Position( 1, 3 ), Line( X, Y, Legend( 6 ) ) ),
	Elements( Position( 1, 4 ), Line( X, Y, Legend( 7 ) ) ),
	SendToReport(
		Dispatch( {}, "Signal 3", ScaleBox, {Format( "Best", 12 )} ),
		Dispatch( {}, "Signal 4", ScaleBox, {Format( "Best", 12 )} ),
		Dispatch(
			{},
			"400",
			ScaleBox,
			{Legend Model(
				4,
				Properties( 0, {Line Color( 21 )}, Item ID( "Here", 1 ) ),
				Properties( 1, {Line Color( 20 )}, Item ID( "are", 1 ) ),
				Properties( 2, {Line Color( 41 )}, Item ID( "different", 1 ) ),
				Properties( 3, {Line Color( 37 )}, Item ID( "labels", 1 ) ),
				Properties( 4, {Line Color( 0 )}, Item ID( "for", 1 ) ),
				Properties( 5, {Line Color( 32 )}, Item ID( "certain", 1 ) ),
				Properties( 6, {Line Color( 1 )}, Item ID( "system", 1 ) ),
				Properties( 7, {Line Color( 32 )}, Item ID( "states", 1 ) )
			)}
		)
	)
)

 

3 REPLIES 3
jthi
Super User

Re: Graph Builder: Additional Y variables with the same color

One option would be to set Value Colors column property to :State with desired colors.

-Jarmo
Robbb
Level III

Re: Graph Builder: Additional Y variables with the same color

Hi jthi,

yes, thanks, that is a good solution if :State is supposed to always have the same colors in all plots. In fact, I have several plots and two of them involve :State with a different coloring. So I thought, instead of realizing the coloring via a column property I should rather do it in the respective plots.

What I could do is to copy :State as often as necessary and always assign a different value color property. But I don't like that solution because it feels like a workaround.

jthi
Super User

Re: Graph Builder: Additional Y variables with the same color

I think you might have to do some scripting and set those colors when plot is changed. Not sure if it can be automatically triggered on change but you could for example add a button.

There is also option to use Color or Mark by Column... but you would run into same issue if you want to use different color for same state in different plots.

jthi_0-1659426064023.png

 

-Jarmo