Pie custom Label
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Script>
private function getWedgeLabel(item:Object, field:String,index:Number, percentValue:Number):String
{
return item.fruit + ": $" + nf.format(item.sales) + " (" + nf.format(percentValue) + "%)";
}
</mx:Script>
<mx:NumberFormatter id="nf" precision="0" rounding="nearest"/>
<mx:Model id="pieModel">
<data>
<row>
<fruit>A</fruit>
<sales>1</sales>
</row>
<row>
<fruit>B</fruit>
<sales>4</sales>
</row>
<row>
<fruit>C</fruit>
<sales>6</sales>
</row>
</data>
</mx:Model>
<mx:ArrayCollection id="pieData" source="{pieModel.row}"/>
<mx:PieChart dataProvider="{pieData}" height="100%" width="100%">
<mx:series>
<mx:PieSeries field="sales" labelFunction="getWedgeLabel" labelPosition="callout" explodeRadius=".01"/>
</mx:series>
</mx:PieChart>
</mx:Application>
Related examples in the same category