cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Browse apps to extend the software in the new JMP Marketplace
Choose Language Hide Translation Bar
Jdho3
Level I

Dispatch()

I want to add reference lines to a graph, but only if the page has :name = "Closed Loop Control". The only way I have found to be successful is to grab it sequentially using the highlighted scalebox(5), however I want to grab it by the :name instead. closed loop.png

1 REPLY 1
jthi
Super User

Re: Dispatch()

I usually do these with the help of some sort XPath if I cannot easily build it into the graph builder script, as my reports tend to be quite dynamic

Names Default To Here(1); 

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

gb = dt << Graph Builder(
	Size(528, 2954),
	Show Control Panel(0),
	Variables(X(:height), Y(:weight), Page(:age)),
	Elements(Points(X, Y, Legend(5)), Smoother(X, Y, Legend(6)))
);

rep = Report(gb);
gbb_names = rep << XPath("//GraphBuilderGroupBox/text()");

group_number = Contains(gbb_names, "age = 14");
abs = Report(gb) << XPath("//AxisBox");
abs[group_number*2] << Add Ref Line(80, "Solid", "Black", "", 1);

// or possibly with dispatch you could do something like this
group_number = Contains(gbb_names, "age = 16");
rep << Dispatch({}, "weight", ScaleBox(group_number + 1),
	{Add Ref Line(110, "Solid", "Black", "", 1)}
);
-Jarmo