Pie Chart with two information in the label

2 posts, 0 answers
  1. Gifer
    Gifer avatar
    11 posts
    Member since:
    Oct 2010

    Posted 05 Nov 2010 Link to this post


    I would like to visualize a 2d pie chart with two labels. Basically I want each slice to have a label with two different information.

    For example I want to show the percentage and the Name. Right now I'm only able to show either one.
    This is the code



    SeriesMapping seriesMapping = new SeriesMapping()



    ChartArea = chartArea,





    PieSeriesDefinition pie = new PieSeriesDefinition();


    pie.RadiusFactor = 0.5;

    pie.ShowItemToolTips =




    pie.LabelSettings.ShowConnectors =




    pie.LabelSettings.ShowZeroValueLabels =




    pie.LabelSettings.SpiderModeEnabled =





    seriesMapping.SeriesDefinition = pie;




    new ItemMapping("Value", DataPointMember.YValue));




    new ItemMapping("Name", DataPointMember.Label));



    seriesMapping.ChartArea.EnableAnimations =







    pieChart.ItemsSource = items;




    Thank you

  2. Evgenia
    Evgenia avatar
    1437 posts

    Posted 10 Nov 2010 Link to this post

    Hello Fernando,

    To be able to show Percentage and Name as Pie Item's Label here is what you can do:
    Use Format Expression (http://www.telerik.com/help/silverlight/radchart-features-format-expressions.html) and specifically the #DATAITEM token and set Percentage and Name for Series Items Labels of the Pie like this:
    seriesMapping.SeriesDefinition.ItemLabelFormat = "#% - #DATAITEM.Name";
    #% defines the Percentage of the Pie's slice and Name is the name of the property you need to show in the label.

    All the best,
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Back to Top