I'm trying to use a BarChart in Flex. I'd like it to order the bars according to the order of the ArrayCollection I fed it. i.e. data at index 0 should be the first bar on top. However, Flex is giving me the exact reverse order. i.e. data at index 0 is not the last bar in bottom.
How could I tell the BarChart to reverse the order other than reversing the order of my ArrayCollection? Thanks!!
Here's the block of code in my script tag:
[Bindable]
private var optionsArray:ArrayCollection = new ArrayCollection([
new VotingOption('Yes, it rocks!', 'yes', 5),
new VotingOption('Meh, it is okay!', 'ok', 10),
new VotingOption('No, it sucks!', 'no', 15)
]);
And here's my BarChart code:
<mx:BarChart x="9.1" y="8" id="barchart1" width="563.0303" height="454.01514" maxBarWidth="30"
type="overlaid" dataProvider="{optionsArray}" showAllDataTips="true">
<mx:verticalAxis>
<mx:CategoryAxis id="vertAxis" categoryField="optionSMSCode"/>
</mx:verticalAxis>
<mx:verticalAxisRenderers>
<mx:AxisRenderer axis="{vertAxis}" showLabels="false"/>
</mx:verticalAxisRenderers>
<mx:series>
<mx:BarSeries xField="optionResult" showDataEffect="morph"/>
</mx:series>
</mx:BarChart>