Mega Code Archive

 
Categories / Flex / Data Model
 

Excludes Saturdays and Sundays from the chart by setting the value of the disabledDays property to an Array that contains 0 and

<!-- Code from Flex 4 Documentation "Using Adobe Flex 4". This user guide is licensed for use under the terms of the Creative Commons Attribution  Non-Commercial 3.0 License.  This License allows users to copy, distribute, and transmit the user guide for noncommercial  purposes only so long as    (1) proper attribution to Adobe is given as the owner of the user guide; and    (2) any reuse or distribution of the user guide contains a notice that use of the user guide is governed by these terms.  The best way to provide notice is to include the following link.  To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/3.0/ --> <!-- charts/WorkWeekAxis.mxml --> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" width="600"     height="600">     <mx:Script>         import mx.collections.ArrayCollection         [Bindable]         public var aapl:ArrayCollection = new ArrayCollection([             {date:"08/01/2007", close:42},             {date:"08/02/2007", close:43},             {date:"08/03/2007", close:43},             {date:"08/06/2007", close:42},             {date:"08/07/2007", close:38},             {date:"08/08/2007", close:37},             {date:"08/09/2007", close:39},             {date:"08/10/2007", close:41},             {date:"08/13/2007", close:45},             {date:"08/14/2007", close:47},             {date:"08/15/2007", close:48},             {date:"08/16/2007", close:42},             {date:"08/17/2007", close:43},             {date:"08/20/2007", close:45},             {date:"08/21/2007", close:50},             {date:"08/22/2007", close:51},             {date:"08/23/2007", close:55},             {date:"08/24/2007", close:51},             {date:"08/27/2007", close:49},             {date:"08/28/2007", close:51},             {date:"08/29/2007", close:50},             {date:"08/30/2007", close:49},             {date:"08/31/2007", close:54}             ]);         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;         }         // Create an Array that specifies which days to exclude.         // 0 is Sunday and 6 is Saturday.         [Bindable]         private var offDays:Array = [0,6];       </mx:Script>     <mx:Panel title="DateTimeAxis" width="100%" height="100%">         <mx:LineChart id="mychart" dataProvider="{aapl}" showDataTips="true">             <mx:horizontalAxis>                 <mx:DateTimeAxis dataUnits="days"                     parseFunction="myParseFunction" disabledDays="{offDays}" />             </mx:horizontalAxis>             <mx:series>                 <mx:LineSeries yField="close" xField="date" displayName="AAPL" />             </mx:series>         </mx:LineChart>     </mx:Panel> </mx:Application>