DateTimeAxis - set Label to display Date + Time

Posted by Jay on Stack Overflow See other posts from Stack Overflow or by Jay
Published on 2009-09-22T19:09:42Z Indexed on 2010/12/27 22:53 UTC
Read the original article Hit count: 214

Filed under:
|

Hi,

Is there a way in flex 3 chart component to display both the date and time using horizontal DateTimeAxis?

Currently the DateTimeAxis element has an attribute dataunits which allows to set the value to any of "milliseconds|seconds|minutes|hours|days|weeks|months|years" but I want to display the label as "2009/09/15 06:00:00" which includes the day and the time too.

Here is the sample that i'm using

[Bindable]
 public var deck:ArrayCollection = new ArrayCollection([
    {date:"2009-09-15 06:00:00", close:42.71},
    {date:"2009-09-16 06:15:00", close:42.99}

 ]);

 public function myParseFunction(s:String):Date {
   var sDate = s.substring(0,s.indexOf(" "));
   var sTime = s.substring(s.indexOf(" "));
   var aDate = sDate.split("-");
   var aTime = sTime.split(":");
   return new Date(aDate[0],(aDate[1]*1-1),aDate[2],aTime[0],aTime[1],aTime[2],0);
 }

]]>

Thanks in advance.

© Stack Overflow or respective owner

Related posts about flex

Related posts about charts