Choose Language Hide Translation Bar
Highlighted
nikles
Level IV

Question on navigating a complex display tree

Hi.  My question is if there is a simple way to navigate a display tree to get to the (x) AxisBox of a plot, if it's unknown whether other (y) AxisBoxes precede it in the tree.  I'm considering possibly using Xpath or some other method.  In my script, I create a window for my results, including a distribution.  User has option of including histogram, outlier box plot, and/or normal quantile plot.  Example:

 

Names Default to Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");

//User controllable options to plot histogram, outlier box plot, or normal quantile plot
histopt = 1;
outlopt = 1;
nqplopt = 1;

//Make results window
Try(Window("My Window") << Close Window);
win = New Window("My Window",
	TextBox("Important text info"),
	LUB = LineUpBox(NCol(1), Spacing(10,10))
);

//Add distribution to it.
Eval(EvalExpr(
	LUB << Append(
		dist = Distribution(
			Column("Height"),
			Histogram(Expr(histopt)),
			Outlier Box Plot(Expr(outlopt)),
			Normal Quantile Plot(Expr(nqplopt)),
			Capability Analysis(0),
			Quantiles(0),
			Vertical(0),
			Stack(0),
			Automatic Recalc(0)
		);
	);
));

win << Show Tree Structure;

With all 3 plot options selected as above, the resulting tree structure shows me that the (y) AxisBox for the Normal Quantile Plot is titles "AxisBox(1), and the (x) AxisBox is titled "AxisBox(2)".  If I turn off the normal quantile option and run the script again, the (x) AxisBox is now titled "AxisBox(1)".   So unfortunately I cant refer to the Axis Box simply by its name, plus I don't like doing that as display box names can change.  I do not know XPath well enough to tell it how to look for only x-axis Axis Box, but I'm wondering if there is some method like:

 

win << XPath("\\AxisBox() = "Xaxis");

Or something akin to that?

2 REPLIES 2
Highlighted
txnelson
Super User

Re: Question on navigating a complex display tree

Interesting question.  I was not able to come up with a straight forward solution.  The Xpath seems to return all axis boxes possible for the platform, not only the currently displayed ones.  However, I think you can examine the Axis Box() object to find out if it is a Normal Quantile Box, or the historgram.  The scale for the Normal Quantile box is "Normal Probability"  I don't believe you will ever see that if the Axis is for the histogram.  But there is a further issue.....there doesn't seem to be a << get scale option for the axis box......however, it is surfaced in the script for the axis box().  So if you 

theScript = report(dist)[AxisBox(1)] << get script;

you will have returned

Report( dist )[axisbox( 1 )] << get script = {Scale( "Normal Probability" ), Format( "Best" ),
Min( 0.0195121951219512 ), Max( 0.980487804878049 ), Interval( "Numeric" ), Inc( 0.1 ), Minor Ticks( 0 ),
Label Row Nesting( 1 ), Label Row(
	{Automatic Font Size( 0 ), Automatic Tick Marks( 0 ), Inside Ticks( 0 ), Label Alignment( "Near" ),
	Label Buffer Scale( 1 ), Label Orientation( "Horizontal" ), Lax Label Range( 0 ),
	Major Grid Line Color( -14145495 ), Minimum Depth( 0 ), Minimum Font Size( 7 ),
	Minor Grid Line Color( -15790320 ), Show Major Grid( 1 ), Show Major Labels( 1 ), Show Major Ticks( 1 ),
	Show Minor Grid( 0 ), Show Minor Labels( 0 ), Show Minor Ticks( 1 ), Tick Offset( 0 ), Wrap Lines( 0 )}
)};

in which you can scan and find the scale being used.  And from there, determine which AxisBox to work on.

 

 

Jim
Highlighted
nikles
Level IV

Re: Question on navigating a complex display tree

Thanks Tex.  I wasn't aware you could get a script from a report.  That opens several doors.  Although I still have hope for there to be some method to do this via XPath. 

Article Labels

    There are no labels assigned to this post.