creationComplete="createLegend()">
import mx.collections.ArrayCollection;
import mx.charts.Legend;
[Bindable]
public var expenses:ArrayCollection = new ArrayCollection([
{Expense:"Taxes", Amount:2000, Cost:321, Discount:131},
{Expense:"Rent", Amount:1000, Cost:95, Discount:313},
{Expense:"Bills", Amount:100, Cost:478, Discount:841}
]);
private function createLegend():void {
var myLegend:Legend = new Legend();
myLegend.dataProvider = myChart;
panel1.addChild(myLegend);
}
title="Bar Chart with Legend (Created in ActionScript)">
categoryField="Expense" />
displayName="Discount (in $USD)" />