0 Replies Latest reply on May 4, 2010 2:18 PM by naveen102

    Problems with display date issues on the bar chart

    naveen102

      I have created simple bar chart with array collection as data provider. I took this example from adobe site. This barchart is not displaying date on the x-axis in ascending date order.

      Example ,instead of displaying 01/2010 , 02/2010 ,03/2010 , it is displaying 03/2010,02/2010 and 01/2010 on x-axis.

      Relevant x-axis and y-axis values are also not correct.

       

      Can you please some one help me to fix this?

       

      here is my example:

       

      <?xml version="1.0"?>

      <!-- charts/DateTimeAxisRange.mxml -->

      <mx:Application

       

       

      xmlns:mx="http://www.adobe.com/2006/mxml" width="450"

      height="

      300">

       

      <mx:Script><![CDATA[

       

      import mx.collections.ArrayCollection;

       

      import mx.charts.ChartItem;

       

      import mx.charts.chartClasses.Series;

       

      import mx.charts.series.items.BarSeriesItem;

       

      import mx.charts.series.BarSeries;

       

      import mx.controls.Alert;

       

      import mx.charts.CategoryAxis;

       

       

      [

      Bindable]

       

      public var minDate:Date = new Date(2006, 11, 1);

      [

      Bindable]

       

      public var maxDate:Date = new Date(2007, 1, 1);

       

      [

      Bindable] public var myData:ArrayCollection = new

      ArrayCollection([

      {date:

      "11/03/2006", amt: 12345},

      {date:

      "12/02/2006", amt: 54331},

      {date:

      "1/03/2007", amt: 34343},

      {date:

      "2/05/2007", amt: 40299}

      ]);

       

       

       

       

      ]]>

      </mx:Script>

       

      <mx:DateFormatter id="dateFormatter" formatString="MMMM-DD-YYYY" />

       

      <mx:Panel title="DateTimeAxis with range">

       

      <mx:ColumnChart id="myChart"

      dataProvider="

      {myData}"

      showDataTips="

      true"

       

      >

       

      <mx:horizontalAxis>

       

      <mx:DateTimeAxis

      dataUnits="

      months"

       

       

      />

       

      </mx:horizontalAxis>

       

      <mx:series>

       

      <mx:ColumnSeries

      yField="

      amt"

      xField="

      date"

      displayName="

      My Data"

       

      />

       

      </mx:series>

       

      </mx:ColumnChart>

       

      <mx:Legend dataProvider="{myChart}"/>

       

      </mx:Panel>

      </mx:Application>