Solution:
To add a label in the center of a donut chart in .NET MAUI, overlaying a Label on top of the RadPieChart using a Grid.
Here’s how to ensure your label is perfectly centered both vertically and horizontally:
<Grid>
<telerik:RadPieChart>
<telerik:RadPieChart.Series>
<telerik:DonutSeries ShowLabels="True"
RadiusFactor="0.7"
InnerRadiusFactor="0.8"
ValueBinding="Value"
ItemsSource="{Binding Data}" />
</telerik:RadPieChart.Series>
</telerik:RadPieChart>
<Grid
HorizontalOptions="Center"
VerticalOptions="Center"
InputTransparent="True">
<Label Text="75%"
HorizontalOptions="Center"
VerticalOptions="Center"
FontSize="24"
TextColor="Black"/>
</Grid>
</Grid>Key Points:
The overlay Grid is centered using HorizontalOptions and VerticalOptions, and InputTransparent="True" ensures that the label does not block interaction with the chart.
The Label is centered inside the overlay Grid. Adjust FontSize and TextColor as needed for your design.
Remove unnecessary padding and background from the overlay Grid for a clean look.
Regards,
Didi
Progress Telerik