This is a migrated thread and some comments may be shown as answers.

PivotGrid & Pie integration

1 Answer 94 Views
PivotGrid
This is a migrated thread and some comments may be shown as answers.
Stefania
Top achievements
Rank 2
Stefania asked on 23 Nov 2017, 04:12 PM

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

1 Answer, 1 is accepted

Sort by
0
Dilyan Traykov
Telerik team
answered on 28 Nov 2017, 02:55 PM
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.
Tags
PivotGrid
Asked by
Stefania
Top achievements
Rank 2
Answers by
Dilyan Traykov
Telerik team
Share this question
or