<UserControl
    x:Class="FlexChartExplorer.Histogram"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="clr-namespace:FlexChartExplorer"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:Chart="http://schemas.componentone.com/winfx/2006/xaml"
    DataContext="{Binding RelativeSource={RelativeSource Mode=Self}}"
    mc:Ignorable="d">

    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition />
        </Grid.RowDefinitions>
        <StackPanel x:Name="stackPanel" Orientation="Horizontal">
            <StackPanel Orientation="Horizontal">
                <Label VerticalAlignment="Center">BinWidth :  </Label>
                <TextBox x:Name="tbBinWidth" Width="100" VerticalAlignment="Center" TextAlignment="Right" PreviewTextInput="NumberValidationTextBox" TextChanged="TextBox_TextChanged"/>
                <CheckBox Content="Normal Curve" x:Name="cbShow" VerticalAlignment="Center" Margin="10 0 20 0" Checked="cbShow_Checked" Unchecked="cbShow_UnChecked"/>
                <ComboBox x:Name="comboBoxAppearanceType" Margin="10" ItemsSource="{Binding DataContext.Type}" SelectionChanged="ComboBoxAppearanceType_SelectionChanged"/>
                <CheckBox Content="Cumulative Mode" x:Name="cumulativeShow" VerticalAlignment="Center" Margin="10 0 20 0" Checked="cumulativeShow_Checked" Unchecked="cumulativeShow_UnChecked"/>
            </StackPanel>
        </StackPanel>
        <Chart:C1FlexChart x:Name="flexChart" ChartType="Histogram" ItemsSource="{Binding DataContext.Data}" Grid.Row="1" Binding="Y" BindingX="X" Rendered="flexChart_Rendered">
            <Chart:C1FlexChart.AxisX>
                <Chart:Axis Format="0.00"></Chart:Axis>
            </Chart:C1FlexChart.AxisX>
            <Chart:Histogram x:Name="histogramSeries" SeriesName="Frequency" BinWidth="4">
                <Chart:Histogram.FrequencyPolygonStyle>
                    <Chart:ChartStyle Stroke="Red" StrokeThickness="2"/>
                </Chart:Histogram.FrequencyPolygonStyle>
                <Chart:Histogram.NormalCurve>
                    <Chart:NormalCurve>
                        <Chart:NormalCurve.LineStyle>
                            <Chart:ChartStyle Stroke="Green" StrokeThickness="2"/>
                        </Chart:NormalCurve.LineStyle>
                    </Chart:NormalCurve>
                </Chart:Histogram.NormalCurve>
            </Chart:Histogram>
            <Chart:Series ChartType="Scatter" SeriesName="Value"/>
        </Chart:C1FlexChart>
    </Grid>
</UserControl>
