I have created an annotation which extends AbstractXYAnnotation
I add the annotation to my chartPanel's XYPlot.
When I click the mouse on one of these annotations, I call
chartPanel.getEntityForPoint(x,y) in my mouseClicked listener.
getEntityForPoint(x,y) either returns null or returns the tooltip associated with my annotation class when I click on the annotation.
I was expecting that it would return the annotation instance itself.
Is there someway to get the annotation itself when clicking the mouse on it?
Thank you,
XYAnnotation and XYAnnotationEntity
XYAnnotation and XYAnnotationEntity
Ted Hill
Yeah, you could...
...Keep track of your annotations and then iterate through them until you find a match.
...Change XYAnnotationEntity and add a new constructor to receive a XYAbstractAnnotation along with methods to retrieve that annotation object.
...Change XYPlot and create a method to retrieve an annotation given a x,y coordinate similar to getEntityForPoint().
regards,
Gustavo
...Keep track of your annotations and then iterate through them until you find a match.
...Change XYAnnotationEntity and add a new constructor to receive a XYAbstractAnnotation along with methods to retrieve that annotation object.
...Change XYPlot and create a method to retrieve an annotation given a x,y coordinate similar to getEntityForPoint().
regards,
Gustavo
Is there anything new on this subject? What I want to do is to highlight annotations which are near the mouse cursor but all I can get with chartPanel.getChartRenderingInfo().getEntityCollection() is ChartEntity objects. Well there exists a XYAnnotationEntity class but it seems that it is not yet in use not to mention connected with XYAnnotation implementation, right? Does anybody have a sample solution and want to share it?
Best regards,
Marcus
Best regards,
Marcus