cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
New to using JMP? Hit the ground running with the Early User Edition of Discovery Summit. Register now, free of charge.
Register for our Discovery Summit 2024 conference, Oct. 21-24, where you’ll learn, connect, and be inspired.
Choose Language Hide Translation Bar
Neo
Neo
Level VI

How to pass Y variable in Graph Builder from a List in JSL?

The example script below does what I need for a fixed small number of parameters which I want to plot on the Y-axis. 

How to automate this for a list which is supplied to Y from above?

(The X variable/column remains fixed but the number of elements going to Y can change and is supplied from a another script)

Names Default To Here (1);
Clear Log ();
dt = open("$sample_data\Big Class.jmp");
y_values = {"name", "age", "sex", "weight"};
Graph Builder(
    Show Control Panel( 0 ),
    Variables( X( :height), 
    Y( column(dt, y_values[1]) ), 
    Y( column(dt, y_values[2]) ),
    Y( column(dt, y_values[3]) ),
    Y( column(dt, y_values[4]) ) 
    ),
    Elements( Position( 1, 1 ), Points( X, Y, Legend( 1 ) ) ),
	Elements( Position( 1, 2 ), Points( X, Y, Legend( 2 ) ) ),
	Elements( Position( 1, 3 ), Points( X, Y, Legend( 3 ) ) ),
	Elements( Position( 1, 4 ), Points( X, Y, Legend( 4 ) ) )
);

Also, how does one handle the Elements () in this case.

When it's too good to be true, it's neither
10 REPLIES 10
jthi
Super User

Re: How to pass Y variable in Graph Builder from a List in JSL?

I would suggest getting the reference when you evaluate the expression which creates the graph. I think

gb = Eval(gb_expr);

should work. Also it might be a good idea to make sure that Graph Builder is created using dt if there is possibility that multiple tables are open. Though I'm not sure what would be the easiest syntax to do it in this case without testing

-Jarmo