views:

222

answers:

1

I need to create LineChart that display datetime points, for example:

public var stockDataAC:ArrayCollection = new ArrayCollection( [
                {date: "2005,7,27,22,15,30", close: 41.71},
                {date: "2005,7,27,22,16,30", close: 42.21},
                {date: "2005,7,27,22,17,30", close: 42.11},
                {date: "2005,7,27,22,18,30", close: 42.71},
                {date: "2005,7,27,23,22,30", close: 42.99},
                {date: "2005,7,27,23,24,30", close: 48.99},
                {date: "2005,7,27,23,25,30", close: 49} ]);

            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 because months are zero-based in 
                // the Date constructor.
                var newDate:Date = new Date(a[0],a[1],a[2],a[3],a[4],a[5],0);
                return newDate;
            }
           ......

           
                
            

how do I make the a line chart display lables/axis like this :27/7/2005 22:15:30?

A: 

It looks like you are trying to do the DateTimeAxis example, but modified . You will want to set the dataunits to "seconds".

asawilliams
but, when you use "seconds" it display only hour:min, not a full date time. also in the axis.if I will change the last value to :2005,7,28,23,30,30.. is doesn't consider the date (its a day after)
Omer72
You can specify a custom labelFunction on the DateTimeAxis that can format the label however you want.
James Ward