Exclude August 13, and then the range of days between August 27 and August 31
<!--
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/DisabledDateRanges.mxml -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" width="100%"
height="100%" creationComplete="init()">
<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;
}
private var d1:Date, d2:Date, d3:Date;
[Bindable]
private var offRanges:Array = new Array ([]);
private function init():void {
d1 = new Date("08/13/2007");
d2 = new Date("08/27/2007");
d3 = new Date("08/31/2007");
offRanges = [ d1, {rangeStart:d2, rangeEnd:d3} ];
}
private var series1:LineSeries;
</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"
disabledRanges="{offRanges}" />
</mx:horizontalAxis>
<mx:series>
<mx:LineSeries id="mySeries" yField="close" xField="date"
displayName="AAPL" />
</mx:series>
</mx:LineChart>
</mx:Panel>
</mx:Application>
Related examples in the same category