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

Customize Pie Chart Smart Labels Position

1 Answer 143 Views
ChartView
This is a migrated thread and some comments may be shown as answers.
Shane
Top achievements
Rank 1
Shane asked on 20 Jul 2018, 08:57 AM

I have a requirement where I need to show a two sections on a pie chart. One section will the total and another section will be a consumed part (eg. Total = 100, Spent = 30) . Please refer to the image.

My main issue is , how can I modify the display mode so that it displays it outside of the piechart but has the connector on the lines of the division of the sections like in the image?

1 Answer, 1 is accepted

Sort by
0
Martin Ivanov
Telerik team
answered on 24 Jul 2018, 11:59 AM
Hello Shane,

The required alignment is not supported out of the box by the smart labels feature. However, you can customize the default label connectors by overriding the GetLabelConnector() method of the series. Here is an example in code:
public class CustomPieSeries : PieSeries
{
    protected override List<Point> GetLabelConnector(ChartSeriesLabelPositionInfo info)
    {
        var points = base.GetLabelConnector(info);           
        // modify the points collection or create a new one here.
        return points;
    }
}

I hope that helps.

Regards,
Martin Ivanov
Progress Telerik
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
Tags
ChartView
Asked by
Shane
Top achievements
Rank 1
Answers by
Martin Ivanov
Telerik team
Share this question
or