<?xml version="1.0" encoding="utf-8"?>
<!--
////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2003-2006 Adobe Macromedia Software LLC and its licensors.
// All Rights Reserved.
// The following is Sample Code and is subject to all restrictions on such code
// as contained in the End User License Agreement accompanying this product.
// If you have received this file from a source other than Adobe,
// then your use, modification, or distribution of it requires
// the prior written permission of Adobe.
//
////////////////////////////////////////////////////////////////////////////////
-->
<RevenueTimeline xmlns:mx="http://www.adobe.com/2006/mxml" xmlns="bizLibrary.sharedComponent.*"
    title="{itemData.@title}" creationComplete="init();">

    <mx:Script>

        <![CDATA[
    	import mx.controls.Button;
        
        import mx.charts.HitData;
		import mx.events.FlexEvent;

        private function formatDataTip(hitData:HitData):String
        {
            var name:String = hitData.item.@name;
            var value:Number = hitData.item.@value;
            return "<b>"+name+"</b><br>"+suDisplay.format(value);
        }
        
        private function init():void 
        {
        	if(Accessibility.active) 
        	{
				this.tabIndex=50;

        		toggle.tabIndex = 70;
        		//chart instead of grid is shown first when in accessibility mode
        		toggle.selectedIndex = 1; 
        		
				var chartButton:Button = Button(toggle.getChildAt(0));
				var gridButton:Button = Button(toggle.getChildAt(1));

				chartButton.tabIndex = 75;
				gridButton.tabIndex = 80;
				
        		gridButton.toolTip = "View value timeline in grid" ;
        		chartButton.toolTip = "View value timeline in chart";
        		
        	}
        	
		}

        ]]>

    </mx:Script>

    <!-- will go into the IDeferredInstance slot of the superclass -->
   <chart>
		<mx:LineChart id="chart" dataProvider="{valueData}" showDataTips="true" width="100%" height="100%" dataTipFunction="formatDataTip"
			itemClick="periodChange(event.hitData.item)"
			>

			<mx:horizontalAxis>
				<mx:CategoryAxis id="xAxis" title="{itemData.@period}" dataProvider="{valueData}" categoryField="@name"/>
			</mx:horizontalAxis>
		    <mx:verticalAxis>
		    	<mx:LinearAxis id="yAxis" title="{itemData.@value}"/>
		    </mx:verticalAxis>


			<mx:series>
				<mx:Array>
					<mx:LineSeries yField="@value" showDataEffect="{interpolate}">
						<mx:stroke>
							<mx:Stroke color="#708EA4" weight="1"/>
						</mx:stroke>
					</mx:LineSeries>
				</mx:Array>
			</mx:series>

			<mx:backgroundElements>
				<mx:Array>
			        <mx:GridLines direction="both">
						<mx:verticalStroke>
							<mx:Stroke weight="1" color="#CCCCCC"/>
						</mx:verticalStroke>
					</mx:GridLines>
				</mx:Array>
			</mx:backgroundElements>

		</mx:LineChart>
	</chart>

</RevenueTimeline>
