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

Selecting the x-axis conditionally

Hi everyone,

 

How do I make JSL plot a graph such that the x-axis is column 'A' if it exists in the data table, else, it uses column 'B' as the x-axis? I feel that it could be an adaptation of the solutions in this discussion:

If statement inside graph builder for SendToReport functionality 

 

This is the code I have so far (the plot is displayed in a dashboard, hence the use of 'Platform()'):

Report9 = Platform(dt,
			       gb9 = Graph Builder(
			                 Size( 534, 456 ),
				             Show Control Panel( 0 ),
				             Fit to Window( "Maintain Aspect Ratio" ),
				             Variables( X( :A ), Y( :Name("Population") ) ),
				             Elements(
						        Points( X, Y, Legend( 7 ) ),
						        Smoother( X, Y, Legend( 8 ) )
						)
					)
				);

 

Thanks in advance!

1 ACCEPTED SOLUTION

Accepted Solutions
jthi
Super User

Re: Selecting the x-axis conditionally

Check if column A exist in datatable (you can get all column names with << Get Column Names("String") and then use Contains() to check the list has a specific value), then based on if it does / doesn't, create variable which has the column you want and finally add it to Platform with Eval(EvalExpr())

-Jarmo

View solution in original post

1 REPLY 1
jthi
Super User

Re: Selecting the x-axis conditionally

Check if column A exist in datatable (you can get all column names with << Get Column Names("String") and then use Contains() to check the list has a specific value), then based on if it does / doesn't, create variable which has the column you want and finally add it to Platform with Eval(EvalExpr())

-Jarmo