cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Browse apps to extend the software in the new JMP Marketplace
Choose Language Hide Translation Bar
miguello
Level VI

How to add reference line if you don't know what column you will use

I'm stuck at a seemingly simple task.

 

I plot a Graph Builder where my Y axis isn't known yet, it's provided as a variable.

So what do I put in here instead of MyYVariable to draw a reference line regardless of what's on Y axis?

			Dispatch(
			{},
			"MyYVariable",
			ScaleBox,
			{Add Ref Line(
				0.1,
				"Dotted",
				"Medium Dark Green",
				"0.1",
				3,
				1,
				Label Settings( {Label Color( "Green" )} )
			), Label Row(
				{Label Orientation( "Vertical" ), Set Font( "OCR A Extended" )}
			)}
		)

Clarification:

Right now I'm doing that like this:

gbr = gb<<Report;
gbr[axis box( 2 )] << Add Ref Line(
				0.1,
				"Dotted",
				"Medium Dark Green",
				"0.1",
				3,
				1,
				Label Settings( {Label Color( "Green" )} )
			);

but I was wondering if I could do it in the same expression as the GraphBuilder, as I asked.

1 ACCEPTED SOLUTION

Accepted Solutions
jthi
Super User

Re: How to add reference line if you don't know what column you will use

Is the something wrong with your option2? If you are building graph builder, you should know column names and then you could most likely use  Insert one expression into another using Eval Insert, Eval Expr, Parse, and Substitute or similar method to add the "name" there.

Names Default To Here(1);

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

y_var = Column(dt, "height");

gb_expr = EvalExpr(gb = dt << Graph Builder(
	Variables(Y(Expr(y_var))),
	Elements(Points(Y, Legend(4))),
	SendToReport(
		Dispatch(
			{},
			Expr(y_var << get name),
			ScaleBox,
			{Add Ref Line(63.858764556962, "Solid", "Black", "", 1)}
		)
	)
));

show(gb_expr);

eval(gb_expr);
-Jarmo

View solution in original post

2 REPLIES 2
jthi
Super User

Re: How to add reference line if you don't know what column you will use

Is the something wrong with your option2? If you are building graph builder, you should know column names and then you could most likely use  Insert one expression into another using Eval Insert, Eval Expr, Parse, and Substitute or similar method to add the "name" there.

Names Default To Here(1);

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

y_var = Column(dt, "height");

gb_expr = EvalExpr(gb = dt << Graph Builder(
	Variables(Y(Expr(y_var))),
	Elements(Points(Y, Legend(4))),
	SendToReport(
		Dispatch(
			{},
			Expr(y_var << get name),
			ScaleBox,
			{Add Ref Line(63.858764556962, "Solid", "Black", "", 1)}
		)
	)
));

show(gb_expr);

eval(gb_expr);
-Jarmo
miguello
Level VI

Re: How to add reference line if you don't know what column you will use

Nothing wrong with neither mine or yours, I was just hoping that there is a generic way of doing that. Use case: I model GB using graph builder first, where I set up all the reference lines, and ideally just would copy the script. But now I need to delete that part and write it separately as my solution, or tweak it as in your solution.

Anyways, thanks for the input!