PieChart with ActionScript
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" creationComplete="initApp()">
<mx:Style>
@namespace mx "http://www.adobe.com/2006/mxml";
mx|PieChart{
font-size:12;
font-weight:bold;
}
</mx:Style>
<mx:Script>
import mx.charts.series.PieSeries;
import mx.charts.PieChart;
private function initApp():void
{
var series:PieSeries = new PieSeries();
series.field="sales";
series.labelField="fruit";
series.explodeRadius=.01;
series.setStyle("labelPosition", "inside");
var chart:PieChart = new PieChart();
chart.visible=true;
chart.dataProvider=salesData;
chart.percentWidth=100;
chart.percentHeight=100;
chart.series=[series];
addChild(chart)
}
</mx:Script>
<mx:ArrayCollection id="salesData">
<mx:Object>
<mx:fruit>A</mx:fruit>
<mx:sales>3</mx:sales>
</mx:Object>
<mx:Object>
<mx:fruit>B</mx:fruit>
<mx:sales>2</mx:sales>
</mx:Object>
<mx:Object>
<mx:fruit>C</mx:fruit>
<mx:sales>4</mx:sales>
</mx:Object>
</mx:ArrayCollection>
</mx:Application>
Related examples in the same category