0
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<fx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
[Bindable]
public var stockDataAC:ArrayCollection = new ArrayCollection([
{date: "2005, 7, 27", close: 41.71},
{date: "2005, 7, 28", close: 42.21},
{date: "2005, 3, 29", close: 42.11},
{date: "2005, 1, 1", close: 42.71},
{date: "2005, 10, 2", close: 42.99},
{date: "2005, 9, 3", close: 44} ]);
public function myParseFunction(s:String):Date {
// Get an array of Strings from the comma-separated String passed in.
var a:Array = s.split(",");
// Create the new Date object. Subtract one from the month property.
// The month property is zero-based in the Date constructor.
var newDate:Date = new Date(a[0],a[1]-1,a[2]);
return newDate;
}
]]>
</fx:Script>
<mx:Panel title="DateTimeAxis Example" height="100%" width="100%">
<mx:LineChart id="mychart" height="100%" width="100%"
paddingRight="5" paddingLeft="5"
showDataTips="true" dataProvider="{stockDataAC}">
<mx:horizontalAxis>
<mx:DateTimeAxis dataUnits="days" parseFunction="myParseFunction"/>
</mx:horizontalAxis>
<mx:verticalAxis>
<mx:LinearAxis baseAtZero="false" />
</mx:verticalAxis>
<mx:series>
<mx:LineSeries yField="close" xField="date" displayName="AAPL"/>
</mx:series>
</mx:LineChart>
</mx:Panel>
上面的代碼示出了日期軸線 即它應該顯示日期的反向值01/05 2/05 3/05 4/05但在日期軸上顯示 10/05 09/05 08/05 07/05。
請幫忙。
數據是否高於要傳遞給parseFunction的數據?如果是這樣,我不明白你是如何得到這些結果的。你能提供真實的數據嗎? – quoo 2010-05-28 13:59:50
感謝您的回覆 我傳遞的數據與上面相同。您可以運行上述代碼並查看結果 – 2010-05-29 09:58:40
這是flex SDK中的錯誤 https://bugs.adobe.com/jira/browse/FLEXDMV-2231 – 2010-06-02 07:19:57