Clickable Annotation?

A discussion forum for JFreeChart (a 2D chart library for the Java platform).

Clickable Annotation?

Postby 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.
converge
 
Posts: 30
Joined: Wed Jun 16, 2004 3:00 pm

Re: Clickable Annotation?

Postby 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();
sonali
 
Posts: 13
Joined: Sat Sep 02, 2017 5:58 am
Location: india

Re: Clickable Annotation?

Postby converge » Mon Jan 08, 2018 3:27 pm

Thanks! I will give this a try.
converge
 
Posts: 30
Joined: Wed Jun 16, 2004 3:00 pm


Return to JFreeChart

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 16 guests