Get selected DataItem?

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
kaupov
Posts: 2
Joined: Sun Dec 09, 2007 8:50 pm

Get selected DataItem?

Post by kaupov » Wed Feb 06, 2008 2:00 pm

I have ChartPanel with XYPlot. I need to get the selected DataItem to do something useful with it.
My problem is that:

Code: Select all

ChartEntity entity = event.getEntity();
wants that I select the item very PRECISELY and it gives NULL if I miss it even a little.

On the other hand the anchor moves always to the right place. How can I get the DataItem that is connected with the anchor,
The code:

Code: Select all

this.getComponentAt((int)this.getAnchor().getX(),(int)this.getAnchor().getY())
won't work and gives me only the ChartPanel itself.

Wetzerk
Posts: 14
Joined: Thu Feb 07, 2008 3:54 pm

Post by Wetzerk » Thu Feb 07, 2008 4:28 pm

Could you just make the plot item larger? Easier to select?

Locked