cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar
ARETI052
Level III

How to let user choose multiple columns for graph builder

Hi,

 

I'm just getting started in JSL coding, I am trying to create a script that can take user input (selection of y columns) and plot them in the graph builder. As of right now only the first Y column can be changed based on user's selection but the other 3 remains hard coded. How can I modify the code so that the graph builder will take multiple input selections and don't expect a fixed number of inputs? (Just like using the regular JMP GUI for Graph Builder where you can put multiple Y-values at ones).

 

Thanks!

 

ARETI052_0-1719430247122.png

ARETI052_1-1719430279674.png

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
hogi
Level XI

Re: How to let user choose multiple columns for graph builder

or maybe

dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
gb = Graph Builder(
	Variables( X( :height ) ),
	Elements( Points( X ), Smoother( X ) )
);

for each ({col,idx}, {:height, :weight},
gb << Add Variable( {col , Role( "Y" ), Position(1)} ));

... if you want to add all Y values into one framebox

hogi_0-1719432187039.png

 

View solution in original post

2 REPLIES 2
hogi
Level XI

Re: How to let user choose multiple columns for graph builder

use a for loop and 

hogi_0-1719431164737.png

 

dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
gb = Graph Builder(
	Variables( X( :height ) ),
	Elements( Points( X ), Smoother( X ) )
);

for each ({col}, {:age, :weight},
gb << Add Variable( {col , Role( "Y" )} ));

hogi_1-1719432226548.png

 

hogi
Level XI

Re: How to let user choose multiple columns for graph builder

or maybe

dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
gb = Graph Builder(
	Variables( X( :height ) ),
	Elements( Points( X ), Smoother( X ) )
);

for each ({col,idx}, {:height, :weight},
gb << Add Variable( {col , Role( "Y" ), Position(1)} ));

... if you want to add all Y values into one framebox

hogi_0-1719432187039.png