Clickable Annotation?

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
converge
Posts: 30
Joined: Wed Jun 16, 2004 3:00 pm

Clickable Annotation?

Post by converge » Wed Dec 13, 2017 2:52 pm

Is there any way to create an annotation with a mouse-click event? Specifically, I'm using an XYTitleAnnotation and would like to call some code if the user clicks it.

sonali
Posts: 14
Joined: Sat Sep 02, 2017 5:58 am
antibot: No, of course not.
Location: india

Re: Clickable Annotation?

Post by sonali » Thu Dec 14, 2017 10:13 am

implements chartmouselistner in your class and in chartMouseClicked method you have to check is this event on xytitleannotation

Code: Select all

event.getEntity() instanceof TitleEntity
for getting on which title click you have to set tooltip on xytitleannotation and you will get tooltip in chartMouseClicked method:

Code: Select all

String tooltipid = event.getEntity().getToolTipText();

converge
Posts: 30
Joined: Wed Jun 16, 2004 3:00 pm

Re: Clickable Annotation?

Post by converge » Mon Jan 08, 2018 3:27 pm

Thanks! I will give this a try.

Locked