<UserControl x:Class="TradeBlotter.Views.YieldCurveView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:d3="http://research.microsoft.com/DynamicDataDisplay/1.0" 
             xmlns:dc="clr-namespace:TradeBlotter.UIUtils"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:wpfx="http://schemas.xceed.com/wpf/xaml/toolkit"
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">
    <wpfx:BusyIndicator Name="BusyBar" IsBusy="{Binding Path=BusyIndicator}" BusyContent="Generating Yield Curve...">
    <Grid Background="LightGray">
    <DockPanel>
      <Grid Margin="4">
        <Grid.ColumnDefinitions>
          <ColumnDefinition Width="Auto" />
          <ColumnDefinition Width="6" />
          <ColumnDefinition Width="*" />
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
          <RowDefinition Height="Auto" />
          <RowDefinition Height="Auto" />
          <RowDefinition Height="3" />
          <RowDefinition Height="30" />
        </Grid.RowDefinitions>
        <StackPanel Grid.Row="0" Grid.Column="0" Orientation="Vertical">
        <Label Content="Curve" HorizontalAlignment="Left" Target="{Binding ElementName=curveLbl}" ></Label>
        <ComboBox ItemsSource="{Binding Path=Curves, Mode=OneWay}" SelectedItem="{Binding Path=SelectedCurve, ValidatesOnDataErrors=True}" Validation.ErrorTemplate="{x:Null}" ></ComboBox>
        <Label Content="Day Count" HorizontalAlignment="Left"  ></Label>
        <ComboBox ItemsSource="{Binding Path=DayCounts, Mode=OneWay}" IsEnabled="{Binding Path=DayCountsEnabled, Mode=OneWay}" SelectedItem="{Binding Path=SelectedDayCount, ValidatesOnDataErrors=True}" Validation.ErrorTemplate="{x:Null}" ></ComboBox>
					
        <Label Content="Analysis Date" HorizontalAlignment="Left"  ></Label>
        <ComboBox ItemsSource="{Binding Path=TermStructureDates, Mode=OneWay}" IsEnabled="{Binding Path=TermStructureDatesEnabled, Mode=OneWay}" SelectedItem="{Binding Path=SelectedTermStructureDate, ValidatesOnDataErrors=True}" Validation.ErrorTemplate="{x:Null}" >
				 <ComboBox.ItemsPanel>
					<ItemsPanelTemplate>
							<VirtualizingStackPanel />
					</ItemsPanelTemplate>
					</ComboBox.ItemsPanel>					
				</ComboBox>
					
				<StackPanel Orientation="Horizontal">
					<Label Content="Slope" HorizontalAlignment="Left"  ></Label>	
					<TextBox IsReadOnly="true" Text="{Binding Path=DataSlope,Mode=OneWay}" MinWidth="60">
              <ToolTipService.ToolTip>
                <ToolTip IsEnabled="true" HasDropShadow="True">
                  <TextBlock Background="LemonChiffon" Text="{Binding Path=DataSlopeDescription}"/>
                </ToolTip>
              </ToolTipService.ToolTip>					
					</TextBox>						
				</StackPanel>
					
					
        <Button Margin="0,2" Content="Refresh" HorizontalAlignment="Left" Command="{Binding Path=RefreshCommand}"></Button>
        <CheckBox Margin="0,2" Content="Legend Visible" HorizontalAlignment="Left" IsChecked="{Binding Path=CheckBoxLegendVisible, Mode=TwoWay}"></CheckBox>
        <!--<CheckBox Margin="0,2" Content="Overlays Visible" HorizontalAlignment="Left" IsChecked="{Binding Path=CheckBoxOverlaysVisible, Mode=TwoWay}"></CheckBox>-->					
        </StackPanel>
      </Grid>
      <d3:ChartPlotter Background="WhiteSmoke" Name="YieldCurve" Margin="10,10,20,10" LegendVisibility="Hidden" dc:ChartPlotterLegendBehavior.LegendVisibleProperty="{Binding Path=LegendVisible}" d3:Viewport2D.UsesApproximateContentBoundsComparison="False" BorderThickness="0">
        <d3:ChartPlotter.MainHorizontalAxis>
          <d3:HorizontalDateTimeAxis Name="dateAxis"/>
        </d3:ChartPlotter.MainHorizontalAxis>
        <d3:ChartPlotter.MainVerticalAxis>
          <d3:VerticalAxis Name="countAxis"/>
        </d3:ChartPlotter.MainVerticalAxis>
				<d3:HorizontalAxisTitle FontFamily="Arial" Content="" />
				<d3:VerticalAxisTitle FontFamily="Arial" Content="Rate"/>				
        <d3:LineGraph d3:NewLegend.Description="Yield" x:Name="Values" DataSource="{Binding Path=Values}" Stroke="MidnightBlue" StrokeThickness="1" />
        <d3:LineGraph d3:NewLegend.Description="MA5" x:Name="MA5" DataSource="{Binding Path=MA5}" Stroke="Goldenrod" StrokeThickness="3" />
        <d3:LineGraph d3:NewLegend.Description="MA21" x:Name="MA21" DataSource="{Binding Path=MA21}" Stroke="Green" StrokeThickness="3" />
        <d3:LineGraph d3:NewLegend.Description="MA55" x:Name="MA55" DataSource="{Binding Path=MA55}" Stroke="LightGreen" StrokeThickness="3" />
			  <!--The regular term structure-->
				<d3:LineGraph d3:NewLegend.Description="Term" x:Name="Term" DataSource="{Binding Path=TermStructure}" Stroke="MidnightBlue" StrokeThickness="3" />
				<d3:MarkerPointsGraph x:Name="TenorMarkersPointsGraph" DataSource="{Binding TermStructureTenors}">
					<d3:MarkerPointsGraph.Marker>
						<d3:CirclePointMarker Size="9" Fill="MidnightBlue">
							<d3:CirclePointMarker.Pen>
								<Pen Thickness="1" Brush="MidnightBlue"/>
							</d3:CirclePointMarker.Pen>
						</d3:CirclePointMarker>
					</d3:MarkerPointsGraph.Marker>
				</d3:MarkerPointsGraph>
				<d3:MarkersPointsGraph x:Name="TenorTextMarkersPointsGraph" DataSource="{Binding TermStructureTenors}" Markers="{Binding TermStructureTenorMarkers}" >
				</d3:MarkersPointsGraph>
			  <!--The 90 term structure-->
					<d3:LineGraph d3:NewLegend.Description="Term&lt;90" x:Name="Term90" DataSource="{Binding Path=TermStructure90}" Stroke="MediumBlue" StrokeThickness="3" />
				<d3:MarkerPointsGraph x:Name="TenorMarkersPointsGraph90" DataSource="{Binding TermStructureTenors90}">
					<d3:MarkerPointsGraph.Marker>
						<d3:CirclePointMarker Size="9" Fill="MediumBlue">
							<d3:CirclePointMarker.Pen>
								<Pen Thickness="1" Brush="MediumBlue"/>
							</d3:CirclePointMarker.Pen>
						</d3:CirclePointMarker>
					</d3:MarkerPointsGraph.Marker>
				</d3:MarkerPointsGraph>
				<d3:MarkersPointsGraph x:Name="TenorTextMarkersPointsGraph90" DataSource="{Binding TermStructureTenors90}" Markers="{Binding TermStructureTenorMarkers90}" >
				</d3:MarkersPointsGraph>
			  <!--The 180 term structure-->
			  <d3:LineGraph d3:NewLegend.Description="Term&lt;180" x:Name="Term180" DataSource="{Binding Path=TermStructure180}" Stroke="RoyalBlue" StrokeThickness="3" />
				<d3:MarkerPointsGraph x:Name="TenorMarkersPointsGraph180" DataSource="{Binding TermStructureTenors180}">
					<d3:MarkerPointsGraph.Marker>
						<d3:CirclePointMarker Size="9" Fill="RoyalBlue">
							<d3:CirclePointMarker.Pen>
								<Pen Thickness="1" Brush="RoyalBlue"/>
							</d3:CirclePointMarker.Pen>
						</d3:CirclePointMarker>
					</d3:MarkerPointsGraph.Marker>
				</d3:MarkerPointsGraph>
				<d3:MarkersPointsGraph x:Name="TenorTextMarkersPointsGraph180" DataSource="{Binding TermStructureTenors180}" Markers="{Binding TermStructureTenorMarkers180}" >
				</d3:MarkersPointsGraph>				
				

  			<d3:CursorCoordinateGraph Name="cursorGraph" dc:CoordinateGraphBehavior.XTextMappingProperty="MM/dd/yyyy" LineStrokeThickness="1"/>  
        <d3:Header FontFamily="Arial" Content="{Binding Path=Title}"/>
        <d3:VerticalAxisTitle FontFamily="Arial" Content="Yield"/>
        <d3:HorizontalAxisTitle FontFamily="Arial" Content="Date" />
      </d3:ChartPlotter>
    </DockPanel>
  </Grid>
</wpfx:BusyIndicator>
</UserControl>
