cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Check out the JMP® Marketplace featured Capability Explorer add-in
Choose Language Hide Translation Bar

Fixed line style based on name in Graph Builder

Dear,

 

I would like to know if and how it is possible to always have a fixed line style/color based on a certain criteria (e.g. in the case below based on the Quarter).

If you take the sample data file "Australian Tourism" and plot the Room occupancy (%) versus Year you would get something like below,

where I changed the line style for Quarter 2 to be dashed.

PietVanmeerbeek_0-1625058107915.png

However when I select only Quarters 2,3 and 4 the graph changes to:

PietVanmeerbeek_1-1625058361049.png

I would like to have Quarter 2 still in Red dashed, Quarter 3 still full green and Quarter 4 still full purple.

 

When I started looking for a solution I ended up on this page:

customization - In JMP, how to custom graph line by specifying the curve name? - Stack Overflow

It seemed promising but somehow It seems to be valid for a bivariate plot, I am not able to implement this trick to a Graph Builder plot.

 

 

3 REPLIES 3
Thierry_S
Super User

Re: Fixed line style based on name in Graph Builder

Hi,
A simple solution is to assign colors to the Quarter values: Column > Column Properties > Value Colors. This will tell JMP to use your choice instead of the default colors which do change upon selecting different groups in the Local Filter as you observed.

Let me know if that helps.

Best,
TS
Thierry R. Sornasse

Re: Fixed line style based on name in Graph Builder

Thanks TS,

 

this already is a great help and indeed very simple to apply.

Can something similar be done with respect to the line type? e.g. dashed,solid,etc.

 

Best regards,

Piet.

Re: Fixed line style based on name in Graph Builder

Anyone who can help me with changing the line style?

I would think something like below, but it seems not to work.

 

dt = Open( "$SAMPLE_DATA/Australian Tourism.jmp" );
gb = dt << Graph Builder(
	Show Control Panel( 0 ),
	Variables(
		X( :Year ),
		Y( :Name( "Room occupancy rate (%)" ) ),
		Overlay( :Quarter )
	),
	Elements(
		Line( X, Y, Legend( 7 ), Row order( 0 ), Summary Statistic( "Mean" ) )
	),
	SendToReport(
		Dispatch( {}, "Year", ScaleBox, {Show Major Ticks( 0 )} ),
		Dispatch(
			{},
			"Room occupancy rate (%)",
			ScaleBox,
			{Min( 54.5305429864253 ), Max( 75 ), Inc( 5 ), Minor Ticks( 1 )}
		),
		Dispatch(
			{},
			"400",
			ScaleBox,
			{Legend Model( 7, Properties( 3, {Line Style( "Dashed" )} ) )}
		),
		Dispatch(
			{},
			"graph title",
			TextEditBox,
			{Set Text( "Room occupancy rate vs. Year and Quarter" )}
		)
	)
);
reportWindow = gb << Report;
reportWindow[ ScaleBox ] << (Line[1] << Line Style( Dashed ));

My thoughts were that looking at the script, changing the line style sends something to the "ScaleBox".

But I am doing something wrong, since it is not working and also the log file tells me this:

 

Send Expects Scriptable Object in access or evaluation of 'Send' , reportWindow[ScaleBox] << /*###*/(Line[1] << Line Style( Dashed )) /*###*/

In the following script, error marked by /*###*/
reportWindow[ScaleBox] << /*###*/(Line[1] << Line Style( Dashed )) /*###*/