cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
JMP is taking Discovery online, April 16 and 18. Register today and join us for interactive sessions featuring popular presentation topics, networking, and discussions with the experts.
Choose Language Hide Translation Bar
Sage
Level I

Adding a Value to End of Trend Line

Sage_0-1597910618429.png

I have a set marker at 1800 RFh and my trend line shows that at the end of this reporting period, I have cross and passed the mark.

However, how can I add a value at the end of the trend line to show the calculated value by JMP? Assuming Lamda is default.

1 ACCEPTED SOLUTION

Accepted Solutions
gzmorgan0
Super User (Alumni)

Re: Adding a Value to End of Trend Line

@Sage ,

 

JMP platforms are the options found under analysis and graphs. For example Fit Y by X with both continuous Y and X is called Bivariate; continuous Y and nominal X is called Oneway, or as documented in my post GraphBuilder.  Your graph looked like a trend or time series. So I was stating I could not determine how you created the graph in your original post.

 

The JMP messgages (commands) to save the values or formula of the smoothed curve can be different for diifferent platforms.  If you save the script (inverted red triangle option) for your graph to the script window and post it, then a script that would work for your graph could be provided.   Don't forget to change names or values that might contain proprietary information before posting.

View solution in original post

3 REPLIES 3
gzmorgan0
Super User (Alumni)

Re: Adding a Value to End of Trend Line

@Sage ,

 

I cannot detect which platform you are using.  Here is as script that adds the last value of a smoother from the GraphBuilder platform.  The key here is to save the smoother values to the data table, you can delete that new smoother values column later. It takes a few steps to find the last value, extend the x-axis and add the text.


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

gb = dt << Graph Builder(
	Variables( X( :height ), Y( :weight ) ),
	Elements( Points( X, Y, Legend( 1 ) ), Smoother( X, Y, Legend( 2 ) ) )
);

//get row where max X
xmax = Col Max( :height );
idx = (dt << get rows where( :height == xmax ))[1];
gbb = Report( gb )[Graph Builder Box( 1 )];
Wait( 0.5 );

//smoother is the second element, save to the data table gbb << Update Element( 1, 1, 2, {Save Formula} ); //smoother is in the last col lastVal = Round( Column( dt, N Col( dt ) )[idx], 2 ); // here is the tricky part, if you want to annotate this to teh right of xmax you need to extend the x axis gb_x = gbb[GraphBuilderAxisBox( 1 )]; xaxis_inc = gb_x << get inc; xaxis_max = gb_x << get max; //add a half inc ?? arbitrary gb_x << Max( xaxis_max + 0.5 * xaxis_inc ); Eval( Eval Expr( gbb[FrameBox( 1 )] << Add Graphics Script( Text Font( "Arial", 10, "Bold" ); Text Color( "Red" ); Text( {Expr( xmax + 0.1 * xaxis_inc ), Expr( lastVal )}, Expr( Char( lastVal ) ) ); ) ) );

image.png

Sage
Level I

Re: Adding a Value to End of Trend Line

Thanks! 

Let me play around and figure out. Haven't attended JMP course yet due to Covid-19.

By platform, what do you mean? I'm using version 15.1

gzmorgan0
Super User (Alumni)

Re: Adding a Value to End of Trend Line

@Sage ,

 

JMP platforms are the options found under analysis and graphs. For example Fit Y by X with both continuous Y and X is called Bivariate; continuous Y and nominal X is called Oneway, or as documented in my post GraphBuilder.  Your graph looked like a trend or time series. So I was stating I could not determine how you created the graph in your original post.

 

The JMP messgages (commands) to save the values or formula of the smoothed curve can be different for diifferent platforms.  If you save the script (inverted red triangle option) for your graph to the script window and post it, then a script that would work for your graph could be provided.   Don't forget to change names or values that might contain proprietary information before posting.