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
Clanlope
Level II

[Graph Builder in JSL] how to select graph build as an object in one Lineup Box

Hi, currently I created a lineup box with several graphs like 3 in it, and after the window popped out, I want to select each the graph by xpath then do some actions like sizing or adding ref line..

However I found that I am not able to use a for loop to individually select the graphs in my lineup box, what should I do? thanks!

(I tried to use gb1 = Graph Builder 1; gb2 = Graph Builder 2; gb3 = ... but I don't think it is an effective way.)

 

NW = New Window("GRA", LB = Lineup Box(N Col( 2 )));

LB << Append(
Graph Builder(
		Variables(X,Y...
Graph Builder(
		Variables(X,Y...
Graph Builder(
		Variables(X,Y...
);
TotalGB = LB << xpath("//LineUpBox/Box");  # This is wrong for selecting graph object #
For( ii = 1, ii <= N Items(TotalGB), ii++,
	TotalGB[ii] << Size( 800, 500 );
);
1 ACCEPTED SOLUTION

Accepted Solutions
jthi
Super User

Re: [Graph Builder in JSL] how to select graph build as an object in one Lineup Box

If you are adding them this way, you could create the references while appending them (collect them into a list and not separate variables). If you wish to use XPath you can do something like

Names Default To Here(1); 

dt = open("$SAMPLE_DATA/Big Class.jmp");

nw = New Window("", lub = Lineup Box());

lub << Append(
	gb = dt << Graph Builder(
		Variables(X(:weight), Y(:height), Overlay(:sex)),
		Elements(Points(X, Y, Legend(9)), Line Of Fit(X, Y, Legend(11)))
	)
);
lub << Append(
	gb = dt << Graph Builder(
		Variables(X(:weight), Y(:height), Overlay(:sex)),
		Elements(Points(X, Y, Legend(9)), Line Of Fit(X, Y, Legend(11)))
	)
);


gbs = (lub << XPath("//OutlineBox[@helpKey = 'Graph Builder']")) << get scriptable object;

without XPath for example

Names Default To Here(1); 

dt = open("$SAMPLE_DATA/Big Class.jmp");

nw = New Window("", lub = Lineup Box());

gbs = {};
lub << Append(
	gb = dt << Graph Builder(
		Variables(X(:weight), Y(:height), Overlay(:sex)),
		Elements(Points(X, Y, Legend(9)), Line Of Fit(X, Y, Legend(11)))
	)
);
Insert Into(gbs, gb);
lub << Append(
	gb = dt << Graph Builder(
		Variables(X(:weight), Y(:height), Overlay(:sex)),
		Elements(Points(X, Y, Legend(9)), Line Of Fit(X, Y, Legend(11)))
	)
);
Insert Into(gbs, gb);

show(gbs);
-Jarmo

View solution in original post

2 REPLIES 2
jthi
Super User

Re: [Graph Builder in JSL] how to select graph build as an object in one Lineup Box

If you are adding them this way, you could create the references while appending them (collect them into a list and not separate variables). If you wish to use XPath you can do something like

Names Default To Here(1); 

dt = open("$SAMPLE_DATA/Big Class.jmp");

nw = New Window("", lub = Lineup Box());

lub << Append(
	gb = dt << Graph Builder(
		Variables(X(:weight), Y(:height), Overlay(:sex)),
		Elements(Points(X, Y, Legend(9)), Line Of Fit(X, Y, Legend(11)))
	)
);
lub << Append(
	gb = dt << Graph Builder(
		Variables(X(:weight), Y(:height), Overlay(:sex)),
		Elements(Points(X, Y, Legend(9)), Line Of Fit(X, Y, Legend(11)))
	)
);


gbs = (lub << XPath("//OutlineBox[@helpKey = 'Graph Builder']")) << get scriptable object;

without XPath for example

Names Default To Here(1); 

dt = open("$SAMPLE_DATA/Big Class.jmp");

nw = New Window("", lub = Lineup Box());

gbs = {};
lub << Append(
	gb = dt << Graph Builder(
		Variables(X(:weight), Y(:height), Overlay(:sex)),
		Elements(Points(X, Y, Legend(9)), Line Of Fit(X, Y, Legend(11)))
	)
);
Insert Into(gbs, gb);
lub << Append(
	gb = dt << Graph Builder(
		Variables(X(:weight), Y(:height), Overlay(:sex)),
		Elements(Points(X, Y, Legend(9)), Line Of Fit(X, Y, Legend(11)))
	)
);
Insert Into(gbs, gb);

show(gbs);
-Jarmo
Clanlope
Level II

Re: [Graph Builder in JSL] how to select graph build as an object in one Lineup Box

Hello jthi,

It works, really appreciate it!