Pie Chart Manual Series Mapping

2 posts, 0 answers
  1. Sirum
    Sirum avatar
    5 posts
    Member since:
    Aug 2011

    Posted 11 Jan 2012 Link to this post

    Hi,
    I an trying to create a PieChart like:

    <chart:RadChart
                                    Name="qwe"
                                    Content="RadChart"
                                    ItemsSource="{Binding PieChartItems}">
                                    <chart:RadChart.DefaultView>
                                        <charting:ChartDefaultView>
                                            <charting:ChartDefaultView.ChartArea/>
                                            <charting:ChartDefaultView.ChartTitle>
                                                <charting:ChartTitle Content="CHART TITLE"/>
                                            </charting:ChartDefaultView.ChartTitle>
                                            <charting:ChartDefaultView.ChartLegend>
                                                <charting:ChartLegend
                                                    x:Name="ChartLegend2"
                                                    Visibility="Visible"
                                                    Header="ABC"
                                                    Padding="0,0,5,0"
                                                    HorizontalContentAlignment="Right"
                                                    BorderThickness="0"
                                                    Background="Transparent"/>
                                            </charting:ChartDefaultView.ChartLegend>
                                        </charting:ChartDefaultView>
                                    </chart:RadChart.DefaultView>

    The problem is where in the code I should add a manual series mapping in order to bind labels to a collection in VM.
  2. Nikolay
    Admin
    Nikolay avatar
    385 posts

    Posted 16 Jan 2012 Link to this post

    Hi,

    Please, have a look at the following code snippet, which demonstrates how you can create a Pie chart :
    <telerik:RadChart ItemsSource="{Binding Data}" x:Name="chart">
                    <telerik:RadChart.SeriesMappings>
                        <telerik:SeriesMapping   >
                            <telerik:SeriesMapping.SeriesDefinition>
                                <telerik:PieSeriesDefinition/>
                            </telerik:SeriesMapping.SeriesDefinition>
                            <telerik:SeriesMapping.ItemMappings>
                                <telerik:ItemMapping DataPointMember="YValue" FieldName="Value1" ></telerik:ItemMapping>
                                <telerik:ItemMapping DataPointMember="LegendLabel"  FieldName="LegendName" ></telerik:ItemMapping>
                            </telerik:SeriesMapping.ItemMappings>
                        </telerik:SeriesMapping>
                    </telerik:RadChart.SeriesMappings>
      
                    <telerik:RadChart.DefaultView>
                        <telerik:ChartDefaultView>
                            <telerik:ChartDefaultView.ChartLegend>
                                <telerik:ChartLegend x:Name="Legend" Header="Legend" >
                                </telerik:ChartLegend>
                            </telerik:ChartDefaultView.ChartLegend>
                            <telerik:ChartDefaultView.ChartArea>
                                <telerik:ChartArea LegendName="Legend">
                                </telerik:ChartArea>
                            </telerik:ChartDefaultView.ChartArea>
                        </telerik:ChartDefaultView>
                    </telerik:RadChart.DefaultView>
                </telerik:RadChart>

    Hope this helps.

    Greetings,
    Nikolay
    the Telerik team
    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
  3. UI for WPF is Visual Studio 2017 Ready
Back to Top