ChartMouseEvent#getEntity() and multiple series

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
blueser
Posts: 23
Joined: Wed Sep 14, 2005 5:05 pm

ChartMouseEvent#getEntity() and multiple series

Post by blueser » Mon Jul 16, 2007 9:01 pm

Hi,

if I receive a ChartMouseEvent for a coordinate where there are n data points (from n different series), which entity is returned by getEntity()? The "top" one (i.e. the last one rendered)? Is there any way to get a list of entities hit by the click?

TIA

Andre

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

Post by david.gilbert » Tue Jul 17, 2007 11:28 am

I think it returns that last item drawn at that location. If you modify the mouseClicked() method in the ChartPanel class, you could probably have it return all entities under the mouse pointer. Someone else has asked about this before, but I haven't yet spent any time reviewing it...it sounds like a sensible enhancement though.
David Gilbert
JFreeChart Project Leader

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

blueser
Posts: 23
Joined: Wed Sep 14, 2005 5:05 pm

Post by blueser » Tue Jul 17, 2007 12:59 pm

Hi David, thks for the reply.

Yes, please consider this for future versions :) Maybe you could add a List<ChartEntity> getEntities() method that would deprecate the current ChartEntity getEntity() method... (just a thought)

Regards,

Andre

Locked