Is there a way to get the x,y coordinates of the mouse on the plot from a ChartMouseEvent? Basically, I'm trying to show the x,y value on a label somewhere else based on where the mouse is. I only need to do this on mouse clicks.
thanks,
Jeff
Getting plot value from mouse
Getting plot value from mouse
Jeff Storey, Software Developer
http://jeffastorey.blogspot.com
http://jeffastorey.blogspot.com
-
- JFreeChart Project Leader
- Posts: 11734
- Joined: Fri Mar 14, 2003 10:29 am
- antibot: No, of course not.
- Contact:
Re: Getting plot value from mouse
One of the MouseListenerDemo programs does this calculation. You can use the java2dToValue() methods in the axis classes, passing in the dataArea used by the ChartPanel (bearing in mind that it might have been subjected to scaling before drawing on screen - see the getMin/MaxDrawingWidth/Height() methods in the ChartPanel class.
David Gilbert
JFreeChart Project Leader
Read my blog
Support JFree via the Github sponsorship program
JFreeChart Project Leader

