Pie Chart - Datapoint positioning

2 posts, 1 answers
  1. Sintayehu
    Sintayehu avatar
    67 posts
    Member since:
    Jan 2013

    Posted 14 Sep 2009 Link to this post

    I need to position my datapoints outside of the pie.

    1 - far out from the pie area with an arrow pointing to the pie slice.

    2- on the legend Label

    DataSeries capacitySeries = this.FillRadChartWithCapacityData((SomeObject)InnerCapcityLayout.DataContext);

    capacitySeries.Definition = new PieSeriesDefinition();

    capacitySeries.Definition.LegendDisplayMode = LegendDisplayMode.DataPointLabel;

    ((PieSeriesDefinition)capacitySeries.Definition).LabelOffset = 1d;

    capacitySeries.Definition.DefaultLabelFormat = "#%{p1}";

    I am looking for something like capacitySeries.Definition.  Position it outside

    Thanx for your help!

  2. Answer
    Giuseppe
    Admin
    Giuseppe avatar
    2363 posts

    Posted 17 Sep 2009 Link to this post

    Hello luay,

    Onto your questions:

    • Unfortunately the current version of the control does not provide support for label connectors and it would not be possible to achieve the desired effect.
    • Generally this is possible -- you only need to specify an ItemMapping to associate the DataPointMember.LegendLabel with the respective field. However, note that there is no way to apply formatting on the legend label at the moment i.e. the formatting will be applied only on the pie labels and the legend labels will contain the original DataPoint values:

    public partial class MainPage : UserControl 
        public MainPage() 
        { 
            InitializeComponent(); 
     
            RadChart1.DefaultSeriesDefinition = new PieSeriesDefinition() { DefaultLabelFormat = "#%{p1}" }; 
     
            SeriesMapping sm = new SeriesMapping(); 
            sm.ItemMappings.Add(new ItemMapping("YValue", DataPointMember.YValue)); 
            sm.ItemMappings.Add(new ItemMapping("YValue", DataPointMember.LegendLabel)); 
     
            List<ChartData> data = new List<ChartData>() 
            { 
                new ChartData(10), 
                new ChartData(46), 
                new ChartData(27), 
                new ChartData(15), 
                new ChartData(29) 
            }; 
     
            RadChart1.SeriesMappings.Add(sm); 
            RadChart1.ItemsSource = data
        } 
     
    public class ChartData 
        public ChartData(double y) 
        { 
            this.YValue = y
        } 
     
        public double YValue 
        { 
            get; 
            set; 
        } 


    Kind regards,
    Manuel
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Back to Top