Yet another 'mouseover-highlighting' question :)

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
Commander Salamander
Posts: 21
Joined: Sat Jan 05, 2008 2:14 am

Yet another 'mouseover-highlighting' question :)

Post by Commander Salamander » Sat Jan 05, 2008 2:21 am

I have read the forum archives on this topic, but I'm still too dense to figure this out. I have an XYPlot and I'd like to highlight the XYSeries upon mouseover.

I achieved this rather easily by registering a ChartMouseListener, casting to XYChartEntity, and getting the series index, which could then by used to call:

chart.getXYPlot().getRenderer().setSeriesStroke(seriesIndex,...)

However, I'd like to take this to the next step and highlight these series when particular XYTextAnnotations are moused over. I can detect the XYAnnotationEntity fine, but the class seems to contain insufficient information for me to determine which XYAnnotation was moused over. Any advice would be greatly appreciated...

Thanks!

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 » Mon Jan 07, 2008 1:07 pm

That does look like a limitation. Maybe a solution would be to add an 'id' field to all annotations, and include this in the entity. I'll have to think some more about that (no time now, unfortunately).
David Gilbert
JFreeChart Project Leader

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

gribas
Posts: 32
Joined: Thu Jan 26, 2006 5:34 pm

Post by gribas » Mon Jan 07, 2008 6:04 pm

What about using the 'url' field to store some control information, like the series the annotation belongs to ?

Commander Salamander
Posts: 21
Joined: Sat Jan 05, 2008 2:14 am

Post by Commander Salamander » Mon Jan 07, 2008 7:35 pm

gribas wrote:What about using the 'url' field to store some control information, like the series the annotation belongs to ?
Good idea, I will try to use this as a workaround.

Thanks!

RichardWest
Posts: 844
Joined: Fri Oct 13, 2006 9:29 pm
Location: Sunnyvale, CA

Post by RichardWest » Mon Jan 07, 2008 8:35 pm

gribas wrote:What about using the 'url' field to store some control information, like the series the annotation belongs to ?
I actually use this approach for content sensitive popup menus. I store the dataset, series, and item number in a comma-separated url string. That provides me all the information I need to lookup and content sensitive data from a map or other storage class.
Richard West
Design Engineer II
Advanced Micro Devices
Sunnyvale, CA

Locked