I am trying to provide my own labelFunction for a CategoryAxis programatically but am completely stumped. The regular way is to do it in your MXML file, but I want to do it in my Actionscript file.
The regular way of doing it is:
<mx:Script>
<![CDATA[
private function categoryAxis_labelFunc(item:Object,
prevValue:Object,
axis:CategoryAxis,
categoryItem:Object):String {
return "Some String";
}
]]>
</mx:Script>
<mx:CategoryAxis labelFunction="categoryAxis_labelFunc" />
But I want to achieve the same thing in my subclass of CategoryAxis, something like:
public class FauxDateAxis extends CategoryAxis {
public function FauxDateAxis() {
super();
labelFunction = categoryAxis_labelFunc // Doesn't work of course.
}
private function categoryAxis_labelFunc(item:Object,
prevValue:Object,
axis:CategoryAxis,
categoryItem:Object):String {
return "Another String";
}
}