Pie Explode
<?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>4</sales>
</row>
<row>
<fruit>B</fruit>
<sales>2</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"
perWedgeExplodeRadius="{[0,0,explodeSlider.value]}"/>
</mx:series>
</mx:PieChart>
<mx:Label text="Explode Radius: {explodeSlider.value}" fontSize="10"/>
<mx:HSlider id="explodeSlider" minimum="0" maximum="1" snapInterval=".01" liveDragging="true"/>
</mx:Application>
Related examples in the same category