import mx.formatters.*;
import mx.collections.ArrayCollection;
[Bindable]
public var expenses:ArrayCollection = new ArrayCollection([
{Expense:"Taxes", Amount:1900000},
{Expense:"Salaries", Amount:1350000},
{Expense:"Building Rent", Amount:300000},
{Expense:"Insurance", Amount:750000},
{Expense:"Benefits", Amount:800000},
{Expense:"Miscellaneous", Amount:900000}
]);
public function display(data:Object,field:String,index:Number,percentValue:Number):String{
return data.Expense + ":$" + data.Amount + "\n" + round(percentValue,2) + "%";
}
// Rounds to 2 places:
public function round(num:Number, precision:Number):Number {
var result:String;
var f:NumberFormatter = new NumberFormatter();
f.precision = precision;
result = f.format(num);
return Number(result);
}
showDataTips="false">
labelFunction="display" />