cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Don’t miss your chance to experience Discovery Summit Europe at our best available rate! Early bird registration through 31 Oct.
  • Graph Builder Toolbar streamlines interactive graphing. Creates shortcuts on Report and GraphBuilder Helpers toolbars. Download and install the extension.
  • JMP will suspend normal business operations for our Rest and Recharge Day on Friday, October 2, 2026.
    Regular business hours will resume on Monday, October 5, 2026.

Discussions

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

Can the vertical dividing line of the X-axis in the drawing only show part of it?

Thanks Experts!

dt=Open("$SAMPLE_DATA/Big Class.jmp");
p1=dt<< Graph Builder(
	Size( 534, 455 ),
	Show Control Panel( 0 ),
	Variables(
		X( Transform Column( "Row", Formula( Row() ) ) ),
		Y( :height ),
		Y( :weight )
	),
	Elements( Position( 1, 1 ), Line( X, Y, Legend( 5 ) ) ),
	Elements( Position( 1, 2 ), Bar( X, Y, Legend( 7 ) ) ),
	SendToReport(
		Dispatch(
			{},
			"Row",
			ScaleBox,
			{Add Ref Line( 10.5, "Dotted", "Dark Red", "", 1 ),
			Add Ref Line( 20.5, "Dotted", "Dark Red", "", 1 ),
			Add Ref Line( 30.5, "Dotted", "Dark Red", "", 1 )}
		)
	)
);

2025-05-12_10-53-24.png

14 REPLIES 14
jthi
Super User

Re: Can the vertical dividing line of the X-axis in the drawing only show part of it?

I would suggest utilizing X/Y Origin() and X/Y Range() in cases like this

Names Default To Here(1);

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

dt << new column("R", Numeric, Continuous, Formula(Row()));

ar4 = [12.5, 22.5, 33.5];

gb = dt << Graph Builder(
	Size(534, 456),
	Show Control Panel(0),
	Variables(X(:R), Y(:height), Y(:weight)),
	Elements(Position(1, 1), Line(X, Y, Legend(11))),
	Elements(Position(1, 2), Bar(X, Y, Legend(14)))
);

Eval(EvalExpr(
	Report(gb)[FrameBox(2)] << Add Graphics Script(
		For Each({v}, Expr(ar4),
			Pen Color("red");
			Line Style("dashed");
			Line({v, Y Origin()}, {v, Y Origin() + Y Range()});
		);
	)
));
-Jarmo
Xinghua
Level III

Re: Can the vertical dividing line of the X-axis in the drawing only show part of it?

After running the code, the chart appears, but an error message is displayed. Log:

 

Name Unresolved: For Each in access or evaluation of 'For Each' , For Each(
{v},
[12.5, 22.5, 33.5],
Pen Color( "red" );
Line Style( "dashed" );
Line( {v, Y Origin()}, {v, Y Origin() + Y Range()} );
) /*###*/

txnelson
Super User

Re: Can the vertical dividing line of the X-axis in the drawing only show part of it?

What version of JMP are you using.  For each() was first implemented in JMP 16

Here is a version of the code that will work for JMP 15 and earlier

Names Default To Here( 1 );

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

dt << New Column( "R", Numeric, Continuous, Formula( Row() ) );

ar4 = [12.5, 22.5, 33.5];

gb = dt << Graph Builder(
	Size( 534, 456 ),
	Show Control Panel( 0 ),
	Variables( X( :R ), Y( :height ), Y( :weight ) ),
	Elements( Position( 1, 1 ), Line( X, Y, Legend( 11 ) ) ),
	Elements( Position( 1, 2 ), Bar( X, Y, Legend( 14 ) ) )
);

Eval(
	Eval Expr(
		Report( gb )[FrameBox( 2 )] << Add Graphics Script(
			For( i = 1, i <= N Items( ar4 ), i++,
				v = ar4[i];
				Pen Color( "red" );
				Line Style( "dashed" );
				Line( {v, Y Origin()}, {v, Y Origin() + Y Range()} );
			)
		)
	)
);
Jim
Xinghua
Level III

Re: Can the vertical dividing line of the X-axis in the drawing only show part of it?

V14.3, it is too old...

txnelson
Super User

Re: Can the vertical dividing line of the X-axis in the drawing only show part of it?

JMP 14 was released in March of 2018.  Yes, it is pretty old.  However, The code I provided works in JMP 14

Jim

Recommended Articles