I want to get the exact instance of XYDataItem
when a mouse click makes the crosshair lock on the nearest data point, as the picture below shows.
Now I am able to get the X-Y position of the crosshair when a mouse click event happens with a ChartMouseListener
, but it may not be good to get the XYDataItem
according to the X value and Y value. From the mouse event, another thing is ChartEntity
, but it is based on where the mouse clicks, not where the crosshair locks on.
So.. Is there any better way to let me do this?
Or
if you want to make show a lot of additional data related to the data point each time when the crosshair locks on it, how will you do that? (Now I am extending XYDataItem and adding a new field to the sub class so that I can either put the information directly in it, or put an ID that can help me get the additional data from the data list, and that's why I hope the crosshair can give me the exact data item).