Labels for pie charts

6 posts, 0 answers
  1. Russell
    Russell avatar
    3 posts
    Member since:
    Jul 2012

    Posted 06 Jul 2012 Link to this post









    I am having a hard time figuring out how to add labels into my pie chart.  so far I have data bound using an example like so:







    List<PieData> dataSource = new List<PieData>();

    dataSource.Add(new PieData("hey", 13.4));

    dataSource.Add(new PieData("heysda", 50));

    pieChart1.Series[0].ValueBinding = new GenericDataPointBinding<PieData, double>() { ValueSelector = product => product.QuantitySold };

    pieChart1.Series[0].ItemsSource = dataSource;



    My piedata object contains a value and a name handle and I want to know what I need to do to get the pieChart to display the name handle as the legend













  2. Victor
    Admin
    Victor avatar
    1351 posts

    Posted 09 Jul 2012 Link to this post

    Hello Russell,

    Thanks for writing.
    RadChart currently does not support automatic legend generation. You need to declare the legend manually.
    Thanks for the feedback, we will consider implementing a legend in a future release.
    Write again if you have other questions.

    Greetings,
    Victor
    the Telerik team

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

  3. DevCraft banner
  4. Russell
    Russell avatar
    3 posts
    Member since:
    Jul 2012

    Posted 09 Jul 2012 Link to this post

    Not a legend even.  I was wondering if you have a way to auto generate names of the items right next to the percentage being displayed?  otherwise how is anyone supposed to know what the slices mean.  surely their is a way to put labels on the slices
  5. Lancelot
    Lancelot avatar
    251 posts
    Member since:
    Jul 2012

    Posted 09 Jul 2012 Link to this post

    Hi Russell,

    You can show the labels on the Pie Series of RadChart by toggling the property, ShowLabels. You have four properties at your disposal. They are:

    1. LabelOffset
    2. LabelTemplate
    3. AngleRange
    4. ShowLabels

    If you want to learn more on how to use the properties, this link will bring you the documentation for Pie Series.I hope this helps you nail down what you're looking to do.

    Good Luck,
    Lancelot
  6. Russell
    Russell avatar
    3 posts
    Member since:
    Jul 2012

    Posted 09 Jul 2012 Link to this post

    Thanks I actually ended up getting it but decided at I really need is a legend.  Any help would be greatly appreciated.
  7. Victor
    Admin
    Victor avatar
    1351 posts

    Posted 12 Jul 2012 Link to this post

    Hello Russel,

    You can, for example, use an items control, that is bound to a list of different sample data points. This way you can use a custom ItemTemplate to visualize each unique data point. Also, since this component is not a part of RadChart you will have full control over its layout and position in relation to the chart.

    I hope this suggestion was helpful.

    Regards,
    Victor
    the Telerik team

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

Back to Top
DevCraft banner