creationComplete="initApp()">
import mx.collections.ArrayCollection;
import mx.charts.chartClasses.ChartBase;
import mx.charts.ChartItem;
import mx.charts.series.items.ColumnSeriesItem;
[Bindable]
private var expensesAC:ArrayCollection = new ArrayCollection( [
{ Month: "Jan", Expenses: 1500, Amount: 450, Profit: 2000 },
{ Month: "Feb", Expenses: 200, Amount: 600, Profit: 1000 },
{ Month: "Mar", Expenses: 500, Amount: 300, Profit: 1500 },
{ Month: "Apr", Expenses: 1200, Amount: 900, Profit: 1800 },
{ Month: "May", Expenses: 575, Amount: 500, Profit: 2400 } ]);
private function initApp():void {
// Select the first item on start up.
series1.selectedIndex = 0;
}
private function getNext(e:Event, dir:*):void {
var curItem:ChartItem = series1.selectedItem;
var newItem:ChartItem = myChart.getNextItem(dir);
applyNewItem(newItem);
}
private function getPrev(e:Event, dir:*):void {
var curItem:ChartItem = series1.selectedItem;
var newItem:ChartItem = myChart.getPreviousItem(dir);
applyNewItem(newItem);
}
private function getFirst(e:Event, dir:*):void {
var newItem:ChartItem = myChart.getFirstItem(dir);
applyNewItem(newItem);
}
private function getLast(e:Event, dir:*):void {
var newItem:ChartItem = myChart.getLastItem(dir);
applyNewItem(newItem);
}
private function applyNewItem(n:ChartItem):void {
series1.selectedItem = n;
}
showDataTips="true" dataProvider="{expensesAC}"
selectionMode="single">
displayName="Expenses" selectable="true" />
click="getFirst(event, ChartBase.HORIZONTAL);" />
click="getPrev(event, ChartBase.HORIZONTAL);" />
click="getNext(event, ChartBase.HORIZONTAL);" />
click="getLast(event, ChartBase.HORIZONTAL);" />