0 Replies Latest reply on Sep 4, 2008 11:02 PM by satish.patel

    Disabled days not work in datetimeAxis in Chart

    satish.patel
      Hi..
      I have a problem in Flex chart when i am using disabled days in DateTimeAxis..
      Actually i am implementing one Stocking chart in which i want to omit data for Saturday & Sunday.
      For that i am using Disabled days property in DateTime Axis ..
      It will omit that data but leave space to the right side of the Chart.
      If any one have idea about this please help me.
      Please check the following code.

      ===>>>

      <?xml version="1.0"?>
      <!-- charts/DisabledDateRanges.mxml -->
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" width="100%"
      height="100%" creationComplete="init()">
      <mx:Script><![CDATA[
      import mx.collections.ArrayCollection
      [Bindable]
      public var deck:ArrayCollection = new ArrayCollection([
      {date:"08/01/2007", close:42},
      {date:"08/02/2007", close:43},
      {date:"08/03/2007", close:43},
      {date:"08/04/2007", close:42},
      {date:"08/05/2007", close:38},
      {date:"08/06/2007", close:37},
      {date:"08/07/2007", close:39}

      ]);

      private function myParseFunction(s:String):Date {
      var a:Array = s.split("/");
      var newDate:Date = new Date(a[2],a[0]-1,a[1]);
      return newDate;
      }

      private var d1:Date, d2:Date, d3:Date;

      [Bindable]
      private var offRanges:Array = new Array ([]);

      private function init():void {
      d1 = new Date("08/2/2007");
      d2 = new Date("08/5/2007");
      d3 = new Date("08/7/2007");
      offRanges = [ d1, d2, d3];//{rangeStart:d2, rangeEnd:d3} ];
      }

      private var series1:LineSeries;

      ]]></mx:Script>
      <mx:Panel title="Disabled Date Ranges">
      <mx:LineChart id="myChart"
      dataProvider="{deck}"
      showDataTips="true"
      >
      <mx:horizontalAxis>
      <mx:DateTimeAxis
      dataUnits="days"
      parseFunction="myParseFunction"
      disabledRanges="{offRanges}"
      />
      </mx:horizontalAxis>

      <mx:series>
      <mx:LineSeries
      id="mySeries"
      yField="close"
      xField="date"
      displayName="DECK"
      />
      </mx:series>
      </mx:LineChart>
      <mx:Legend dataProvider="{myChart}"/>
      </mx:Panel>
      </mx:Application>