Handling mouse events on line graph
For a better understanding of events model, check this tutorial.
There are several issues that you need to look out for when employing user interaction events on line graphs. We’ll detail them here:
Events fire only on bullets, not line itself
Section titled “Events fire only on bullets, not line itself”No bullets - no events.
But what if I don’t want to display bullets? There’s a workaround: enable bullets but set their alpha to zero, so they remain invisible but will still trigger interaction events:
graph.bullet = "round";graph.bulletAlpha = 0;Rollover bullet might be obstructing the actual graph bullets
Section titled “Rollover bullet might be obstructing the actual graph bullets”ChartCursor as well as AmBalloon instances can also display their own rollover bullets that when drawn on top of graph’s bullet will prevent events from firing. Make sure those are disabled:
chart.balloon.showBullet = false;chartCursor.bulletSize = 0;Registering click on a graph
Section titled “Registering click on a graph”Instead of registering click on a bullet, you might want to register click on the whole graph. AmCoordinateChart (serial, yx and radar charts extend this class) has clickGraph event which is fired when any place of a graph is clicked.