<UserControl
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:BoxOfficeDashboard.Views"
    xmlns:c="using:BoxOfficeDashboard.Converters"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:Chart="using:C1.Xaml.Chart"
    x:Class="BoxOfficeDashboard.Views.MarketShareChart"
    mc:Ignorable="d"
    d:DesignHeight="300"
    d:DesignWidth="400">

    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition />
        </Grid.RowDefinitions>
        <TextBlock Text="Market Share" HorizontalAlignment="Center" Style="{StaticResource TitleTextBlockStyle}"/>
        <Chart:C1Chart ChartType="PieDoughnut" Palette="Aspect" Grid.Row="1">
            <Chart:C1Chart.Resources>
                <c:DoubleFormatter x:Key="df" />
                <DataTemplate x:Key="SimpleLabel">
                    <StackPanel>
                        <TextBlock Text="{Binding Value, Converter={StaticResource df}, ConverterParameter=c2}" />
                        <TextBlock Text="{Binding PercentageSeries, Converter={StaticResource df}, ConverterParameter=p2}" />
                    </StackPanel>
                </DataTemplate>
            </Chart:C1Chart.Resources>
            <Chart:C1Chart.Data>
                <Chart:ChartData ItemsSource="{Binding}" ItemNameBinding="{Binding Name}">
                    <Chart:ChartData.Children>
                        <Chart:DataSeries Opacity="1" ValueBinding="{Binding Gross}" PointTooltipTemplate="{StaticResource SimpleLabel}" SymbolStrokeThickness="0"/>
                    </Chart:ChartData.Children>
                </Chart:ChartData>
            </Chart:C1Chart.Data>
            <Chart:C1ChartLegend Position="Right" VerticalContentAlignment="Center"/>
        </Chart:C1Chart>
        
    </Grid>
</UserControl>
