import mx.collections.ArrayCollection;
import mx.charts.HitData;
import mx.charts.series.ColumnSeries;
import mx.charts.series.items.ColumnSeriesItem;
[Bindable]
public var dataSet:ArrayCollection = new ArrayCollection([
{Month:"Jan", Income:1500, Profit:90},
{Month:"Feb", Income:1200, Profit:100},
{Month:"Mar", Income:750, Profit:150}
]);
public var b:Boolean = true;
public function myDataTipFunction(e:HitData):String {
var s:String;
s = "" + ColumnSeries(e.element).displayName + "\n";
s += "Income: $" + e.item.Income + "\n";
s += "Expenses: $" + (e.item.Income - e.item.Profit) + "\n";
s += "------------------------\n";
s += "Profit: $" + e.item.Profit + "\n";
// The value of the Income will always be 100%, so exclude adding that to the DataTip. Only
// add percent when the user gets the Profit DataTip.
var percentValue:Number = Number(ColumnSeriesItem(e.chartItem).yValue);
if (percentValue < 100) {
s += "Profit was equal to about " +
Math.round(percentValue) + "% of the income.\n";
}
return s;
//return e.item.Month + ":$" + e.item.Profit + "";
}
dataTipFunction="myDataTipFunction" showDataTips="true">