RadPieChart not showing label

2 posts, 1 answers
  1. Igor
    Igor avatar
    29 posts
    Member since:
    Mar 2012

    Posted 16 May 2013 Link to this post

    I have an app with a WP7 and WP8 build. I have a RadPieChart defined as

       <DataTemplate x:Key="LabelTemplate">
                <TextBlock Text="{Binding}"
                           Foreground="White" />
            </DataTemplate>

    <chart:RadPieChart Palette="Warm"
                                               x:Name="expensesChart"
                                               Height="360"
                                               Width="360"
                                               HorizontalAlignment="Left">
                                <chart:PieSeries ShowLabels="True"
                                                 LabelTemplate="{StaticResource LabelTemplate}"
                                                 ValueBinding="Sum"
                                                 ItemsSource="{Binding ExpenseStats}">
     
                                    <chart:PieSeries.LabelDefinitions>
                                        <chart:ChartSeriesLabelDefinition Binding="Category" />
                                    </chart:PieSeries.LabelDefinitions>
     
                                </chart:PieSeries>
                            </chart:RadPieChart>

    This code works fine in WP7 build of the app and shows Category as the label for each item. However, in WP8 build of the app, the labels are shown as Telerik.Charting.PieDataPoint for each item (sceenshot: https://pbs.twimg.com/media/BKWX0LqCcAAvv64.png:large).

    Is there something different in the RadPieChart for WP8? I noticed then when I do not use the LabelTemplate, then the label is shown ok on WP8 but I do not know how to change its color.
  2. Answer
    Victor
    Admin
    Victor avatar
    1351 posts

    Posted 21 May 2013 Link to this post

    Hi Igor,

    Thanks for the question.

    RadChart for WP8 was updated with several new features and also refactoring of existing ones. One of the few breaking changes introduced is the behavior you are describing. The DataContext of your data templates is no longer a string but the chart data point itself. This allows a lot more flexibility when defining the data template since you have access to the full data object that the chart data point represents. You have to modify your binding slightly. Instead of simply {Binding} it should be {Binding Percent}. You can also specify string format in the binding if you want to display the percent sign.

    Please write again if you have other questions.

    Kind regards,
    Victor
    the Telerik team
    Have a suggestion or face a problem - you can use the Ideas & Feedback portal to submit ideas, feedback and vote for them.
  3. DevCraft banner
Back to Top