cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar

How would I Update a predetermined reference line in JSL Graph Builder

I'm new to JMP and scripting, and currently using JMP 17. I inherited a JMP file that has data and a script for visualizing (in line trends mostly) the data. I was asked to update the file with new data and get the trending aligned, but the script uses reference variables that seem to have built-in values (highlighted in red), since a set of values matching "[1, 2, 3] pops up when hovering over xxy:

 

"Graph Builder",
						FrameBox,
						{Add Graphics Script(
							3,
							Description( "+3SD" ),
							Line Style( 0 );
							Pen Color( "dark gray" );
							Pen Size( 2 );
							If( Is Empty( xxy ),
								xxy = [1, 2, 3];
								yyz = [4, 5, 6];
							);
							Drag Line( xxy, yyz );
						),

Even if I change the values for [1, 2, 3] in the line that follows, the graph still shows the original reference line when the script runs. How would I go about updating the reference lines to incorporate the new data? I'm sure this problem stems from my lack of understanding the basics of scripting in JSL, but any help would be appreciated. 

1 ACCEPTED SOLUTION

Accepted Solutions
jthi
Super User

Re: How would I Update a predetermined reference line in JSL Graph Builder

Values seem to get updated just fine for me in this script

Names Default To Here(1); 

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

gb = dt << Graph Builder(
	Variables(X(:weight), Y(:height), Overlay(:sex)),
	Elements(Points(X, Y, Legend(9)), Line Of Fit(X, Y, Legend(11)))
);

Report(gb)[FrameBox(1)] << Add Graphics Script(
	If(IsEmpty(exx) | Is Missing(exx),
		exx = [60 70 80];
		exy = [75 70 55];
	);
	Drag Line(
		exx, 
		exy		
	);
	show(exx, exy);
);	

Is there a specific need to use Drag Line and not just H Line / Line?

-Jarmo

View solution in original post

2 REPLIES 2
jthi
Super User

Re: How would I Update a predetermined reference line in JSL Graph Builder

Values seem to get updated just fine for me in this script

Names Default To Here(1); 

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

gb = dt << Graph Builder(
	Variables(X(:weight), Y(:height), Overlay(:sex)),
	Elements(Points(X, Y, Legend(9)), Line Of Fit(X, Y, Legend(11)))
);

Report(gb)[FrameBox(1)] << Add Graphics Script(
	If(IsEmpty(exx) | Is Missing(exx),
		exx = [60 70 80];
		exy = [75 70 55];
	);
	Drag Line(
		exx, 
		exy		
	);
	show(exx, exy);
);	

Is there a specific need to use Drag Line and not just H Line / Line?

-Jarmo

Re: How would I Update a predetermined reference line in JSL Graph Builder

This helped!

 

I'm still unsure how the original creator included an inherent value for the (seemingly) random reference names, but I just went the route of deleting the original reference names and typing in new ones - to the effect of exx/exy as examples. With new references that actually had "empty" values, IsEmpty worked with changing the proceeding values.

 


Is there a specific need to use Drag Line and not just H Line / Line?


Since I just inherited the files and was told to update them, I'm not clear on the reasonings yet for everything. Personally, I don't like Drag Line so far (and can't figure out how to undo when accidentally dragging and changing a line). There's a good chance I'll be removing this from the script.

 

Thank you!