Class SfPyramidChart
Provides the pyramid chart with a unique style of data representation that is more UI-visualising and user-friendly.
Implements
Inherited Members
Namespace: Syncfusion.Maui.Toolkit.Charts
Assembly: Syncfusion.Maui.Toolkit.dll
Syntax
public class SfPyramidChart : ChartBase, IContentView, IView, IElement, ITransform, IPadding, ICrossPlatformLayout, IChart, IPyramidChartDependent, IDatapointSelectionDependent, ITooltipDependent, IDataTemplateDependent, IDrawCustomLegendIcon, ITapGestureListener, IGestureListener, ITouchListener, IParentThemeElement, IThemeElement
Remarks
Pyramid chart control is used to visualize the proportions of a total in hierarchies.
SfPyramidChart class allows to customize the chart elements such as legend, data label, and tooltip features.
<chart:SfPyramidChart ItemsSource="{Binding Data}"
XBindingPath="XValue"
YBindingPath="YValue">
<chart:SfPyramidChart.BindingContext>
<model:ChartViewModel/>
</chart:SfPyramidChart.BindingContext>
</chart:SfPyramidChart>
Legend
The Legend contains list of data points in chart. The information provided in each legend item helps to identify the corresponding data point in pyramid chart. The chart XBindingPath property value will be displayed in the associated legend item.
To render a legend, create an instance of ChartLegend, and assign it to the Legend property.
<chart:SfPyramidChart ItemsSource = "{Binding Data}"
XBindingPath="XValue"
YBindingPath="YValue">
<chart:SfPyramidChart.Legend>
<chart:ChartLegend/>
</chart:SfPyramidChart.Legend>
</chart:SfPyramidChart>
Tooltip
Tooltip displays information while tapping or mouse hover on the segment. To display the tooltip on the chart, you need to set the EnableTooltip property as true in SfPyramidChart.
To customize the appearance of the tooltip elements like Background, TextColor and Font, create an instance of ChartTooltipBehavior class, modify the values, and assign it to the chart’s TooltipBehavior property.
<chart:SfPyramidChart ItemsSource = "{Binding Data}"
XBindingPath="XValue"
YBindingPath="YValue"
EnableTooltip="True">
</chart:SfPyramidChart>
Data Label
Data labels are used to display values related to a chart segment. To render the data labels, you need to enable the ShowDataLabels property as true in SfPyramidChart class.
To customize the chart data labels alignment, placement and label styles, need to create an instance of PyramidDataLabelSettings and set to the DataLabelSettings property.
<chart:SfPyramidChart ItemsSource="{Binding Data}"
XBindingPath="XValue"
YBindingPath="YValue"
ShowDataLabels="True">
</chart:SfPyramidChart>
Constructors
SfPyramidChart()
Initializes a new instance of the SfPyramidChart class.
Declaration
public SfPyramidChart()
Fields
DataLabelSettingsProperty
Identifies the DataLabelSettings bindable property.
Declaration
public static readonly BindableProperty DataLabelSettingsProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
Remarks
The identifier for the DataLabelSettings bindable property determines the customization options for data labels.
EnableTooltipProperty
Identifies the EnableTooltip bindable property.
Declaration
public static readonly BindableProperty EnableTooltipProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
Remarks
The identifier for the EnableTooltip bindable property determines whether tooltips are enabled for the pyramid chart.
GapRatioProperty
Identifies the GapRatio bindable property.
Declaration
public static readonly BindableProperty GapRatioProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
Remarks
The identifier for the GapRatio bindable property determines the gap ratio between the segments of the pyramid chart.
ItemsSourceProperty
Identifies the ItemsSource bindable property.
Declaration
public static readonly BindableProperty ItemsSourceProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
Remarks
The identifier for the ItemsSource bindable property determines the data source for the pyramid chart.
LabelTemplateProperty
Identifies the LabelTemplate bindable property.
Declaration
public static readonly BindableProperty LabelTemplateProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
Remarks
The identifier for the LabelTemplate bindable property determines the template used for data labels.
LegendIconProperty
Identifies the LegendIcon bindable property.
Declaration
public static readonly BindableProperty LegendIconProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
Remarks
The identifier for the LegendIcon bindable property determines the legend icon type for the pyramid chart.
ModeProperty
Identifies the Mode bindable property.
Declaration
public static readonly BindableProperty ModeProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
Remarks
The identifier for the Mode bindable property determines the mode of the pyramid chart.
PaletteBrushesProperty
Identifies the PaletteBrushes bindable property.
Declaration
public static readonly BindableProperty PaletteBrushesProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
Remarks
The identifier for the PaletteBrushes bindable property determines the palette brushes for the pyramid chart.
SelectionBehaviorProperty
Identifies the SelectionBehavior bindable property.
Declaration
public static readonly BindableProperty SelectionBehaviorProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
Remarks
The identifier for the SelectionBehavior bindable property determines the selection behavior for the pyramid chart.
ShowDataLabelsProperty
Identifies the ShowDataLabels bindable property.
Declaration
public static readonly BindableProperty ShowDataLabelsProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
Remarks
The identifier for the ShowDataLabels bindable property determines whether data labels are shown on the pyramid chart.
StrokeProperty
Identifies the Stroke bindable property.
Declaration
public static readonly BindableProperty StrokeProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
Remarks
The identifier for the Stroke bindable property determines the stroke brush used for the pyramid chart segments.
StrokeWidthProperty
Identifies the StrokeWidth bindable property.
Declaration
public static readonly BindableProperty StrokeWidthProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
Remarks
The identifier for the StrokeWidth bindable property determines the width of the stroke for the pyramid chart segments.
TooltipTemplateProperty
Identifies the TooltipTemplate bindable property.
Declaration
public static readonly BindableProperty TooltipTemplateProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
Remarks
The identifier for the TooltipTemplate bindable property determines the template for the pyramid chart tooltip.
XBindingPathProperty
Identifies the XBindingPath bindable property.
Declaration
public static readonly BindableProperty XBindingPathProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
Remarks
The identifier for the XBindingPath bindable property determines the binding path for the X values of the pyramid chart.
YBindingPathProperty
Identifies the YBindingPath bindable property.
Declaration
public static readonly BindableProperty YBindingPathProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
Remarks
The identifier for the YBindingPath bindable property determines the binding path for the Y values of the pyramid chart.
Properties
DataLabelSettings
Gets or sets a value to customize the appearance of the displaying data labels in the chart.
Declaration
public PyramidDataLabelSettings DataLabelSettings { get; set; }
Property Value
Type | Description |
---|---|
PyramidDataLabelSettings | It takes the PyramidDataLabelSettings. |
Remarks
This allows us to customize the appearance and position of data label.
Examples
<chart:SfPyramidChart ItemsSource="{Binding Data}"
XBindingPath="XValue"
YBindingPath="YValue"
ShowDataLabels="True">
<chart:SfPyramidChart.DataLabelSettings>
<chart:PyramidDataLabelSettings />
</chart:SfPyramidChart.DataLabelSettings>
</chart:SfPyramidChart>
EnableTooltip
Gets or sets a Boolean value indicating whether the tooltip for chart should be shown or hidden.
Declaration
public bool EnableTooltip { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | This property takes the |
Remarks
The tooltip will appear when you mouse over or tap on the pyramid segments.
Examples
<chart:SfPyramidChart ItemsSource="{Binding Data}"
XBindingPath="Category"
YBindingPath="Value"
EnableTooltip="True">
</chart:SfPyramidChart>
GapRatio
Gets or sets the ratio of the distance between the chart segments.
Declaration
public double GapRatio { get; set; }
Property Value
Type | Description |
---|---|
System.Double | Its default value is 0. Its value ranges from 0 to 1. |
Remarks
It is used to provide the spacing between the segments
Examples
<chart:SfPyramidChart ItemsSource="{Binding Data}"
XBindingPath="XValue"
YBindingPath="YValue"
GapRatio="0.3">
</chart:SfPyramidChart>
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 | Description |
---|---|
System.Object | It accepts the data points collections and its default value is null. |
Examples
<chart:SfPyramidChart ItemsSource="{Binding Data}"
XBindingPath="XValue"
YBindingPath="YValue">
</chart:SfPyramidChart>
LabelTemplate
Gets or sets the DataTemplate that can be used to customize the appearance of the Data label.
Declaration
public DataTemplate LabelTemplate { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.Maui.Controls.DataTemplate | It accepts the Microsoft.Maui.Controls.DataTemplate value. |
Examples
<chart:SfPyramidChart ItemsSource="{Binding Data}"
XBindingPath="XValue"
YBindingPath="YValue"
ShowDataLabels="True">
<chart:SfPyramidChart.LabelTemplate>
<DataTemplate>
<VerticalStackLayout>
<Image Source="image.png"
WidthRequest="20"
HeightRequest="20"/>
<Label Text="{Binding Item.YValue}"
TextColor="Black"
FontAttributes="Bold"
FontSize="12"/>
</VerticalStackLayout>
</DataTemplate>
</chart:SfPyramidChart.LabelTemplate>
</chart:SfPyramidChart>
LegendIcon
Gets or sets a legend icon that will be displayed in the associated legend item.
Declaration
public ChartLegendIconType LegendIcon { get; set; }
Property Value
Type | Description |
---|---|
ChartLegendIconType | This property takes the list of ChartLegendIconType and its default value is Circle. |
Examples
<chart:SfPyramidChart ItemsSource="{Binding Data}"
XBindingPath="Category"
YBindingPath="Value"
LegendIcon="Diamond">
<chart:SfPyramidChart.Legend>
<chart:ChartLegend />
</chart:SfPyramidChart.Legend>
</chart:SfPyramidChart>
Mode
Gets or sets mode value which indicates the pyramid rendering.
Declaration
public PyramidMode Mode { get; set; }
Property Value
Type |
---|
PyramidMode |
Examples
<chart:SfPyramidChart ItemsSource="{Binding Data}"
XBindingPath="XValue"
YBindingPath="YValue"
Mode="Surface">
</chart:SfPyramidChart>
PaletteBrushes
Gets or sets the list of brushes that can be used to customize the appearance of the chart.
Declaration
public IList<Brush> PaletteBrushes { get; set; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IList<Microsoft.Maui.Controls.Brush> | This property accepts a list of brushes as input and comes with a set of predefined brushes by default. |
Remarks
It allows custom brushes, and gradient brushes to customize the appearance.
Examples
<chart:SfPyramidChart ItemsSource="{Binding Data}"
XBindingPath="Category"
YBindingPath="Value"
PaletteBrushes="{Binding CustomBrushes}">
</chart:SfPyramidChart>
SelectionBehavior
Gets or sets a value for initiating selection or highlighting of a single or multiple data points in the chart.
Declaration
public DataPointSelectionBehavior SelectionBehavior { get; set; }
Property Value
Type | Description |
---|---|
DataPointSelectionBehavior | This property takes a DataPointSelectionBehavior instance as a value, and its default value is null. |
Remarks
To highlight the selected segment, set the value for the SelectionBrush property in the DataPointSelectionBehavior class.
Examples
<chart:SfPyramidChart ItemsSource = "{Binding Data}"
XBindingPath="XValue"
YBindingPath="YValue">
<chart:SfPyramidChart.SelectionBehavior>
<chart:DataPointSelectionBehavior SelectionBrush="Red" />
</chart:SfPyramidChart.SelectionBehavior>
</chart:SfPyramidChart>
See Also
ShowDataLabels
Gets or sets a value that indicates to enable the data labels for the chart.
Declaration
public bool ShowDataLabels { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | This property takes the |
Examples
<chart:SfPyramidChart ItemsSource="{Binding Data}"
XBindingPath="XValue"
YBindingPath="YValue"
ShowDataLabels="True">
</chart:SfPyramidChart>
Stroke
Gets or sets the color used to paint the pyramid segments' outline.
Declaration
public Brush Stroke { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.Maui.Controls.Brush | This property takes the Microsoft.Maui.Controls.Brush values and its default value is |
Examples
<chart:SfPyramidChart ItemsSource="{Binding Data}"
XBindingPath="Category"
YBindingPath="Value"
Stroke="Red">
</chart:SfPyramidChart>
StrokeWidth
Gets or sets a value to specify the width of the stroke drawn.
Declaration
public double StrokeWidth { get; set; }
Property Value
Type | Description |
---|---|
System.Double | This property takes the System.Double values and its default value is 2. |
Examples
<chart:SfPyramidChart ItemsSource="{Binding Data}"
XBindingPath="Category"
YBindingPath="Value"
Stroke="Red"
StrokeWidth="4">
</chart:SfPyramidChart>
TooltipTemplate
Gets or sets the DataTemplate that can be used to customize the appearance of the tooltip.
Declaration
public DataTemplate TooltipTemplate { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.Maui.Controls.DataTemplate | It accepts a Microsoft.Maui.Controls.DataTemplate value. and its default value is null. |
Examples
<chart:SfPyramidChart ItemsSource="{Binding Data}"
XBindingPath="Category"
YBindingPath="Value"
EnableTooltip="True">
<chart:SfPyramidChart.TooltipTemplate>
<DataTemplate>
<Border Background = "DarkGreen"
StrokeThickness="2" Stroke="Black" >
<Label Text = "{Binding Item.YValue}"
TextColor="White" FontAttributes="Bold"
HorizontalOptions="Center" VerticalOptions="Center"/>
</Border>
</DataTemplate>
</chart:SfPyramidChart.TooltipTemplate>
</chart:SfPyramidChart>
XBindingPath
Gets or sets a path value on the source object to serve a x value to the chart.
Declaration
public string XBindingPath { get; set; }
Property Value
Type | Description |
---|---|
System.String | The string that represents the property name for the x plotting data, and its default value is null. |
Examples
<chart:SfPyramidChart ItemsSource="{Binding Data}"
XBindingPath="XValue"
YBindingPath="YValue">
</chart:SfPyramidChart>
YBindingPath
Gets or sets a path value on the source object to serve a y value to the chart.
Declaration
public string YBindingPath { get; set; }
Property Value
Type | Description |
---|---|
System.String | The string that represents the property name for the y plotting data, and its default value is null. |
Examples
<chart:SfPyramidChart ItemsSource="{Binding Data}"
XBindingPath="XValue"
YBindingPath="YValue">
</chart:SfPyramidChart>
Methods
CreateSegment()
Creates and initializes a new chart segment for the pyramid chart.
Declaration
protected virtual ChartSegment CreateSegment()
Returns
Type |
---|
ChartSegment |