- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
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!
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
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())
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
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())