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
nikles
Level VI

Get number of frame boxes in a graphbuilder plot?

Hi.  I'd like to know if there is a good way to get the number of frame boxes in a graphbuilder plot.  I have a GB plot that contains 104 FB (8 X-groups, 13 Y-groups).  I've written a script to change the marker size for each FB.  

	Summarize(dtstack, frame_lis = By(:Freq, :Image, :Region));
	For(i=1, i<=NItems(frame_lis[1]), i++,
		Try(
			Report(gb) << Dispatch({}, "Graph Builder", FrameBox(i), 
				{Marker Size(1)}
			)
		)
	);

(credit to @ms in https://community.jmp.com/t5/Discussions/Can-t-change-all-marker-size-in-Graph-Builder-by-script/m-p... ).  But in my case, the Summarize statement overestimates the number of FB, as I've excluded several rows in my table containing certain values of Region, Image, or Freq.  This script works, but once the counter i exceeds the the actual number of FB in the GB plot, I begin getting error messages in the log ("Cannot find FrameBox[ "Graph Builder" ] at {}").  The "Try" statement was an attempt to prevent the error messages, but did not work.  At any rate, I'd prefer to avoid this by just computing the correct number of frame boxes to begin with.  Anyone have any ideas?

1 ACCEPTED SOLUTION

Accepted Solutions
ih
Super User (Alumni) ih
Super User (Alumni)

Re: Get number of frame boxes in a graphbuilder plot?

To directly answer your question, you can count the items returned with an XPath query.  A better solution, though, is to just send the Marker Size message to all of the results returned with XPath rather than using Dispatch.

 

Names Default To Here( 1 );

dt = Open( "$sample_data\Big Class.jmp" );

gb = Graph Builder(
	Show Control Panel( 0 ), 
	Variables( X( :weight ), Y( :height ), Group Y( :sex ) ), 
	Elements( Points( X, Y, Legend( 1 ) ) ), 
);

//Count Frame boxes here
N Items( (gb << XPath( "//FrameBox" )) );

//Or just update them all
(gb << XPath( "//FrameBox" )) << Marker Size( 8 );

 

View solution in original post

2 REPLIES 2
ih
Super User (Alumni) ih
Super User (Alumni)

Re: Get number of frame boxes in a graphbuilder plot?

To directly answer your question, you can count the items returned with an XPath query.  A better solution, though, is to just send the Marker Size message to all of the results returned with XPath rather than using Dispatch.

 

Names Default To Here( 1 );

dt = Open( "$sample_data\Big Class.jmp" );

gb = Graph Builder(
	Show Control Panel( 0 ), 
	Variables( X( :weight ), Y( :height ), Group Y( :sex ) ), 
	Elements( Points( X, Y, Legend( 1 ) ) ), 
);

//Count Frame boxes here
N Items( (gb << XPath( "//FrameBox" )) );

//Or just update them all
(gb << XPath( "//FrameBox" )) << Marker Size( 8 );

 

nikles
Level VI

Re: Get number of frame boxes in a graphbuilder plot?

Thanks @ih . That seems to have worked well. For some reason I get an error when I try to accept your answer as the solution - but this was the solution.