Articles in this section

How to add a view to the center of the .NET MAUI Doughnut Chart (SfCircularChart)?

The center view of the .NET MAUI Circular Chart is used to share additional information about it. Any view can be added to the doughnut chart center using the CenterView property of the DoughnutSeries, as demonstrated in the following code examples.

XAML

<ContentPage
...
xmlns:chart="clr-namespace:Syncfusion.Maui.Charts;assembly=Syncfusion.Maui.Charts">   <chart:SfCircularChart> .  .  .     <chart:SfCircularChart.Series>           <chart:DoughnutSeries ItemsSource="{Binding Data}" InnerRadius="0.6" XBindingPath="Product" YBindingPath="Revenue" ShowDataLabels="True">               <chart:DoughnutSeries.CenterView>                 <StackLayout>                     <Label Text="Total:" HorizontalOptions="Center"/>                     <Label Text="$35.07K" HorizontalOptions="Center"/>                 </StackLayout>             </chart:DoughnutSeries.CenterView>         .  .  .         </chart:DoughnutSeries>       </chart:SfCircularChart.Series>   </chart:SfCircularChart>

 C#

using Syncfusion.Maui.Charts;
 
SfCircularChart chart = new SfCircularChart();
. . .
DoughnutSeries series = new DoughnutSeries();
chart.Series.Add(series);
series.XBindingPath = "Product";
series.YBindingPath = "Revenue";
series.ItemsSource = new ChartViewModel().Data;
series.InnerRadius = 0.6;
series.ShowDataLabels = true;
 
Label labelOne = new Label();
labelOne.Text = "Total:";
labelOne.HorizontalOptions = LayoutOptions.Center;
Label labelTwo = new Label();
labelTwo.Text = "$35.07K";
labelTwo.HorizontalOptions = LayoutOptions.Center;
StackLayout layout = new StackLayout();
layout.Children.Add(labelOne);
layout.Children.Add(labelTwo);
 
series.CenterView = layout;
. . .
Content = chart;

Output:

Doughnut chart with a center view.


Download the complete sample on GitHub.

Conclusion

I hope you enjoyed learning how to add a view to the doughnut chart center in .NET MAUI Circular Chart (SfCircularChart).

You can refer to our .NET MAUI Circular Chart feature tour page to learn about its other groundbreaking feature representations. Explore our .NET MAUI Circular Chart documentation to understand how to present and manipulate data. 

For current customers, check out our .NET MAUI from the License and Downloads page. If you are new to Syncfusion®, try our 30-day free trial to check out our .NET MAUI Chart and other .NET MAUI components.

Please let us know in the comments section if you have any queries or require clarification. Contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!

 

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Access denied
Access denied