Class SfSunburstChart
Represents hierarchical data with concentric circles, where each ring signifies a hierarchy level, and segments denote data categories.
Inheritance
Implements
Namespace: Syncfusion.Maui.SunburstChart
Assembly: Syncfusion.Maui.SunburstChart.dll
Syntax
public class SfSunburstChart : View, IContentView, IView, IElement, ITransform, IPadding, ICrossPlatformLayout, ITouchListener, ITapGestureListener, IGestureListener, IParentThemeElement, IThemeElement
Remarks
The Sunburst chart control ensures a well-defined hierarchical structure of the data and effectively communicates relationships between different levels of information.
SfSunburstChart class properties provide an option to add the levels collection, allowing customization of the chart elements such as legend, data label, center view, and tooltip features.
Levels
Levels are used to visualize different layers or depths in a hierarchy, aiding in the visualization of structured data. SfSunburstChart offers Levels property.
To add the levels, create an instance of the required SunburstHierarchicalLevel class, and add it to the GroupMemberPath property.
<sunburst:SfSunburstChart ItemsSource="{Binding DataSource}" ValueMemberPath="EmployeesCount">
<sunburst:SfSunburstChart.BindingContext>
<model:SunburstViewModel x:Name="viewModel"/>
</sunburst:SfSunburstChart.BindingContext>
<sunburst:SfSunburstChart.Levels>
<sunburst:SunburstHierarchicalLevel GroupMemberPath = "Country" />
<sunburst:SunburstHierarchicalLevel GroupMemberPath = "JobDescription" />
<sunburst:SunburstHierarchicalLevel GroupMemberPath = "JobRole" />
</sunburst:SfSunburstChart.Levels>
</sunburst:SfSunburstChart>
Legend
The Legend includes data points from the first-level items. The information provided in each legend item helps identify the corresponding sunburst sub levels. The Levels of GroupMemberPath property value will be displayed in the legend item.
To render a legend, create an instance of SunburstLegendand assign it to the Legend property.
<sunburst:SfSunburstChart ItemsSource="{Binding DataSource}" ValueMemberPath="EmployeesCount">
<sunburst:SfSunburstChart.BindingContext>
<model:SunburstViewModel x:Name="viewModel"/>
</sunburst:SfSunburstChart.BindingContext>
<sunburst:SfSunburstChart.Legend>
<sunburst:SunburstLegend x:Name="legend" >
</sunburst:SunburstLegend>
<sunburst:SfSunburstChart.Levels>
<sunburst:SunburstHierarchicalLevel GroupMemberPath = "Country" />
<sunburst:SunburstHierarchicalLevel GroupMemberPath = "JobDescription" />
<sunburst:SunburstHierarchicalLevel GroupMemberPath = "JobRole" />
</sunburst:SfSunburstChart.Levels>
</sunburst:SfSunburstChart>
Data Label
Data labels are used to display values related to a sunburst chart segment. To render the data labels, you need to enable the ShowLabels property as true in SfSunburstChart class.
To customize the sunburst chart data labels rotation mode using SunburstLabelRotationMode and its default value is Angle, overflow mode using SunburstLabelOverflowMode and its default value is Hide, and label styles, you need to create an instance of SunburstDataLabelSettings and set it to the DataLabelSettings property.
<sunburst:SfSunburstChart ItemsSource="{Binding DataSource}"
ShowLabels="True" ValueMemberPath="EmployeesCount">
<sunburst:SfSunburstChart.BindingContext>
<model:SunburstViewModel x:Name="viewModel"/>
</sunburst:SfSunburstChart.BindingContext>
<sunburst:SfSunburstChart.DataLabelSettings>
<sunburst:SunburstDataLabelSettings FontSize="13" FontAttributes="Italic"
RotationMode="Angle" OverFlowMode="Trim" />
</sunburst:SfSunburstChart.DataLabelSettings>
<sunburst:SfSunburstChart.Levels>
<sunburst:SunburstHierarchicalLevel GroupMemberPath = "Country" />
<sunburst:SunburstHierarchicalLevel GroupMemberPath = "JobDescription" />
<sunburst:SunburstHierarchicalLevel GroupMemberPath = "JobRole" />
</sunburst:SfSunburstChart.Levels>
</sunburst:SfSunburstChart>
Tooltip
Tooltip displays information while tapping or mouse hovering on the segment. To display the tooltip on the sunburst chart, you need to set the EnableTooltip property as true in SfSunburstChart.
To customize the appearance of the tooltip elements like Background, TextColor, and Font, create an instance of the SunburstTooltipSettings class, modify the values, and assign it to the TooltipSettings property in SfSunburstChart.
<sunburst:SfSunburstChart ItemsSource="{Binding DataSource}"
EnableTooltip="True" ValueMemberPath="EmployeesCount">
<sunburst:SfSunburstChart.BindingContext>
<model:SunburstViewModel x:Name="viewModel"/>
</sunburst:SfSunburstChart.BindingContext>
<sunburst:SfSunburstChart.TooltipSettings>
<sunburst:SunburstTooltipSettings />
</sunburst:SfSunburstChart.TooltipSettings>
<sunburst:SfSunburstChart.Levels>
<sunburst:SunburstHierarchicalLevel GroupMemberPath = "Country" />
<sunburst:SunburstHierarchicalLevel GroupMemberPath = "JobDescription" />
<sunburst:SunburstHierarchicalLevel GroupMemberPath = "JobRole" />
</sunburst:SfSunburstChart.Levels>
</sunburst:SfSunburstChart>
[MainPage.xaml.cs](#tab/tabid-10
SfSunburstChart sunburstChart = new SfSunburstChart();
this.BindingContext = new SunburstViewModel();
sunburstChart.TooltipSettings = new SunburstTooltipSettings();
sunburstChart.SetBinding(SfSunburstChart.ItemsSourceProperty, "DataSource");
sunburstChart.ValueMemberPath = "EmployeesCount";
sunburstChart.EnableTooltip = true;
sunburstChart.Levels.Add(new SunburstHierarchicalLevel() { GroupMemberPath = "Country" });
sunburstChart.Levels.Add(new SunburstHierarchicalLevel() { GroupMemberPath = "JobDescription" });
sunburstChart.Levels.Add(new SunburstHierarchicalLevel() { GroupMemberPath = "JobGroup" });
sunburstChart.Levels.Add(new SunburstHierarchicalLevel() { GroupMemberPath = "JobRole" });
this.Content = sunburstChart;
CenterView
Center is used to share additional information about the sunburst chart. The binding context of the Centerview will be the respective sunburst. To display the center view on the sunburst chart, you need to set theCenterView property in SfSunburstChart.
CenterHoleSize is used to prevent overlapping with segments in the sunburst center view.
# [MainPage.xaml](#tab/tabid-11)<sunburst:SfSunburstChart ItemsSource="{Binding DataSource}"
ValueMemberPath="EmployeesCount">
<sunburst:SfSunburstChart.BindingContext>
<model:SunburstViewModel x:Name="viewModel"/>
</sunburst:SfSunburstChart.BindingContext>
<sunburst:SfSunburstChart.CenterView>
<StackLayout Orientation="Vertical"
HeightRequest="{Binding CenterHoleSize}"
WidthRequest="{Binding CenterHoleSize}"
HorizontalOptions="CenterAndExpand" VerticalOptions="CenterAndExpand">
<Label Text = "CenterView" />
</StackLayout>
</sunburst:SfSunburstChart.CenterView>
<sunburst:SfSunburstChart.Levels>
<sunburst:SunburstHierarchicalLevel GroupMemberPath = "Country" />
<sunburst:SunburstHierarchicalLevel GroupMemberPath = "JobDescription" />
<sunburst:SunburstHierarchicalLevel GroupMemberPath = "JobRole" />
</sunburst:SfSunburstChart.Levels>
</sunburst:SfSunburstChart>
[MainPage.xaml.cs](#tab/tabid-12
SfSunburstChart sunburstChart = new SfSunburstChart();
this.BindingContext = new SunburstViewModel();
StackLayout layout = new StackLayout();
layout.HorizontalOptions = LayoutOptions.CenterAndExpand;
layout.VerticalOptions = LayoutOptions.CenterAndExpand;
layout.SetBinding(HeightRequestProperty, "CenterHoleSize");
layout.SetBinding(WidthRequestProperty, "CenterHoleSize");
Label label = new Label();
label.Text = "CenterView";
layout.Children.Add(label);
sunburstChart.CenterView = layout;
sunburstChart.SetBinding(SfSunburstChart.ItemsSourceProperty, "DataSource");
sunburstChart.ValueMemberPath = "EmployeesCount";
sunburstChart.Levels.Add(new SunburstHierarchicalLevel() { GroupMemberPath = "Country" });
sunburstChart.Levels.Add(new SunburstHierarchicalLevel() { GroupMemberPath = "JobDescription" });
sunburstChart.Levels.Add(new SunburstHierarchicalLevel() { GroupMemberPath = "JobGroup" });
sunburstChart.Levels.Add(new SunburstHierarchicalLevel() { GroupMemberPath = "JobRole" });
this.Content = sunburstChart;
Constructors
SfSunburstChart()
Initializes a new instance of the SfSunburstChart class.
Declaration
public SfSunburstChart()
Fields
AnimationDurationProperty
Identifies the AnimationDuration bindable property.
Declaration
public static readonly BindableProperty AnimationDurationProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
CenterViewProperty
Identifies the CenterView bindable property.
Declaration
public static readonly BindableProperty CenterViewProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
DataLabelSettingsProperty
Identifies the DataLabelSettings bindable property.
Declaration
public static readonly BindableProperty DataLabelSettingsProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
EnableAnimationProperty
Identifies the EnableAnimation bindable property.
Declaration
public static readonly BindableProperty EnableAnimationProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
EnableTooltipProperty
Identifies the EnableTooltip bindable property.
Declaration
public static readonly BindableProperty EnableTooltipProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
EndAngleProperty
Identifies the EndAngle bindable property.
Declaration
public static readonly BindableProperty EndAngleProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
InnerRadiusProperty
Identifies the InnerRadius bindable property.
Declaration
public static readonly BindableProperty InnerRadiusProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
ItemsSourceProperty
Identifies the ItemsSource bindable property.
Declaration
public static readonly BindableProperty ItemsSourceProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
LegendProperty
Identifies the Legend bindable property.
Declaration
public static readonly BindableProperty LegendProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
LevelsProperty
Identifies the Levels bindable property.
Declaration
public static readonly BindableProperty LevelsProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
PaletteBrushesProperty
Identifies the PaletteBrushes bindable property.
Declaration
public static readonly BindableProperty PaletteBrushesProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
RadiusProperty
Identifies the Radius bindable property.
Declaration
public static readonly BindableProperty RadiusProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
ShowLabelsProperty
Identifies the ShowLabels bindable property.
Declaration
public static readonly BindableProperty ShowLabelsProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
StartAngleProperty
Identifies the StartAngle bindable property.
Declaration
public static readonly BindableProperty StartAngleProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
StrokeProperty
Identifies the Stroke bindable property.
Declaration
public static readonly BindableProperty StrokeProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
StrokeWidthProperty
Identifies the StrokeWidth bindable property.
Declaration
public static readonly BindableProperty StrokeWidthProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
TitleProperty
Identifies the Title bindable property.
Declaration
public static readonly BindableProperty TitleProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
TooltipSettingsProperty
Identifies the TooltipSettings bindable property.
Declaration
public static readonly BindableProperty TooltipSettingsProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
TooltipTemplateProperty
Identifies the TooltipTemplate bindable property.
Declaration
public static readonly BindableProperty TooltipTemplateProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
ValueMemberPathProperty
Identifies the ValueMemberPath bindable property.
Declaration
public static readonly BindableProperty ValueMemberPathProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
Properties
AnimationDuration
Gets or sets the Animation duration property, used to set the duration for the animation to be done.
Declaration
public double AnimationDuration { get; set; }
Property Value
Type |
---|
System.Double |
CenterHoleSize
Gets the size of the sunburst center hole.
Declaration
public double CenterHoleSize { get; }
Property Value
Type |
---|
System.Double |
CenterView
Gets or sets the view to be added to the center of the sunburst chart.
Declaration
public View CenterView { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.Maui.Controls.View | It accepts any Microsoft.Maui.Controls.View object, and its default value is null. |
DataLabelSettings
Gets or sets a DataLabelSettings, used to customize the appearance of the displaying data labels in the sunburst chart.
Declaration
public SunburstDataLabelSettings DataLabelSettings { get; set; }
Property Value
Type | Description |
---|---|
SunburstDataLabelSettings | This property takes SunburstDataLabelSettings instance as value and its default value is null. |
EnableAnimation
Gets or sets a value indicating whether the animation is enabled for the sunburst chart.
Declaration
public bool EnableAnimation { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | It accepts bool values and its default value is |
EnableTooltip
Gets or sets a value indicating whether the tooltip is visible when mouse hovers or taps on the segment.
Declaration
public bool EnableTooltip { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | It accepts bool values and its default value is |
EndAngle
Gets or sets the end angle for the sunburst chart.
Declaration
public double EndAngle { get; set; }
Property Value
Type | Description |
---|---|
System.Double | It accepts double values, and the default value is 360. |
InnerRadius
Gets or sets the radius property. This property value is used for defining the sunburst size. Value must be specified from 0 to 1.
Declaration
public double InnerRadius { get; set; }
Property Value
Type | Description |
---|---|
System.Double | It accepts double values, and the default value is 0.25. Here, the value is between 0 and 1. |
ItemsSource
Gets or sets a data points collection that will be used to plot a chart.
Declaration
public object ItemsSource { get; set; }
Property Value
Type |
---|
System.Object |
Legend
Gets or sets a legend that is used to display a legend that helps to identify the parent of each level in the sunburst chart.
Declaration
public SunburstLegend Legend { get; set; }
Property Value
Type | Description |
---|---|
SunburstLegend | This property takes a SunburstLegend instance as value and its default value is null. |
Levels
Gets or sets the levels for the sunburst chart.
Declaration
public SunburstLevelCollection Levels { get; set; }
Property Value
Type |
---|
SunburstLevelCollection |
PaletteBrushes
Gets or sets an IList of brush collection property, used as the color scheme for the sunburst chart.
Declaration
public IList<Brush> PaletteBrushes { get; set; }
Property Value
Type |
---|
System.Collections.Generic.IList<Microsoft.Maui.Controls.Brush> |
Radius
Gets or sets the radius property, used for defining the sunburst size.
Declaration
public double Radius { get; set; }
Property Value
Type | Description |
---|---|
System.Double | It accepts double values, and the default value is 0.9. Here, the value is between 0 and 1. |
ShowLabels
Gets or sets a value indicating whether the label is visible.
Declaration
public bool ShowLabels { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | It accepts bool values and its default value is |
StartAngle
Gets or sets the start angle for the Sunburst chart.
Declaration
public double StartAngle { get; set; }
Property Value
Type | Description |
---|---|
System.Double | It accepts double values, and the default value is 0. |
Stroke
Gets or sets the stroke color property used to define the stroke color for the Sunburst chart.
Declaration
public Brush Stroke { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.Maui.Controls.Brush | It accepts Microsoft.Maui.Controls.Brush values and its default value is White/>. |
StrokeWidth
Gets or sets the stroke width property for customizing the width of the sunburst chart segment border.
Declaration
public double StrokeWidth { get; set; }
Property Value
Type | Description |
---|---|
System.Double | It accepts double values and its default value is 1. |
Title
Gets or sets the title for the chart. It supports the string or any view as a title.
Declaration
public object Title { get; set; }
Property Value
Type | Description |
---|---|
System.Object | The default value is null. |
TooltipSettings
Gets or sets the tooltip settings property, used to customize the tooltip.
Declaration
public SunburstTooltipSettings TooltipSettings { get; set; }
Property Value
Type | Description |
---|---|
SunburstTooltipSettings | This property takes SunburstTooltipSettings instance as value and its default value is null. |
TooltipTemplate
Gets or sets the data template for the tooltip, which can customize the tooltip labels.
Declaration
public DataTemplate TooltipTemplate { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.Maui.Controls.DataTemplate | It accepts a Microsoft.Maui.Controls.DataTemplate value. |
ValueMemberPath
Gets or sets path of the value data member in the ItemsSource.
Declaration
public string ValueMemberPath { get; set; }
Property Value
Type | Description |
---|---|
System.String | It accepts string values and its default value is null. |
Methods
OnBindingContextChanged()
Declaration
protected override void OnBindingContextChanged()