I have a bar chart with the vertical axis this way
<mx:verticalAxis >
<mx:CategoryAxis id="catAxis" title="Employee" categoryField="id"/>
</mx:verticalAxis>
I would for the labels on the vertical axis to be clickable. So when a user clicks a label a click event fires and I can do something with it. I am not interested in clicking the bar itself (I know how to achieve that)
I tried adding an event listener to the CategoryAxis of type Mouse.Click but nothing gets fired.
Any help is appreciated.
OK, I got it to work. I will post the answer so that others with a similar requirement can benefit. So, Timofei Davydik helped me look in the right direction. I have created an ActionScript class named
MyLabelRendererthat extendsChartLabel. Inside its constructor, I added all my event listeners such as the mouse click event that I needed.This was the tricky part. Thank you KB (a friend) for providing the correct instantiation. In the main application where my chart is I have to instantiate an instance of my new class
MyLabelRendererthis way:Then you can assign it to the AxisRenderer object this way:
good luck…