<UserControl
    x:Class="MECF.Framework.UI.Client.CenterViews.Core.UserControls.DataViewChart"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:s="http://schemas.abtsoftware.co.uk/scichart"
    xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
    xmlns:userControls="clr-namespace:MECF.Framework.UI.Client.CenterViews.Core.UserControls"
    d:DesignHeight="450"
    d:DesignWidth="800"
    mc:Ignorable="d">

    <Grid>
        <s:SciChartSurface
            x:Name="sciChart"
            Padding="0,0,0,0"
            s:ThemeManager.Theme="ExpressionLight"
            BorderBrush="Gray"
            DebugWhyDoesntSciChartRender="False"
            Focusable="False"
            IsEnabled="{Binding IsEnabled, RelativeSource={RelativeSource AncestorType=UserControl, Mode=FindAncestor}}"
            IsTabStop="False"
            RenderableSeries="{Binding RenderableSeries, RelativeSource={RelativeSource AncestorType=UserControl, Mode=FindAncestor}}">

            <!--  Create an X Axis  -->
            <s:SciChartSurface.XAxis>
                <s:DateTimeAxis
                    AutoRange="{Binding AutoRange, RelativeSource={RelativeSource AncestorType=UserControl, Mode=FindAncestor}}"
                    DrawMinorGridLines="False"
                    DrawMinorTicks="False"
                    FontSize="12"
                    Id="DefaultAxisId"
                    SubDayTextFormatting="yyyy-MM-dd HH:mm:ss"
                    TextFormatting="yyyy-MM-dd HH:mm"
                    TitleFontSize="15"
                    TitleFontWeight="Normal"
                    VisibleRange="{Binding VisibleRangeTime, RelativeSource={RelativeSource AncestorType=UserControl, Mode=FindAncestor}}" />

            </s:SciChartSurface.XAxis>

            <!--  Create a Y Axis  -->
            <s:SciChartSurface.YAxis>
                <s:NumericAxis
                    MinWidth="35"
                    MaxWidth="35"
                    HorizontalAlignment="Center"
                    AutoRange="{Binding AutoRange, RelativeSource={RelativeSource AncestorType=UserControl, Mode=FindAncestor}}"
                    AxisAlignment="Right"
                    CursorTextFormatting="0.######"
                    DrawLabels="True"
                    DrawMajorBands="False"
                    DrawMajorGridLines="True"
                    DrawMajorTicks="False"
                    DrawMinorGridLines="False"
                    DrawMinorTicks="False"
                    Focusable="False"
                    Id="DefaultAxisId"
                    MajorDelta="0.1"
                    MinorDelta="0.1">

                    <!--
                        VisibleRange="{Binding VisibleRangeValue,
                        RelativeSource={RelativeSource AncestorType=UserControl, Mode=FindAncestor}}"
                    -->
                    <s:NumericAxis.GrowBy>
                        <s:DoubleRange Max="0.1" Min="0.1" />
                    </s:NumericAxis.GrowBy>
                </s:NumericAxis>
            </s:SciChartSurface.YAxis>

            <s:SciChartSurface.ChartModifier>
                <s:ModifierGroup>
                    <s:RubberBandXyZoomModifier
                        ExecuteOn="MouseLeftButton"
                        IsAnimated="False"
                        IsEnabled="True"
                        IsXAxisOnly="False"
                        ReceiveHandledEvents="True"
                        ZoomExtentsY="True" />

                    <s:CursorModifier
                        IsEnabled="True"
                        ShowAxisLabels="True"
                        ShowTooltip="False"
                        ShowTooltipOn="MouseOver"
                        SourceMode="AllSeries" />

                    <s:LegendModifier GetLegendDataFor="AllSeries" ShowLegend="False" />

                    <s:ZoomExtentsModifier
                        ExecuteOn="MouseDoubleClick"
                        IsAnimated="False"
                        XyDirection="XYDirection" />

                    <s:ZoomPanModifier
                        ClipModeX="None"
                        ExecuteOn="MouseRightButton"
                        IsEnabled="True"
                        XyDirection="XYDirection"
                        ZoomExtentsY="False" />

                    <s:RolloverModifier
                        DrawVerticalLine="False"
                        FontFamily="Arial,SimSun"
                        FontSize="9"
                        IsEnabled="True"
                        ShowAxisLabels="False"
                        UseInterpolation="False" />

                    <s:MouseWheelZoomModifier XyDirection="XYDirection" />

                </s:ModifierGroup>
            </s:SciChartSurface.ChartModifier>
        </s:SciChartSurface>

        <Border
            x:Name="btnFixCurveToScreen"
            Margin="10,10,0,0"
            HorizontalAlignment="Left"
            VerticalAlignment="Top"
            Background="Transparent"
            Cursor="Hand"
            Opacity="0.2"
            PreviewMouseUp="BtnFixCurveToScreen_OnPreviewMouseUp"
            ToolTip="Fit to Screen">
            <Path
                Width="35"
                Height="35"
                Data="M20,2H4C2.89,2 2,2.89 2,4V20C2,21.11 2.89,22 4,22H20C21.11,22 22,21.11 22,20V4C22,2.89 21.11,2 20,2M12,4L15,7H13V9H11V7H9M7,15L4,12L7,9V11H9V13H7M12,20L9,17H11V15H13V17H15M17,15V13H15V11H17V9L20,12"
                Fill="Black"
                Stretch="Uniform" />
            <Border.Style>
                <Style>
                    <Setter Property="Border.Opacity" Value="0.3" />
                    <Style.Triggers>
                        <Trigger Property="Border.IsMouseOver" Value="True">
                            <Setter Property="Border.Opacity" Value="1" />
                        </Trigger>
                    </Style.Triggers>
                </Style>
            </Border.Style>
        </Border>

        <Border
    x:Name="btnScreenShot"
    Margin="10,60,0,0"
    HorizontalAlignment="Left"
    VerticalAlignment="Top"
    Background="Transparent"
    Cursor="Hand"
    Opacity="0.4"
    ToolTip="Fit to Screen">
            <Button Width="35" Height="35" HorizontalAlignment="Center" VerticalAlignment="Center" BorderThickness="0">
                <i:Interaction.Behaviors>
                    <userControls:PhotoShotBehavior Target="{Binding ElementName=sciChart}"/>
                </i:Interaction.Behaviors>
                <Button.Background>
                    <ImageBrush ImageSource="pack://application:,,,/Resources/Images/screenshot.png" Stretch="Uniform"/>
                </Button.Background>
            </Button>
            <Border.Style>
                <Style>
                    <Setter Property="Border.Opacity" Value="0.8" />
                    <Style.Triggers>
                        <Trigger Property="Border.IsMouseOver" Value="True">
                            <Setter Property="Border.Opacity" Value="1" />
                        </Trigger>
                    </Style.Triggers>
                </Style>
            </Border.Style>
        </Border>

    </Grid>
</UserControl>
