cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
The Discovery Summit 2025 Call for Content is open! Submit an abstract today to present at our premier analytics conference.
See how to use to use Text Explorer to glean valuable information from text data at April 25 webinar.
Choose Language Hide Translation Bar
View Original Published Thread

Selecting the x-axis conditionally

A_Zaid
Level III

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