How to get actual plot location on click?

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
mykbaker
Posts: 2
Joined: Tue Apr 20, 2010 5:41 pm
antibot: No, of course not.

How to get actual plot location on click?

Post by mykbaker » Tue Apr 20, 2010 5:54 pm

I need to be able to get the plot coordinates when the user right clicks on the plot. It seems pretty easy to get the coordinates for the nearest point, but is there an way to get the click location?

gengar
Posts: 26
Joined: Thu Mar 18, 2010 12:28 am
antibot: No, of course not.

Re: How to get actual plot location on click?

Post by gengar » Tue Apr 20, 2010 8:33 pm

How did you get the nearest point?

mykbaker
Posts: 2
Joined: Tue Apr 20, 2010 5:41 pm
antibot: No, of course not.

Re: How to get actual plot location on click?

Post by mykbaker » Tue Apr 20, 2010 9:01 pm

You can get the nearest point by using plot.getDomainCrosshairValue() and plot.getRangeCrosshairValue().

gengar
Posts: 26
Joined: Thu Mar 18, 2010 12:28 am
antibot: No, of course not.

Re: How to get actual plot location on click?

Post by gengar » Wed Apr 21, 2010 12:48 am

haha.... I thought you weren't using crosshairs... :D
If you are using crosshair, then just set the the crosshair not to lock on data points for both domain and range and you will get the exact location of the point clicked.

http://www.jfree.org/jfreechart/api/jav ... a(boolean)

alacret
Posts: 1
Joined: Tue Nov 16, 2010 2:26 pm
antibot: No, of course not.

Re: How to get actual plot location on click?

Post by alacret » Tue Nov 16, 2010 7:48 pm

that seem to easy, and what if i have several curves, lets say 5 to 10 curves, how do i get the nearest point in each curve?

Locked