This is a migrated thread and some comments may be shown as answers.

Pie Chart - Datapoint positioning

1 Answer 128 Views
Chart
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Sintayehu
Top achievements
Rank 1
Sintayehu asked on 14 Sep 2009, 09:06 PM

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!

1 Answer, 1 is accepted

Sort by
0
Accepted
Giuseppe
Telerik team
answered on 17 Sep 2009, 02:42 PM
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.
Tags
Chart
Asked by
Sintayehu
Top achievements
Rank 1
Answers by
Giuseppe
Telerik team
Share this question
or