...

View Full Version : Getting the selected item in a stacked column chart



EricJ
12-14-2010, 08:12 AM
I'm trying to get the item associated with a segment that has been clicked in a stacked column chart.




<mx:CartesianChart id="chart"
dataProvider="{dp}"
showDataTips="true"
selectionMode="single" itemClick="chart_itemClickHandler(event)">





protected function chart_itemClickHandler(event:ChartItemEvent):void
{
// TODO Auto-generated method stub
}



I would normally, within the handler, use hitData.item to get the information I need here, but it holds the data for the entire column, without specifying which field has been clicked.

So, how do I go about finding the data that has actually been clicked on?



eg

the dataProvider could be



new ArrayCollection([ {month: "Jan", tax: 20, income: 100, food: 10},

{month: "Feb", tax: 15, income: 100, food: 15}]};



This would create a stacked column chart with two bars, each with three segments (one each for tax, income and food).

When I click on the 'tax' segment in the first bar, hitData.item is the whole object {month: "Jan", tax: 20, income: 100, food: 10}, but I need to capture that it was 'tax' I actually clicked on.



Any advice would be welcomed.



Thanks



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum