FlexChart | ComponentOne
FlexPie / WPF Multiple Pie Charts
In This Topic
    WPF Multiple Pie Charts
    In This Topic

    In some scenarios, you might want to visualize a bit more than a single pie chart, and use multiple Pie Charts together. The FlexPie control  empowers a user to create multiple Pie Charts based on the same data source. The user can create multiple pie charts by simply specifying several comma-separated strings of field names in the Binding property of FlexPie class. This means you don't have to add any additional FlexPie controls for multiple Pie Charts.

    Multiple Pie Charts can help compare data across different groups. It is also the right visualization choice to present key indicators/facts about your topic of interest.

    The following image shows two Pie Charts, Online Sales and Offline Sales for five different products. Computer, Software, CellPhones, Video Games and Musical Instruments.

    WPF Multiple Pie Chart

     

    Adding multiple pie charts using the same data source is depicted programmatically below:

    Code
    Copy Code
    <Window.Resources>
            <x:Array Type="{x:Type sys:String}" x:Key="MyMultipleTitles">
                <sys:String>Online Sales</sys:String>
                <sys:String>Offline Sales</sys:String>
            </x:Array>
        </Window.Resources>
        <Grid>
            <c1:C1FlexPie x:Name="flexPie" ItemsSource="{Binding}"
    Header="Products Sales By Season" Binding="Online,Offline" BindingName="Name"
    HorizontalAlignment="Left" Height="300" Margin="233,69,0,0" VerticalAlignment="Top"
    Width="300" Titles="{StaticResource MyMultipleTitles}">
           
            </c1:C1FlexPie>
        </Grid>
    </Window>
    
    Code
    Copy Code
    flexPie.ItemsSource = data;
                 flexPie.BindingName = "Name";
                 flexPie.Binding = "Online,Offline";
                 flexPie.Titles = new[] { "Online Sales", "Offline Sales" };
                 flexPie.Header = "Product Sales By Season";
    
    Code
    Copy Code
     Private Sub Window_Loaded(sender As Object, e As RoutedEventArgs)
             flexPie.ItemsSource = _data
             flexPie.BindingName = "Name"
             flexPie.Binding = "Online,Offline"
            flexPie.Titles = {"Online Sales", "Offline Sales"}
             flexPie.Header = "Product Sales By Season"
         End Sub