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

How to remove smoothing spline controls from bivariate fit

How do I delete Smoothing spline controls? I have a report with bunch of splines and this list of controls takes the whole page effectively collapsing the chart. I saw a similar question, but I have another part in my script and the solution doesn't work.

How do I remove it?

 

 

 

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

g=vlistbox(Big Class<< 
Fit Group(
	Bivariate(
	Y(:height),
	X(:weight),
	Fit Line({Line Color({76, 114, 176})}),
	Fit Spline(0.1, {Line Color({221, 132, 82})})
),
),
);

//This is the solution given to the question, but its not work for me, I guess because the vlistbox and fit grop

(Report(biv) << XPath("//BorderBox"))[2] << Visibility("Collapse");

//this might collapse too much, so make sure it doesn't
(Report(biv) << XPath("//IfBox")) << Visibility("Collapse");

 

  

1 ACCEPTED SOLUTION

Accepted Solutions
jthi
Super User

Re: How to remove smoothing spline controls from bivariate fit

I would do this using XPath like Jim already suggested. You can send << Get XML to your report and see the XML, then find what could be used to build your query

jthi_0-1715520890952.png

jthi_1-1715520918959.png

Quickly checking it looks like there isn't anything that would always work (helpKey isn't always the same and it seems to be also dependent on the analysis) so you might have to modify the query depending on your data

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

nw = New Window("", 
	vlb = V List Box(
		dt << Fit Group(
			Bivariate(
				Y(:height),
				X(:weight),
				Fit Line({Line Color({76, 114, 176})}),
				Fit Spline(0.1, {Line Color({221, 132, 82})})
			),
			Bivariate(
				Y(:weight),
				X(:height),
				Fit Line({Line Color({76, 114, 176})}),
				Fit Spline(0.1, {Line Color({221, 132, 82})})
			)
		)
	)
);

obs = vlb << XPath("//IfBox/OutlineBox"); // might collapse too much, but you could limit it to the specific reports
obs << Visibility("Collapse");

 

Other option would be to first get the outlinebox names from the ListBox (I would use XPath for this)

jthi_3-1715521136290.png

jthi_2-1715521126075.png

And then you can loop over those titles and hide corresponding outlineboxes (this can be built in many different ways)

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

nw = New Window("", 
	vlb = V List Box(
		dt << Fit Group(
			Bivariate(
				Y(:height),
				X(:weight),
				Fit Line({Line Color({76, 114, 176})}),
				Fit Spline(0.1, {Line Color({221, 132, 82})})
			),
			Bivariate(
				Y(:weight),
				X(:height),
				Fit Line({Line Color({76, 114, 176})}),
				Fit Spline(0.1, {Line Color({221, 132, 82})})
			)
		)
	)
);

reports = vlb << XPath("//OutlineBox[@helpKey = 'Bivariate Report']");

For Each({rep}, reports,
	tebs = rep << XPath("//ListBox/ListBox[PopupBox and CustomBox]/TextEditBox");
	ob_titles = tebs << get text;

	For Each({ob_title}, ob_titles,
		rep[OutlineBox(ob_title)] << Visibility("Collapse");
	);
);

 

-Jarmo

View solution in original post

6 REPLIES 6
txnelson
Super User

Re: How to remove smoothing spline controls from bivariate fit

Here is a simplified version of your supplied code.  It simply opens the data table, runs the Bivariate code, and then removes the spline controls

txnelson_0-1715510819439.png

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

biv =Bivariate(
	Y( :height ),
	X( :weight ),
	Fit Spline( 100000, {Line Color( {212, 73, 88} )} ),
	Fit Spline( 10000, {Line Color( {61, 174, 70} )} )
);

(Report(biv) << XPath("//IfBox")) << Visibility("Collapse");
Jim
HenLu
Level II

Re: How to remove smoothing spline controls from bivariate fit

I need to keep the code the same way because I have more things to display

 

 

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

g=vlistbox(dt<< 
Fit Group(
	Bivariate(
	Y(:height),
	X(:weight),
	Fit Line({Line Color({76, 114, 176})}),
	Fit Spline(0.1, {Line Color({221, 132, 82})})
),

	Bivariate(
	Y(:thickness),
	X(:date),
	Fit Line({Line Color({76, 114, 176})}),
	Fit Spline(0.1, {Line Color({221, 132, 82})})
),
),
);

//This is the solution given to the question, but its not work for me, I guess because the vlistbox and fit grop

(Report(g) << XPath("//BorderBox"))[2] << Visibility("Collapse");

//this might collapse too much, so make sure it doesn't
(Report(g) << XPath("//IfBox")) << Visibility("Collapse");


//open files
out=Tab Box(
"HELP",H List Box(V List Box(g)),
);
	 
/* Create Tabed Journal for Display */
all=New Window("p_all",<<Journal,
     Tab Box(
     "pla",out,
	  
	 	
	 ) );
	     

 

 

 

Craige_Hales
Super User

Re: How to remove smoothing spline controls from bivariate fit

This video shows how to grab the xpath from the report. xpath returns a list of matched boxes, and the <<visibility command is sent to every box in the list. The subscript [1] or [2] is removed because both items are desired.

 

 

Craige
txnelson
Super User

Re: How to remove smoothing spline controls from bivariate fit

Here is your code modified.  Your second Bivariate had to be changed since you were referencing columns not in the Big Class data table.  I assume they are from your actual data table.  I also added in variables that point to the 2 bivariates.  Your reference to using your g variable which is pointing to the VListBox does not have a report associated with it.  

txnelson_0-1715516348807.png

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

g=vlistbox(dt<< 
Fit Group(
	biv =Bivariate(
	Y(:height),
	X(:weight),
	Fit Line({Line Color({76, 114, 176})}),
	Fit Spline(0.1, {Line Color({221, 132, 82})})
),

	biv2 = Bivariate(
	Y(:weight),
	X(:height),
	Fit Line({Line Color({76, 114, 176})}),
	Fit Spline(0.1, {Line Color({221, 132, 82})})
),
),
);

//This is the solution given to the question, but its not work for me, I guess because the vlistbox and fit grop

(Report(biv) << XPath("//IfBox"))[2] << Visibility("Collapse");
(Report(biv2) << XPath("//IfBox"))[2] << Visibility("Collapse");

//this might collapse too much, so make sure it doesn't
//(Report(g) << XPath("//IfBox")) << Visibility("Collapse");


//open files
out=Tab Box(
"HELP",H List Box(V List Box(g)),
);
	 
/* Create Tabed Journal for Display */
all=New Window("p_all",<<Journal,
     Tab Box(
     "pla",out,
	  
	 	
	 ) );

 

Jim
jthi
Super User

Re: How to remove smoothing spline controls from bivariate fit

I would do this using XPath like Jim already suggested. You can send << Get XML to your report and see the XML, then find what could be used to build your query

jthi_0-1715520890952.png

jthi_1-1715520918959.png

Quickly checking it looks like there isn't anything that would always work (helpKey isn't always the same and it seems to be also dependent on the analysis) so you might have to modify the query depending on your data

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

nw = New Window("", 
	vlb = V List Box(
		dt << Fit Group(
			Bivariate(
				Y(:height),
				X(:weight),
				Fit Line({Line Color({76, 114, 176})}),
				Fit Spline(0.1, {Line Color({221, 132, 82})})
			),
			Bivariate(
				Y(:weight),
				X(:height),
				Fit Line({Line Color({76, 114, 176})}),
				Fit Spline(0.1, {Line Color({221, 132, 82})})
			)
		)
	)
);

obs = vlb << XPath("//IfBox/OutlineBox"); // might collapse too much, but you could limit it to the specific reports
obs << Visibility("Collapse");

 

Other option would be to first get the outlinebox names from the ListBox (I would use XPath for this)

jthi_3-1715521136290.png

jthi_2-1715521126075.png

And then you can loop over those titles and hide corresponding outlineboxes (this can be built in many different ways)

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

nw = New Window("", 
	vlb = V List Box(
		dt << Fit Group(
			Bivariate(
				Y(:height),
				X(:weight),
				Fit Line({Line Color({76, 114, 176})}),
				Fit Spline(0.1, {Line Color({221, 132, 82})})
			),
			Bivariate(
				Y(:weight),
				X(:height),
				Fit Line({Line Color({76, 114, 176})}),
				Fit Spline(0.1, {Line Color({221, 132, 82})})
			)
		)
	)
);

reports = vlb << XPath("//OutlineBox[@helpKey = 'Bivariate Report']");

For Each({rep}, reports,
	tebs = rep << XPath("//ListBox/ListBox[PopupBox and CustomBox]/TextEditBox");
	ob_titles = tebs << get text;

	For Each({ob_title}, ob_titles,
		rep[OutlineBox(ob_title)] << Visibility("Collapse");
	);
);

 

-Jarmo
HenLu
Level II

Re: How to remove smoothing spline controls from bivariate fit

thank you all for the help, combined with all the answers i use this code, and its work for me:

 

obs = vlb<< XPath("//IfBox/OutlineBox"); // might collapse too much, but you could limit it to the specific reports
obs << Visibility("Collapse");
obs = vlb << XPath("//BorderBox/ListBox"); // might collapse too much, but you could limit it to the specific reports
obs << Visibility("Collapse");