Class ChartBase
The ChartBase class is the base for SfCartesianChart and SfCircularChart types.
Implements
Namespace: Syncfusion.Maui.Charts
Assembly: Syncfusion.Maui.Charts.dll
Syntax
public abstract class ChartBase : View, IContentView, IView, IElement, ITransform, IPadding, IChart
Constructors
ChartBase()
Initializes a new instance of the ChartBase class.
Declaration
public ChartBase()
Fields
LegendProperty
Identifies the Legend bindable property.
Declaration
public static readonly BindableProperty LegendProperty
Field Value
Type | Description |
---|---|
Microsoft.Maui.Controls.BindableProperty | The identifier for Legend bindable property. |
PlotAreaBackgroundViewProperty
Identifies the PlotAreaBackgroundView bindable property.
Declaration
public static readonly BindableProperty PlotAreaBackgroundViewProperty
Field Value
Type | Description |
---|---|
Microsoft.Maui.Controls.BindableProperty |
TitleProperty
Identifies the Title bindable property.
Declaration
public static readonly BindableProperty TitleProperty
Field Value
Type | Description |
---|---|
Microsoft.Maui.Controls.BindableProperty | The identifier for Title bindable property. |
TooltipBehaviorProperty
Identifies the TooltipBehavior bindable property.
Declaration
public static readonly BindableProperty TooltipBehaviorProperty
Field Value
Type | Description |
---|---|
Microsoft.Maui.Controls.BindableProperty | The identifier for TooltipBehavior bindable property. |
Properties
Legend
Gets or sets the legend that helps to identify the corresponding series or data point in chart.
Declaration
public ChartLegend Legend { get; set; }
Property Value
Type | Description |
---|---|
ChartLegend | This property takes a ChartLegend instance as value and its default value is null. |
Remarks
To render a legend, create an instance of ChartLegend, and assign it to the Legend property.
Examples
<chart:SfCircularChart>
<chart:SfCircularChart.BindingContext>
<local:ViewModel/>
</chart:SfCircularChart.BindingContext>
<chart:SfCircularChart.Legend>
<chart:ChartLegend/>
</chart:SfCircularChart.Legend>
<chart:SfCircularChart.Series>
<chart:PieSeries ItemsSource="{Binding Data}"
XBindingPath="XValue"
YBindingPath="YValue" />
</chart:SfCircularChart.Series>
</chart:SfCircularChart>
PlotAreaBackgroundView
Gets or sets the view to the background of chart area.
Declaration
public View PlotAreaBackgroundView { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.Maui.Controls.View | Defaults to null. |
Examples
<chart:SfCircularChart>
<chart:SfCircularChart.BindingContext>
<local:ViewModel/>
</chart:SfCircularChart.BindingContext>
<chart:SfCartesianChart.PlotAreaBackgroundView>
<BoxView Color="Aqua" Margin = "10" CornerRadius = "5" />
</chart:SfCartesianChart.PlotAreaBackgroundView>
<chart:SfCircularChart.Series>
<chart:PieSeries ItemsSource="{Binding Data}" XBindingPath="XValue" YBindingPath="YValue1"/>
</chart:SfCircularChart.Series>
</chart:SfCircularChart>
Title
Gets or sets the title for chart. It supports the string or any view as title.
Declaration
public object Title { get; set; }
Property Value
Type | Description |
---|---|
System.Object | Default value is null. |
Remarks
Example code for string as title.
<chart:SfCartesianChart Title="Average High/Low Temperature">
</chart:SfCartesianChart>
Example code for View as title.
<chart:SfCartesianChart>
<chart:SfCartesianChart.Title>
<Label Text = "Average High/Low Temperature"
HorizontalOptions="Fill"
HorizontalTextAlignment="Center"
VerticalOptions="Center"
FontSize="16"
TextColor="Black"/>
</chart:SfCartesianChart.Title>
</chart:SfCartesianChart>
TooltipBehavior
Gets or sets a tooltip behavior that allows to customize the default tooltip appearance in the chart.
Declaration
public ChartTooltipBehavior TooltipBehavior { get; set; }
Property Value
Type | Description |
---|---|
ChartTooltipBehavior | This property takes ChartTooltipBehavior instance as value and its default value is null. |
Remarks
To display the tooltip on the chart, set the EnableTooltip property as true in ChartSeries.
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.
Examples
<chart:SfCircularChart>
<chart:SfCircularChart.BindingContext>
<local:ViewModel/>
</chart:SfCircularChart.BindingContext>
<chart:SfCircularChart.TooltipBehavior>
<chart:ChartTooltipBehavior/>
</chart:SfCircularChart.TooltipBehavior>
<chart:SfCircularChart.Series>
<chart:PieSeries EnableTooltip="True" ItemsSource="{Binding Data}" XBindingPath="XValue" YBindingPath="YValue1"/>
</chart:SfCircularChart.Series>
</chart:SfCircularChart>
See Also
Methods
OnBindingContextChanged()
Invoked when binding context changed.
Declaration
protected override void OnBindingContextChanged()