ChartMouseEvent question

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
dmacleod
Posts: 8
Joined: Fri Jun 29, 2007 4:48 pm
Location: Florida, USA

ChartMouseEvent question

Post by dmacleod » Tue Jul 31, 2007 8:01 pm

I get a chartEntity object from a ChartMouseEvent (i.e. ChartEntity entity = event.getEntity(); ). Are there any access methods to get the category or row text from the entity? I can view the values by doing a entity.toString(), but I can't find "get" methods to access the data.

thanks

MNusinov
Posts: 15
Joined: Tue Jul 03, 2007 7:41 pm

Post by MNusinov » Tue Jul 31, 2007 9:08 pm

Try something like this:

Code: Select all

CategoryItemEntity categoryItem = (CategoryItemEntity)e.getEntity();
			
			String selectedName = categoryItem.getColumnKey().toString();
That's for a category data plot. I'm sure it would be similar for other plots. Just see what type of Entity, e.getEntity is giving you and typecast accordingly

Locked