How to support click event on ValueMarker

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
pizazzallure
Posts: 2
Joined: Tue Jul 12, 2016 7:08 am
antibot: No, of course not.

How to support click event on ValueMarker

Post by pizazzallure » Tue Jul 12, 2016 8:49 am

Hello,
I want to click the marker (or maker label) to get the X value of this marker, How can I detect the click event on a ValueMarker?
until now, I only see there is a listener "ChartMouseListener" which only listen the click event on the chart, it's not enough.
Thanks a lot. :)

paradoxoff
Posts: 1634
Joined: Sat Feb 17, 2007 1:51 pm

Re: How to support click event on ValueMarker

Post by paradoxoff » Tue Jul 12, 2016 6:36 pm

You can´t do that with a ValueMarker. 1.5 years ago, I have written a couple of annotation classes that can be used as Marker replacements. Annotations do support the creation of entities. If you click anywhere on the chart, you can check whether ChartMouseEvent.getEntity() returns an instance of AxisAnnotation, and move forward from this point on.
Here is the link to the thread: Click

Locked