PivotGrid & Pie integration

2 posts, 0 answers
  1. Stefania
    Stefania avatar
    152 posts
    Member since:
    May 2013

    Posted 23 Nov 2017 Link to this post

    Hi, is it possible to integrate the pivot with a pie chart?

     

    Something like this but with a pie
    https://docs.telerik.com/devtools/wpf/controls/radpivotgrid/features/radchartview-integration

     

    Thank you

  2. Dilyan Traykov
    Admin
    Dilyan Traykov avatar
    813 posts

    Posted 28 Nov 2017 Link to this post

    Hello Stefania,

    Indeed, you can place any kind of chart inside your custom user control. You simply have to take the PivotChartViewModel's SeriesSource property which is of type ReadOnlyCollection<PivotChartItemsCollection> and decide how exactly you want to visualize the data. Please note that each series has an Items collection of type IEnumerable<PivotChartItem> holding the individual items.

    One approach would be to use an ItemsControl with the SeriesSource as its ItemsSource and a PieChart in its ItemTemplate. I'm attaching a small sample project based on the article you referenced to demonstrate what I have in mind. Here's the code of interest:

    <UserControl.DataContext>
        <pivot:PivotChartViewModel DataProvider="{Binding DataProvider, RelativeSource={RelativeSource AncestorType=local:PivotChartUserControl}}"/>
    </UserControl.DataContext>
    <Grid>
        <ItemsControl ItemsSource="{Binding SeriesSource}">
            <ItemsControl.ItemsPanel>
                <ItemsPanelTemplate>
                    <UniformGrid Columns="3" />
                </ItemsPanelTemplate>
            </ItemsControl.ItemsPanel>
            <ItemsControl.ItemTemplate>
                <DataTemplate>
                    <telerik:RadPieChart Palette="Windows8">
                        <telerik:PieSeries ValueBinding="Value" ItemsSource="{Binding Items}" />
                    </telerik:RadPieChart>
                </DataTemplate>
            </ItemsControl.ItemTemplate>
        </ItemsControl>
    </Grid>

    Of course, you're free to modify this chart to suit your needs.

    Please let me know whether such an approach would work for you. If that is not the case, please provide more details on your exact requirements and I will gladly assist you further.

    Regards,
    Dilyan Traykov
    Progress Telerik
    Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
Back to Top