Using Flex 2.
I have a 100% bar chart that I need help figuring out
how to get
access to some of the series data for display in a data tip.
Here's
the scenario:
There are 4 regions in the country, each of them
gets their own bar in
the chart..
- North Region
- South Region
-
West Region
- East Region
Each bar has 4 individual peices to it,
which together sum to 100%:
- Used Sales
- New Sales
- Parts
-
Accessories
What I need is a way to display the name of the grouping
(Used Sales,
New Sales, etc) inside my datatip. I cannot for the life of me
figure
out how to do this.
Here's the code that I'm working
with:
---------------------
<mx:Script>
<![CDATA[
import
mx.charts.HitData;
public function
dataTipsBarChart(e:HitData):String {
/*
so far I know how to
get the region name, but how do you
get the actual "displayname" of the
series that is being
rolled over?
*/
return
e.item.region;
}
]]>
</mx:Script>
<mx:BarChart
x="10" y="36" width="80%" height="124"
id="barchartDealers" type="100%"
showDataTips="true"
dataTipFunction="dataTipsBarChart">
<mx:dataProvider>
<mx:Array>
<mx:Object
region="North" newsales="50" usedsales="25" parts="15"
accessories="10"
/>
<mx:Object region="South" newsales="40" usedsales="35"
parts="10"
accessories="15" />
<mx:Object region="East"
newsales="65" usedsales="15" parts="10"
accessories="10"
/>
<mx:Object region="West" newsales="60" usedsales="20"
parts="15"
accessories="5"
/>
</mx:Array>
</mx:dataProvider>
<mx:verticalAxis>
<mx:CategoryAxis
categoryField="region"
displayName=""/>
</mx:verticalAxis>
<mx:horizontalAxis>
<mx:LinearAxis
minimum="0"
maximum="100"/>
</mx:horizontalAxis>
<mx:series>
<mx:BarSeries
displayName="New Sales" yField="region"
xField="newsales">
<mx:fill>
<mx:SolidColor
color="0x009900"/>
</mx:fill>
</mx:BarSeries>
<mx:BarSeries
displayName="Used Sales"
yField="region"
xField="usedsales">
<mx:fill>
<mx:SolidColor
color="0xFFFF00"/>
</mx:fill>
</mx:BarSeries>
<mx:BarSeries
displayName="Parts" yField="region"
xField="parts">
<mx:fill>
<mx:SolidColor
color="0xFF9900"/>
</mx:fill>
</mx:BarSeries>
<mx:BarSeries
displayName="Accessories"
yField="region"
xField="accessories">
<mx:fill>
<mx:SolidColor
color="0xFF0000"/>
</mx:fill>
</mx:BarSeries>
</mx:series>
</mx:BarChart>
<mx:Legend
dataProvider="{barchartDealers}" x="74.5" y="151"
width="522"
height="31" fontSize="9"
id="barchartDealersLegend"/>
---------------------
Any
help with this would be greatly appreciated!
I hope that my example was
clear enough, it should run on it's own if
you cut/paste it into a blank Flex
app.