Go Back   CodingForums.com > :: Client side development > Flash & ActionScript > Adobe Flex

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 12-14-2010, 08:12 AM   PM User | #1
EricJ
New to the CF scene

 
Join Date: Dec 2010
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
EricJ is an unknown quantity at this point
Getting the selected item in a stacked column chart

I'm trying to get the item associated with a segment that has been clicked in a stacked column chart.


Code:
<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

Code:
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
EricJ is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 02:54 AM.


Advertisement
Log in to turn off these ads.