Adding a legend to LineChart
<?xml version="1.0"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"> <mx:XML id="salesDataXML"> <salesdata> <all> <data interval="Q1" pc="2" pcRevenue="2.2" mac="2" macRevenue="0.18"/> <data interval="Q2" pc="5" pcRevenue="7.2" mac="3" macRevenue="0.24" /> <data interval="Q3" pc="4" pcRevenue="6.2" mac="7" macRevenue="0.42"/> <data interval="Q4" pc="1" pcRevenue="1.2" mac="12" macRevenue="1.10"/> </all> </salesdata> </mx:XML> <mx:XMLListCollection source="{salesDataXML.all.data}" id="salesData" /> <mx:Legend dataProvider="{salesChart}" /> <mx:LineChart id="salesChart" dataProvider="{salesData}" height="100%" width="100%"> <mx:horizontalAxis> <mx:CategoryAxis categoryField="@interval" /> </mx:horizontalAxis> <mx:series> <mx:LineSeries yField="@pc" displayName="PC Count" /> <mx:LineSeries yField="@mac" displayName="Mac Count" /> </mx:series> </mx:LineChart> </mx:Application>