BookmarkSubscribe
Choose Language Hide Translation Bar

Simulate Mouse Clicks on a Chart

Hi - I've created a chart which responds to mouse clicks in a number of ways; that is, several areas of the chart are clickable, and the mouse clicks are detected using the mousetrap functionality within the chart, and interpreted accordingly.  I now want to "pre-record" a sequence of mouse clicks to show in a demo what the effects of a specific sequence of mouse clicks are.  Is it possible to simulate the effect of clicking on a specific pair of {x, y} coordinates on a chart, in the same sort of way that a click can be sent to a button box by using the << click() property?

Many thanks

0 Kudos
4 REPLIES 4
dqr2
Community Trekker

Re: Simulate Mouse Clicks on a Chart

Hi - I came across the above query when searching for material on simulating mouse clicks on a chart, because I would like to do precisely this.  The original question goes way back to 2012, and was unanswered - but with several new JMP releases in the intervening years, I was wondering if a mechanism has been created to do such a thing since then.  I've created an interactive display within a graph box, and would like if possible to pre-record a series of actions performed on it for a demo.

 

Many thanks.

0 Kudos
vince_faller
Super User

Re: Simulate Mouse Clicks on a Chart

Mousetrap sounds like it's exactly what you want. 

 

New Window( "Example",
	exx = 20,
	exy = 50;
	Graph Box(
		Frame Size( 200, 200 ),
		Mousetrap(
			exx = x;
			exy = y;
		);
		Circle( {0, 0}, Sqrt( exx * exx + exy * exy ) );
	);
);
Vince Faller - Predictum
0 Kudos
vince_faller
Super User

Re: Simulate Mouse Clicks on a Chart

And as soon as I posted this I realized you said simulate, not capture.
Vince Faller - Predictum
0 Kudos
dqr2
Community Trekker

Re: Simulate Mouse Clicks on a Chart

No worries - and I've actually worked out how to do what I want in the meantime. All I need to do is to bundle up everything within the mousetrap function into an expression which I define elsewhere, and then just call that expression as many times as I need from the button which runs the animation, each time setting the values of x and y (which would otherwise be defined by the mouse click) beforehand. I've just finished writing it, and it works perfectly.


Many thanks for your help!

0 Kudos