cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Register for our Discovery Summit 2024 conference, Oct. 21-24, where you’ll learn, connect, and be inspired.
Choose Language Hide Translation Bar
BabyDoragon
Level I

How can I annotate the background with different colors across different Y-axes?

The following JSL can annotate the region of 100 to 120 on the X-axis with a different color, but it cannot span across different Y-axes. How can I modify it to annotate different variable on Y-axes with different background colors for different variables?

BabyDoragon_0-1726834635856.png

 

 

Names Default To Here(1);

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

gb = dt << Graph Builder(
	Variables(X(:weight), Y(:height),Y(:age)),
	Elements(Points(X, Y, Legend(3))),
	SendToReport(

		Dispatch(
			{},
			"weight",
			ScaleBox,
			{Add Ref Line(100, "Solid", "blue", "", 5),
			Add Ref Line(120, "Solid", "blue", "", 5)}
		)
	)
);

rep = gb << report;
framebox = rep[frame box(1)];
framebox << Add Graphics Script(
	Transparency(0.5);
	Fill Color("Gray");
	Rect(100, Y Origin() + Y Range(), 120, Y Origin() , 1)
);
1 ACCEPTED SOLUTION

Accepted Solutions
jthi
Super User

Re: How can I annotate the background with different colors across different Y-axes?

You have multiple FrameBoxes when you have multiple axis (or groups or wraps or pages), so you can for example add separate graphic script to each of them. Simplified version below

Names Default To Here(1);

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

gb = dt << Graph Builder(
	Variables(X(:weight), Y(:height), Y(:age)),
	Elements(Points(X, Y, Legend(3)))
);

rep = gb << report;
fbs = rep << XPath("//FrameBox");

fbs[1] << Add Graphics Script(
	Transparency(0.5);
	Fill Color("Gray");
	Rect(100, Y Origin() + Y Range(), 120, Y Origin(), 1);
);

fbs[2] << Add Graphics Script(
	Transparency(0.5);
	Fill Color("Green");
	Rect(100, Y Origin() + Y Range(), 120, Y Origin(), 1);
);

jthi_0-1726835169724.png

 

-Jarmo

View solution in original post

1 REPLY 1
jthi
Super User

Re: How can I annotate the background with different colors across different Y-axes?

You have multiple FrameBoxes when you have multiple axis (or groups or wraps or pages), so you can for example add separate graphic script to each of them. Simplified version below

Names Default To Here(1);

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

gb = dt << Graph Builder(
	Variables(X(:weight), Y(:height), Y(:age)),
	Elements(Points(X, Y, Legend(3)))
);

rep = gb << report;
fbs = rep << XPath("//FrameBox");

fbs[1] << Add Graphics Script(
	Transparency(0.5);
	Fill Color("Gray");
	Rect(100, Y Origin() + Y Range(), 120, Y Origin(), 1);
);

fbs[2] << Add Graphics Script(
	Transparency(0.5);
	Fill Color("Green");
	Rect(100, Y Origin() + Y Range(), 120, Y Origin(), 1);
);

jthi_0-1726835169724.png

 

-Jarmo