<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。
请帮忙。
答案 0 :(得分:0)
同意,这是Flex SDK中的一个错误。它已经存在了一段时间。要解决此问题,请将disabledDays="[]"
添加到DateTimeAxis