我試圖在Flex中使用BarChart。我希望它根據我給它的ArrayCollection的順序排列這些條。即索引0處的數據應該是頂部的第一個條。但是,Flex給我的確是相反的順序。即在索引0處的數據不是底部的最後一個條。Flex中的條形反轉順序BarChart
我怎麼能告訴BarChart顛倒順序,而不是顛倒我的ArrayCollection的順序?謝謝!!
這裏的代碼塊在我的腳本標籤:
[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)
]);
這是我的BARCHART代碼:
<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>
作爲臨時補丁..爲什麼不只是顛倒數組排序? – ethyreal 2009-10-14 18:34:23
,因爲還有其他東西依賴於它的原始順序。該圖表是唯一需要其相反順序的東西。如果我調用'data.source.reverse()',我搞砸了其他的東西。作爲臨時補丁,我正在創建一個新數組,併爲其分配反向數據數組。 – tomato 2009-10-14 21:33:56