Having Small Color Ball Along Graph Line While Mouse Move

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
yccheok
Posts: 48
Joined: Mon Feb 16, 2009 4:58 am

Having Small Color Ball Along Graph Line While Mouse Move

Post by yccheok » Sat Oct 17, 2009 4:53 am

By using JFreeChart, is it possible that to have a small color ball effect, when my mouse move over the graph line :

http://www.google.com/finance?q=MSFT (See the blue small ball, when you move the mouse over the graph line)

If yes, is there any demo or hints to get start implement this feature?

Thanks!

remiohead
Posts: 201
Joined: Fri Oct 02, 2009 3:53 pm
antibot: No, of course not.

Re: Having Small Color Ball Along Graph Line While Mouse Move

Post by remiohead » Mon Oct 19, 2009 2:13 pm

You'll have to use a MouseMotionListener on the chart panel and map the x co-ordinate to a category value. Its then just a matter of painting the marker on the chart at the appropriate position for the data point value. Don't think it would be very difficult.

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

Re: Having Small Color Ball Along Graph Line While Mouse Move

Post by david.gilbert » Mon Oct 19, 2009 7:29 pm

I did this for a client using the Overlay feature. I don't have any code that I can share right now.
David Gilbert
JFreeChart Project Leader

:idea: Read my blog
:idea: Support JFree via the Github sponsorship program

yccheok
Posts: 48
Joined: Mon Feb 16, 2009 4:58 am

Re: Having Small Color Ball Along Graph Line While Mouse Move

Post by yccheok » Wed Jan 13, 2010 5:08 pm

Dear david.gilbert,

I follow up your blog and I saw something exciting :

http://www.jroller.com/dgilbert/?page=2 (JFreeChart and JXLayer)

I want to say WOW. and I would like to apply the same technique (JXLayer) for CrossHair implementation.

I thought I need CrossHairUI, which its functionality will be similar to MagnifierUI.

Am I in the right direction?

Thanks!

yccheok
Posts: 48
Joined: Mon Feb 16, 2009 4:58 am

Re: Having Small Color Ball Along Graph Line While Mouse Move

Post by yccheok » Wed Jan 13, 2010 6:54 pm

My plan to work on this feature is as follow :

Image

yccheok
Posts: 48
Joined: Mon Feb 16, 2009 4:58 am

Re: Having Small Color Ball Along Graph Line While Mouse Move

Post by yccheok » Sat Jan 30, 2010 6:27 pm

I was able to implement the feature "having small color ball along graph line while mouse move"

We are using binary search to located the nearest point.

Take a look if you are interested ;

http://jstock.cvs.sourceforge.net/viewv ... iew=markup
http://jstock.cvs.sourceforge.net/viewv ... iew=markup

Image

comir
Posts: 8
Joined: Sat Jun 16, 2012 3:55 am
antibot: No, of course not.
Location: Indonesia
Contact:

Re: Having Small Color Ball Along Graph Line While Mouse Mov

Post by comir » Wed Jul 11, 2012 4:20 am

Image

Can you share code here to make chart like above . . .

Locked