How to display label in Pieseries for Phone

Thread is closed for posting
3 posts, 0 answers
  1. enamul
    enamul avatar
    1 posts
    Member since:
    Apr 2012

    Posted 28 Apr 2012 Link to this post

    I am newbie to Telerik controls. Trying to create a pie chart with lables, but not able to find a complete example in Telerik help files.

    <chart:RadPieChart x:Name="gPie" Margin="27,95,143,276" Grid.Row="1" DataContext="{Binding}">
                <chart:PieSeries ShowLabels="True" DataContext="{Binding}">
                        <Style TargetType="Path">
                            <Setter Property="Fill" Value="Magenta"/>
                        <Style TargetType="Path">
                            <Setter Property="Fill" Value="LimeGreen"/>
                        <Style TargetType="Path">
                            <Setter Property="Fill" Value="DarkOrange"/>
                        <Style TargetType="Path">
                            <Setter Property="Fill" Value="Purple"/>
                        <Style TargetType="Path">
                            <Setter Property="Fill" Value="Green"/>
                        <Style TargetType="Path">
                            <Setter Property="Fill" Value="Red"/>
                        <Style TargetType="Path">
                            <Setter Property="Fill" Value="Blue"/>
                            <TextBlock Text="{Binding}"
                                   Foreground="{StaticResource PhoneBackgroundBrush}"

    And I am setting the value in C#:
    this.gPie.Series[0].ItemsSource = new double[] { iFajr, iDohr, iAsr, iMagrib, iEsha, iFasting, iHajj };

    The pie chart displays fine with %-tile lable for each item. But I like to use custom lable for them. How do I do it? Also, Is there a way to display the lables on the side (with a color icon and corresponding text), not on the chart itself?
  2. RoboticPet
    RoboticPet avatar
    2 posts
    Member since:
    Apr 2012

    Posted 30 Apr 2012 Link to this post

    enamul, it looks like you can do part of what you want by using Standard Numeric Format Strings (  E.g. if you set LabelFormat on the PieSeries to "n2" you will get the percentages in decimals of two digits with no percent sign.

    However, what I want to do is just show the actual values that I specified as the PieDataPoints (whole numbers).  What is the recommended way to do that?
  3. Victor
    Victor avatar
    1358 posts

    Posted 02 May 2012 Link to this post

    Hello Enamul,

    Thanks for the question

    If I understood you correctly you are asking whether the chart can display a legend? If this is indeed your requirement you will have to create the legend manually, since RadChart does not yet support automatic legend generation. Currently, all customization of the labels should be done within the LabelTemplate in the pie series. For special formatting you can use a binding converter that converts the actual label string to anything you deem appropriate for your scenario.

    Please write again if you have other questions.

    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Back to Top