How to Change Data Label Connector Type in MAUI CircularChart?
The .NET MAUI Circular Chart allows you to modify the connector type of data labels for Pie and Doughnut series.
To change the connector type, use the ConnectorType property within ConnectorLineStyle. Specify the connector type, either Line or Curve. Setting it to Line connects data labels with straight lines, while setting it to Curve connects data labels with curved lines. By default, the data labels connect with straight lines.
The following code sample illustrates how to connect data labels with curved lines.
[XAML]
<chart:SfCircularChart>
. . .
<chart:DoughnutSeries ItemsSource="{Binding Data}"
ShowDataLabels="True"
XBindingPath="Product"
YBindingPath="SalesRate">
<chart:DoughnutSeries.DataLabelSettings>
<chart:CircularDataLabelSettings LabelPosition="Outside">
<chart:CircularDataLabelSettings.ConnectorLineSettings>
<chart:ConnectorLineStyle ConnectorType="Curve"/>
</chart:CircularDataLabelSettings.ConnectorLineSettings>
</chart:CircularDataLabelSettings>
</chart:DoughnutSeries.DataLabelSettings>
</chart:DoughnutSeries>
</chart:SfCircularChart>
[C#]
SfCircularChart chart = new SfCircularChart();
. . .
DoughnutSeries series = new DoughnutSeries()
{
ItemsSource = viewModel.Data,
XBindingPath = "Product",
YBindingPath = "SalesRate",
ShowDataLabels = true,
};
ConnectorLineStyle connectorLineStyle = new ConnectorLineStyle
{
ConnectorType = ConnectorType.Curve
};
series.DataLabelSettings = new CircularDataLabelSettings()
{
LabelPosition = ChartDataLabelPosition.Outside,
ConnectorLineSettings = connectorLineStyle
};
chart.Series.Add(series);
Output
Conclusion:
I hope you enjoyed learning how to change the data label connector type in the .NET MAUI Circular Chart.
You can refer to our .NET MAUI Circular Chart feature tour page to learn about its other groundbreaking feature representations. Explore our documentation to understand how to present and manipulate data.
For current customers, check out our components from the License and Downloads page. If you are new to Syncfusion®, try our 30-day free trial to check out our other controls.
Please let us know in the comments section if you have any queries or require clarification. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!