I'm using jchart2D library to plot functions. I need to get cursor coordinates. That question was asked already here. When I add MouseMotionListener to Chart2D, it gives location of cursor in pixels (but not coordinates). getNearestPoint function also doesn't work because it finds Point which is in Trace
Asked
Active
Viewed 294 times
1 Answers
1
-
I guess it works for jfreechart library. But unfortunately I didn't find any analog of CharMouseListener in jchart2d. – lnk Feb 03 '14 at 14:55
-
Oops, sorry. You'll need to do linear interpolation, as shown [here](http://stackoverflow.com/a/2901472/230513). Are you using `net.sourceforge.chart2d.Chart2D` or `info.monitorenter.gui.chart.Chart2D`? – trashgod Feb 03 '14 at 15:40
-
I am using info.monitorenter.gui.chart.Chart2D. I can't figure out how your link can help me. – lnk Feb 03 '14 at 20:02
-
1Ah, two different libraries; I've updated the [tag:jchart2d] tag. You'll have to [interpolate](http://en.wikipedia.org/wiki/Linear_interpolation) the mouse coordinates to derive model coordinates, and vice-versa. – trashgod Feb 03 '14 at 21:47
-
I see. For this I need location of the origin of axes. – lnk Feb 04 '14 at 14:22