Mega Code Archive

 
Categories / Flex / Chart
 

Pie chart with two series

<?xml version="1.0"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"     backgroundColor="white">     <mx:XML id="salesDataXML">         <salesdata>             <revenues>                 <data brand="A" rev="1" />                 <data brand="B" rev="2" />                 <data brand="C" rev="3" />                 <data brand="D" rev="4" />             </revenues>             <profits>                 <data brand="A" profit="4" />                 <data brand="B" profit="5" />                 <data brand="C" profit="6" />                 <data brand="D" profit="7" />             </profits>         </salesdata>     </mx:XML>     <mx:XMLListCollection source="{salesDataXML.revenues.data}" id="salesData" />     <mx:XMLListCollection source="{salesDataXML.profits.data}" id="profitData" />     <mx:Panel title="Sales" width="500" height="400" layout="horizontal">         <mx:Legend dataProvider="{salesChart}" />         <mx:PieChart id="salesChart" dataProvider="{salesData}" height="100%" width="100%">             <mx:series>                 <mx:PieSeries field="@rev" nameField="@brand" labelPosition="callout" />                 <mx:PieSeries dataProvider="{profitData}" field="@profit" nameField="@brand" labelPosition="inside" />             </mx:series>         </mx:PieChart>     </mx:Panel> </mx:Application>