XYchart tooltip and Mouseevent

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
jonnycolt74
Posts: 1
Joined: Tue Mar 18, 2003 11:37 pm

XYchart tooltip and Mouseevent

Post by jonnycolt74 » Tue Mar 18, 2003 11:56 pm

Hi,

I'd like to thank you guys for a great product.

I have two problems:

1- when I put the mouse on a point in the XY chart I get a tool Tip which shows the X Y coordinates. I am dealing with very small numbers (up to 10 decimal places) and Jfreechart seems to round these numbers in the tool tip and hence I always get x:0 , y:0 .
How can I increase the precision of these numbers in the tool tip?
How do I decrease the time taken to show the tool tip (i.e. I'd like it instantly)?


2- I am using XY chart and I would like to get the coordinates of a point when I click on it as well as the corresponding XY series number (or name).
I will then uses these coordinates to perform another procedure.

Thank you in advance

Jonny

david.gilbert
JFreeChart Project Leader
Posts: 11734
Joined: Fri Mar 14, 2003 10:29 am
antibot: No, of course not.
Contact:

Re: XYchart tooltip and Mouseevent

Post by david.gilbert » Wed Mar 19, 2003 12:06 am

jonnycolt74 wrote:1- when I put the mouse on a point in the XY chart I get a tool Tip which shows the X Y coordinates. I am dealing with very small numbers (up to 10 decimal places) and Jfreechart seems to round these numbers in the tool tip and hence I always get x:0 , y:0 .
How can I increase the precision of these numbers in the tool tip?
How do I decrease the time taken to show the tool tip (i.e. I'd like it instantly)?
Use this constructor for the StandardXYToolTipGenerator:

Code: Select all

public StandardXYToolTipGenerator(NumberFormat xFormat, NumberFormat yFormat);
Just create a new tool tip generator to replace the existing one in the plot's renderer.
jonnycolt74 wrote:2- I am using XY chart and I would like to get the coordinates of a point when I click on it as well as the corresponding XY series number (or name).
I will then uses these coordinates to perform another procedure.
You need to write a class that implements the ChartMouseListener interface, then add the listener to the ChartPanel class. The ChartMouseEvent will return the information you require.

Regards,

Dave Gilbert

Locked