0 Replies Latest reply on Jan 15, 2007 6:48 PM by Newsgroup_User

    Problem formatting date labels with DateTimeAxis and parseFunction

    Level 7
      I'm working with a line chart that gets its data from a MySQL database and
      I'm using a DateTimeAxis to try to display the date on the x-axis. The date
      is formatted in the database as "YYYY-MM-DD" - however when I run the
      application I am only seeing the date displayed as MM/YY. I am using a
      parseFunction as follows:

      public function myParseFunction(s:String):Date {
      var a:Array = s.split("-");

      var newDate:Date = new Date(a[0],a[1]-1,a[2]);
      return newDate;

      I was trying to experiment with setting dataUnits to days or weeks but it
      doesn't seem to change. Can anyone figure out what I'm doing wrong?


      The code for the line chart is:

      <mx:LineChart x="10" id="linechartHist" dataProvider="{dataProvider1}"
      showDataTips="true" width="100%" height="100%" y="10">

      <mx:DateTimeAxis displayName="Date" title="Date (Month)"
      parseFunction="myParseFunction" dataUnits="days"/>

      <mx:AxisRenderer canDropLabels="true"/>

      <mx:LinearAxis title="Price" id="vAxis" labelFunction="vLongLabels"

      <mx:LineSeries displayName="MSFT" yField="MSFT" xField="date"/>
      <mx:LineSeries displayName="PG" yField="PG" xField="date"/>
      <mx:LineSeries displayName="NTDOY" yField="NTDOY" xField="date"/>