开发者

Flex Date Time Axis Not showing Correct Values

<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.开发者_Python百科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>

the above code shows reverse values of date on date axis i.e it should show 01/05 2/05 3/05 4/05 but its showing 10/05 09/05 08/05 07/05 on date axis.

Please help.


Agreed, this is a bug in the Flex SDK. It's been around for a while. To fix it, add disabledDays="[]" to your DateTimeAxis

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜