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
Level VIII

How to dynamically change the vertical line of the X-axis?

I draw the graph like this, and then loop it once every minute. The requirement is that the vertical line of the X-axis can be changed according to the value of the specified variable
Thanks Experts!
2025-06-25_14-33-47.png

a=26;
dt=Open("$SAMPLE_DATA/Big Class.jmp");
ca="r";New Column(ca);
p1=dt<< Graph Builder(
	Variables( X( Transform Column( "Row", Formula( Row() ) ) ), Y( :height ) ),
	Elements( Line( X, Y, Legend( 5 ) ) ),
	SendToReport(
		Dispatch(
			{},
			"Row",
			ScaleBox,
			{Add Ref Line( a, "Dotted", "Medium Light Red", "", 1 )}
		)
	)
);
While( 1,
a=Random Integer(1, 40);//Column(ca)<<Formula( if(row()==a,row()) );dt<<run formulas;Column(ca)<<deleteFormula;
Wait( 60 );
);
1 ACCEPTED SOLUTION

Accepted Solutions
jthi
Super User

Re: How to dynamically change the vertical line of the X-axis?

You might have to add it to all of the frameboxes (Wrap / X Group / Y Group do create multiple)

Names Default To Here(1);

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

gb = dt << Graph Builder(
	Transform Column("Row", Formula(Row())),
	Size(525, 496),
	Show Control Panel(0),
	Variables(X(:Row), Y(:height), Wrap(:age)),
	Elements(Line(X, Y, Legend(5)))
);


fbs = Report(gb) << XPath("//FrameBox");
fbs << Add Graphics Script(
	Pen Size(2);
	V Line(a);
);

For(i = 1, i <= 10, i++,
	a = Random Integer(1, 40); // could also use table variable
	Wait(0.5);
	Report(gb) << Inval;
	Report(gb) << Update Window;
);

Write();
-Jarmo

View solution in original post

6 REPLIES 6
lala
Level VIII

回复: How to dynamically change the vertical line of the X-axis?

OK

gb_report = p1 << Report; 
axisbox = gb_report[Axis Box( 1 )]; 

While( 1,
	axisbox << Remove Ref Line( a ); 
	a = Random Integer( 1, 40 ); 
	axisbox << Add Ref Line( a, "Dotted", "Medium Light Red", "", 1 ); 
	Wait( 2 ); 
);
lala
Level VIII

回复: How to dynamically change the vertical line of the X-axis?

It seems that encountering an overlap like wrap is not that simple

2025-06-25_15-55-22.png

jthi
Super User

Re: How to dynamically change the vertical line of the X-axis?

Use Graphic Script with "global" variable

Names Default To Here(1);

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

gb = dt << Graph Builder(
	Variables(X(Transform Column("Row", Formula(Row()))), Y(:height)),
	Elements(Line(X, Y, Legend(5)))
);

Report(gb)[FrameBox(1)] << Add Graphics Script(
	Pen Size(2);
	V Line(a);
);

For(i = 1, i <= 10, i++,
	a = Random Integer(1, 40); // could also use table variable
	Wait(0.5);
	Report(gb) << Inval;
	Report(gb) << Update Window;
);

Write();
-Jarmo
lala
Level VIII

Re: How to dynamically change the vertical line of the X-axis?

When it comes to practical examples, I still don't know.

 

The graph overlapped with wrap

The other effects originally set have disappeared and no vertical lines have appeared either.

2025-06-25_16-39-06.png

lala
Level VIII

Re: How to dynamically change the vertical line of the X-axis?

only one Thanks!2025-06-25_22-15-31.png

jthi
Super User

Re: How to dynamically change the vertical line of the X-axis?

You might have to add it to all of the frameboxes (Wrap / X Group / Y Group do create multiple)

Names Default To Here(1);

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

gb = dt << Graph Builder(
	Transform Column("Row", Formula(Row())),
	Size(525, 496),
	Show Control Panel(0),
	Variables(X(:Row), Y(:height), Wrap(:age)),
	Elements(Line(X, Y, Legend(5)))
);


fbs = Report(gb) << XPath("//FrameBox");
fbs << Add Graphics Script(
	Pen Size(2);
	V Line(a);
);

For(i = 1, i <= 10, i++,
	a = Random Integer(1, 40); // could also use table variable
	Wait(0.5);
	Report(gb) << Inval;
	Report(gb) << Update Window;
);

Write();
-Jarmo

Recommended Articles