menu

MAUI Toolkit

  • User Guide
  • Demos
  • Support
Class DoughnutSeries - MAUI-ToolKit API Reference | Syncfusion

    Show / Hide Table of Contents

    Class DoughnutSeries

    The DoughnutSeries displays data as a proportion of the whole. Its most commonly used to make comparisons among a set of given data.

    Inheritance
    System.Object
    ChartSeries
    CircularSeries
    PieSeries
    DoughnutSeries
    Inherited Members
    ChartSeries.CreateAnimation(Action<Double>)
    ChartSeries.DrawSeries(ICanvas, ReadOnlyObservableCollection<ChartSegment>, RectF)
    ChartSeries.EnableAnimation
    ChartSeries.EnableAnimationProperty
    ChartSeries.EnableTooltip
    ChartSeries.EnableTooltipProperty
    ChartSeries.Fill
    ChartSeries.FillProperty
    ChartSeries.GetDataPointIndex(Single, Single)
    ChartSeries.IsVisible
    ChartSeries.IsVisibleOnLegend
    ChartSeries.IsVisibleOnLegendProperty
    ChartSeries.IsVisibleProperty
    ChartSeries.ItemsSource
    ChartSeries.ItemsSourceProperty
    ChartSeries.LabelContext
    ChartSeries.LabelContextProperty
    ChartSeries.LabelTemplate
    ChartSeries.LabelTemplateProperty
    ChartSeries.LegendIcon
    ChartSeries.LegendIconProperty
    ChartSeries.ListenPropertyChange
    ChartSeries.ListenPropertyChangeProperty
    ChartSeries.Opacity
    ChartSeries.OpacityProperty
    ChartSeries.PaletteBrushes
    ChartSeries.PaletteBrushesProperty
    ChartSeries.SelectionBehavior
    ChartSeries.SelectionBehaviorProperty
    ChartSeries.ShowDataLabels
    ChartSeries.ShowDataLabelsProperty
    ChartSeries.TooltipTemplate
    ChartSeries.TooltipTemplateProperty
    ChartSeries.XBindingPath
    ChartSeries.XBindingPathProperty
    ChartSeries.XRange
    ChartSeries.YRange
    CircularSeries.DataLabelSettings
    CircularSeries.DataLabelSettingsProperty
    CircularSeries.DrawDataLabel(ICanvas, Brush, String, PointF, Int32)
    CircularSeries.EndAngle
    CircularSeries.EndAngleProperty
    CircularSeries.Radius
    CircularSeries.RadiusProperty
    CircularSeries.StartAngle
    CircularSeries.StartAngleProperty
    CircularSeries.Stroke
    CircularSeries.StrokeProperty
    CircularSeries.StrokeWidth
    CircularSeries.StrokeWidthProperty
    CircularSeries.YBindingPath
    CircularSeries.YBindingPathProperty
    PieSeries.ExplodeAll
    PieSeries.ExplodeAllProperty
    PieSeries.ExplodeIndex
    PieSeries.ExplodeIndexProperty
    PieSeries.ExplodeOnTouch
    PieSeries.ExplodeOnTouchProperty
    PieSeries.ExplodeRadius
    PieSeries.ExplodeRadiusProperty
    PieSeries.GroupMode
    PieSeries.GroupModeProperty
    PieSeries.GroupTo
    PieSeries.GroupToProperty
    Namespace: Syncfusion.Maui.Toolkit.Charts
    Assembly: Syncfusion.Maui.Toolkit.dll
    Syntax
    public class DoughnutSeries : PieSeries, IDatapointSelectionDependent, ITooltipDependent, IDataTemplateDependent, IDrawCustomLegendIcon
    Remarks

    It is similar to the PieSeries. To render a series, create an instance of the doughnut series class, and add it to the Series collection.

    It Provides options for PaletteBrushes, Fill, Stroke, StrokeWidth, and InnerRadius to customize the appearance.

    EnableTooltip - The tooltip displays information while tapping or mouse hovering on the segment. To display the tooltip on the chart, you need to set the EnableTooltip property as true in DoughnutSeries and refer to the TooltipBehavior property.

    Data Label - Data labels are used to display values related to a chart segment. To render the data labels, you need to set the ShowDataLabels property as true in the DoughnutSeries class. To customize the chart data labels’ alignment, placement, and label styles, you need to create an instance of CircularDataLabelSettings and set it to the DataLabelSettings property.

    Animation - To animate the series, set True to the EnableAnimation property.

    Selection - To enable the data point selection in the series, create an instance of the DataPointSelectionBehavior and set it to the SelectionBehavior property of the doughnut series. To highlight the selected segment, set the value for the SelectionBrush property in the DataPointSelectionBehavior class.

    LegendIcon - To customize the legend icon using the LegendIcon property.

    Examples
    • Xaml
    • C#
    • ViewModel
        <chart:SfCircularChart>
    
              <chart:SfCircularChart.Series>
                  <chart:DoughnutSeries
                      ItemsSource="{Binding Data}"
                      XBindingPath="XValue"
                      YBindingPath="YValue"/>
              </chart:SfCircularChart.Series>
    
        </chart:SfCircularChart>
        SfCircularChart chart = new SfCircularChart();
    
        ViewModel viewModel = new ViewModel();
    
        DoughnutSeries series = new DoughnutSeries();
        series.ItemsSource = viewModel.Data;
        series.XBindingPath = "XValue";
        series.YBindingPath = "YValue";
        chart.Series.Add(series);
        public ObservableCollection<Model> Data { get; set; }
    
        public ViewModel()
        {
           Data = new ObservableCollection<Model>();
           Data.Add(new Model() { XValue = 10, YValue = 100 });
           Data.Add(new Model() { XValue = 20, YValue = 150 });
           Data.Add(new Model() { XValue = 30, YValue = 110 });
           Data.Add(new Model() { XValue = 40, YValue = 230 });
        }

    Constructors

    DoughnutSeries()

    Initializes a new instance of the DoughnutSeries class.

    Declaration
    public DoughnutSeries()

    Fields

    CapStyleProperty

    Identifies the CapStyle bindable property.

    Declaration
    public static readonly BindableProperty CapStyleProperty
    Field Value
    Type
    Microsoft.Maui.Controls.BindableProperty
    Remarks

    The CapStyle property represents the shape of the start and end points of a doughnut segment.

    CenterViewProperty

    Identifies the CenterView bindable property.

    Declaration
    public static readonly BindableProperty CenterViewProperty
    Field Value
    Type
    Microsoft.Maui.Controls.BindableProperty
    Remarks

    Represents the view at the center of the doughnut series.

    GapRatioProperty

    Identifies the GapRatio bindable property.

    Declaration
    public static readonly BindableProperty GapRatioProperty
    Field Value
    Type
    Microsoft.Maui.Controls.BindableProperty
    Remarks

    The GapRatio property defines the space between segments

    InnerRadiusProperty

    Identifies the InnerRadius bindable property.

    Declaration
    public static readonly BindableProperty InnerRadiusProperty
    Field Value
    Type
    Microsoft.Maui.Controls.BindableProperty
    Remarks

    Represents the inner radius of the doughnut series, defining the size of the hole in the center.

    Properties

    CapStyle

    Gets or sets the CapStyle value, that represents the shape of the start and end points of a doughnut segment.

    Declaration
    public CapStyle CapStyle { get; set; }
    Property Value
    Type Description
    CapStyle

    It accepts CapStyle values, and its default value is BothFlat

    Examples
    • Xaml
    • C#
    <chart:SfCircularChart>
    
        <chart:SfCircularChart.BindingContext>
            <local:ViewModel/>
        </chart:SfCircularChart.BindingContext>
    
        <chart:DoughnutSeries ItemsSource="{Binding Data}"
                              XBindingPath="XValue"
                              YBindingPath="YValue"
                              CapStyle="BothCurve"/>  
    
    </chart:SfCircularChart>
    SfCircularChart chart = new SfCircularChart();
    
    ViewModel viewModel = new ViewModel();
    chart.BindingContext = viewModel;
    
    DoughnutSeries series = new DoughnutSeries()
    {
        ItemsSource = viewModel.Data,
        XBindingPath = "XValue",
        YBindingPath = "YValue",
        CapStyle = CapStyle.BothCurve
    };
    
    chart.Series.Add(series);

    CenterHoleSize

    Gets the size of the doughnut center hole.

    Declaration
    public double CenterHoleSize { get; }
    Property Value
    Type Description
    System.Double

    Default value is 1.

    CenterView

    Gets or sets the view to be added to the center of the doughnut.

    Declaration
    public View CenterView { get; set; }
    Property Value
    Type Description
    Microsoft.Maui.Controls.View

    It accepts the Microsoft.Maui.Controls.View values and its defaults is null.

    GapRatio

    Gets or sets a value to adjust spacing between segments

    Declaration
    public double GapRatio { get; set; }
    Property Value
    Type Description
    System.Double

    It accepts double values, and the default value is 0. Here, the value is between 0 and 1.

    Examples
    • Xaml
    • C#
    <chart:SfCircularChart>
    
        <chart:DoughnutSeries ItemsSource = "{Binding Data}"
                              XBindingPath = "XValue"
                              YBindingPath = "YValue"
                              GapRatio = "0.5"/>
    
    </chart:SfCircularChart>
    SfCircularChart chart = new SfCircularChart();
    ViewModel viewModel = new ViewModel();
    
    DoughnutSeries series = new DoughnutSeries()
    {
         ItemsSource = viewModel.Data,
         XBindingPath = "XValue",
         YBindingPath = "YValue",
         GapRatio = 0.5,
    };
    
    chart.Series.Add(series);

    InnerRadius

    Gets or sets a value that can be used to define the inner circle.

    Declaration
    public double InnerRadius { get; set; }
    Property Value
    Type Description
    System.Double

    It accepts double values, and the default value is 0.4. Here, the value is between 0 and 1.

    Examples
    • Xaml
    • C#
        <chart:SfCircularChart>
    
             <chart:DoughnutSeries ItemsSource="{Binding Data}"
                                   XBindingPath="XValue"
                                   YBindingPath="YValue"
                                   InnerRadius = "0.5"/>
    
        </chart:SfCircularChart>
        SfCircularChart chart = new SfCircularChart();
        ViewModel viewModel = new ViewModel();
    
        DoughnutSeries series = new DoughnutSeries()
        {
              ItemsSource = viewModel.Data,
              XBindingPath = "XValue",
              YBindingPath = "YValue",
              InnerRadius = 0.5,
        };
    
        chart.Series.Add(series);

    Methods

    CreateSegment()

    Creates and initializes a new chart segment for the chart.

    Declaration
    protected override ChartSegment CreateSegment()
    Returns
    Type
    ChartSegment
    Overrides
    PieSeries.CreateSegment()
    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved