cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Register to attend Discovery Summit 2025 Online: Early Users Edition, Sept. 24-25.
  • New JMP features coming to desktops everywhere this September. Sign up to learn more at jmp.com/launch.
Choose Language Hide Translation Bar
lala
This widget could not be displayed.
" alt = "Level IX"/> lala
Level IX

How to add a connection between the first point and the last point in this diagram?

Thanks Experts!

dt=Open("$SAMPLE_DATA/Big Class.jmp");
Graph Builder(
	Variables( X( Transform Column( "Row", Formula( Row() ) ) ), Y( :weight ) ),
	Elements( Points( X, Y, Legend( 6 ) ) ),
	SendToReport(
		Dispatch(
			{},
			"400",
			ScaleBox,
			{Legend Model(
				6,
				Properties( 0, {Marker Size( 2 )}, Item ID( "weight", 1 ) )
			)}
		)
	)
)

2025-06-26_20-40-30.png

4 REPLIES 4
jthi
Super User

Re: How to add a connection between the first point and the last point in this diagram?

Names Default To Here(1);

dt = Open("$SAMPLE_DATA/Big Class.jmp");
gb = dt << Graph Builder(
	Variables(X(Transform Column("Row", Formula(Row()))), Y(:weight)),
	Elements(Points(X, Y, Legend(6))),
	SendToReport(
		Dispatch({}, "400", ScaleBox,
			{Legend Model(6, Properties(0, {Marker Size(2)}, Item ID("weight", 1)))}
		)
	)
);


fb = Report(gb)[FrameBox(1)];
ms = fb << Find Seg(MarkerSeg(1));
xs = ms << Get X Values;
ys = ms << Get Y Values;

fb << Add Graphics Script(
	Line({xs[1], ys[1]}, {xs[N Items(xs)], ys[N Items(ys)]})
);
-Jarmo
hogi
This widget could not be displayed.
" alt = "Level XII"/> hogi
Level XII

Re: How to add a connection between the first point and the last point in this diagram?

Via right Click you can add a Transform Column to Graph Builder

hogi_3-1750974170314.png

 Use it to keep the first and last data point.
Then use the Line Plot to connect the 2 points.

if you don't want to see the lines between the original data points,

hogi_0-1750974019508.png
you can disable them:

hogi_1-1750974047249.png

 

The final graph:

hogi_2-1750974067785.png

Names Default To Here(1);

dt = Open("$SAMPLE_DATA/Big Class.jmp");
Graph Builder(
	Transform Column(
		"Transform[weight]",
		Formula( If( Row() == 1 | Row() == N Rows(), :weight ) )
	),
	Transform Column( "Row", Formula( Row() ) ),

	Variables( X( :Row ), Y( :weight ), Y( :"Transform[weight]"n, Position( 1 ) ) ),
	Elements( Points( X, Y( 1 ), Y( 2 ), Legend( 6 ) ), Line( X, Y( 2 ) ) )
);  

 

lala
This widget could not be displayed.
" alt = "Level IX"/> lala
Level IX

Re: How to add a connection between the first point and the last point in this diagram?

dt = Open("$SAMPLE_DATA/Big Class.jmp");
Graph Builder(
	Transform Column(
		"Transform[weight]",
		Formula( If( Row() == 1 | Row() == N Rows(), :weight ) )
	),
	Transform Column( "Row", Formula( Row() ) ),
	Size( 570, 698 ),
	Variables( X( :Row ), Y( :weight ), Y( :"Transform[weight]"n, Position( 1 ) ) ),
	Elements(
		Points( X, Y( 1 ), Y( 2 ), Legend( 1 ) ),
		Smoother( X, Y( 2 ), Legend( 5 ) )
	),
	SendToReport( Dispatch( {"Smoother"}, "", OutlineBox, {Close( 0 )} ) )
);

Thanks!

hogi
This widget could not be displayed.
" alt = "Level XII"/> hogi
Level XII

Re: How to add a connection between the first point and the last point in this diagram?

Yes, with two points, instead of Line, one can also use Smoother to connect the points.
The trick is again to use a Transform Column to dynamically generate the additional information (first an last point?).

 

Transform Column + checkmarks in the Variables menu: I love it!

Here, the line is a standard plot "element" and shows up in the legend.
This is why I prefer to use Transform Columns compared to other approaches / workarounds.

With the interactive capabilities of Graph builder, for colleagues without the knowledge about the plumbing layer in the background, it just behaves like any other plot element:

It can be selected and it's settings can be adjusted via the legend menu.

 

Actually, it doesn't behave EXACTLY like any other plot element.
Just add a Column switch - and it will behave "strange" / "surprisingly" for users who don't know the details on the plumbing layer.
If the user switches to "height" - the Transform Column will NOT:

Column Switcher + Transform Columns is a wish that addresses this interplay between column switcher and Transform Columns.

 

For this special case here, one can fix the issue easily - by generating a Transform Column for the X values instead of the Y values.
In general, it takes some effort (e.g. a column switch handler an an additional table variable: Colour Plots by Pass and Fail) to fix the interplay between Column Switcher and Transform Columns in the current version of JMP.


 

On the other extreme, for users with access / knowledge to the plumbing layer, there are other restrictions:
With some tinyimprovements for Transform Column the framework could made much more powerful!

 

Recommended Articles