cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Discussions

Solve problems, and share tips and tricks with other JMP users.
Choose Language Hide Translation Bar
SpannerHead
Level VI

Automatically Add Reference Lines to Graph Builder

I have a graph created by graph builder and a column in the data contains a constant value that I'd like to automatically add as a reference line to the graph.  Adding the column to the plot axis gives me something (green vertical below) but it's not great looking, any better ideas? 

 

SpannerHead_0-1777923121481.png

 


Slán



SpannerHead
3 REPLIES 3
txnelson
Super User

Re: Automatically Add Reference Lines to Graph Builder

Here is a simple example that draws a reference line based upon the value of row 1 from column Weight

txnelson_0-1777928150565.png


Graph Builder(
	Variables( X( :weight ), Y( :height ) ),
	Elements( Points( X, Y, Legend( 6 ) ), Smoother( X, Y, Legend( 7 ) ) ),
	SendToReport(
		Dispatch( {}, {:weight}, ScaleBox,
			{Add Ref Line( 95, "Solid", "Red", "", 1 )}
		),
		Dispatch( {}, "Graph Builder", FrameBox,
			{Add Graphics Script(
				2,
				Description( "" ),
				rp = Current Report();
				rp[axis box( 1 )] << add ref line( :weight[1], "solid", red );
			)}
		)
	)
);

I produced the complete JSL by right clicking on the graph and selecting Customize.  Then clicking on the "+" and writing the simple script

rp=current report();
rp[axis box(1)] << add ref line(:weight[1],"solid",red)

txnelson_1-1777928331410.png

After applying the little script, I went back to the red triangle in the graph, and saved the script to a script window.

Jim
DBarton
Level I

Re: Automatically Add Reference Lines to Graph Builder

I have a similar question, but I want to write new axis titles for X- and y-axis.  I tried to use this script addition below and few other versions but nothing would override the axis titles just taken from Column Titles.  

rp = Current Report();
rp[AxisBox( 1 )] << Set Title( "Conversion % at 160C" );

\\another version
Dispatch( {}, "Mean(BuOH Conversion Predicted_60hr, 160)", TextEditBox,
{Set Text( "Conversion % at 160C" )})
 
txnelson
Super User

Re: Automatically Add Reference Lines to Graph Builder

Interactively run create your graph.  Make the changes to the X and Y axis labels.  Then go to the red triangle and select Save Script and save it to a Script Window.  The script that will be displayed will show what you need to do to change the X and Y axis labels.

Jim

Recommended Articles