Class ChartAxis
The ChartAxis is the base class for all types of axes.
Namespace: Syncfusion.Maui.Toolkit.Charts
Assembly: Syncfusion.Maui.Toolkit.dll
Syntax
public abstract class ChartAxis : Element, IThemeElement
Remarks
The ChartAxis is used to locate a data point inside the chart area. Charts typically have two axes that are used to measure and categorize data.
The Vertical(Y) axis always uses numerical scale.
The Horizontal(X) axis supports the Category, Numeric and Date-time.
Constructors
ChartAxis()
Initializes a new instance of the ChartAxis class.
Declaration
public ChartAxis()
Fields
AutoScrollingDeltaProperty
Identifies the AutoScrollingDelta bindable property.
Declaration
public static readonly BindableProperty AutoScrollingDeltaProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
Remarks
The AutoScrollingDelta bindable property specifies the range of data that should always be visible in the chart.
AutoScrollingModeProperty
Identifies the AutoScrollingMode bindable property.
Declaration
public static readonly BindableProperty AutoScrollingModeProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
Remarks
Determine whether the axis should be scrolled from start position or end position.
AxisLineOffsetProperty
Identifies the AxisLineOffset bindable property.
Declaration
public static readonly BindableProperty AxisLineOffsetProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
Remarks
The AxisLineOffset property defines the offset of the axis line from its original position.
AxisLineStyleProperty
Identifies the AxisLineStyle bindable property.
Declaration
public static readonly BindableProperty AxisLineStyleProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
Remarks
The AxisLineStyle property sets the style of the axis line, such as its color, width, and dash pattern.
CrossAxisNameProperty
Identifies the CrossAxisName bindable property.
Declaration
public static readonly BindableProperty CrossAxisNameProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
Remarks
The CrossAxisName property defines the name of the axis with which this axis crosses.
CrossesAtProperty
Identifies the CrossesAt bindable property.
Declaration
public static readonly BindableProperty CrossesAtProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
Remarks
The CrossesAt property specifies the value at which the axis crosses another axis.
EdgeLabelsDrawingModeProperty
Identifies the EdgeLabelsDrawingMode bindable property.
Declaration
public static readonly BindableProperty EdgeLabelsDrawingModeProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
Remarks
The EdgeLabelsDrawingMode property defines the rendering position of the edge axis labels.
EnableAutoIntervalOnZoomingProperty
Identifies the EnableAutoIntervalOnZooming bindable property.
Declaration
public static readonly BindableProperty EnableAutoIntervalOnZoomingProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
Remarks
The EnableAutoIntervalOnZooming property controls whether the interval is automatically adjusted when zooming.
IsInversedProperty
Identifies the IsInversed bindable property.
Declaration
public static readonly BindableProperty IsInversedProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
Remarks
The IsInversed property specifies whether the axis is rendered in reverse order.
IsVisibleProperty
Identifies the IsVisible bindable property.
Declaration
public static readonly BindableProperty IsVisibleProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
Remarks
The IsVisible property determines whether the axis is visible in the chart.
LabelExtentProperty
Identifies the LabelExtent bindable property.
Declaration
public static readonly BindableProperty LabelExtentProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
Remarks
The LabelExtent bindable property determines the distance between the axis label and axis title.
LabelRotationProperty
Identifies the LabelRotation bindable property.
Declaration
public static readonly BindableProperty LabelRotationProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
Remarks
The LabelRotation property specifies the rotation angle for the axis labels.
LabelsIntersectActionProperty
Identifies the LabelsIntersectAction bindable property.
Declaration
public static readonly BindableProperty LabelsIntersectActionProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
Remarks
Defines the behavior for intersecting axis labels.
LabelsPositionProperty
Identifies the LabelsPosition bindable property.
Declaration
public static readonly BindableProperty LabelsPositionProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
Remarks
Defines the position of the axis labels.
LabelStyleProperty
Identifies the LabelStyle bindable property.
Declaration
public static readonly BindableProperty LabelStyleProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
Remarks
The LabelStyle property defines the style of the axis labels, including font size, color, and font family.
MajorGridLineStyleProperty
Identifies the MajorGridLineStyle bindable property.
Declaration
public static readonly BindableProperty MajorGridLineStyleProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
Remarks
The MajorGridLineStyle property specifies the style of the major grid lines on the chart.
MajorTickStyleProperty
Identifies the MajorTickStyle bindable property.
Declaration
public static readonly BindableProperty MajorTickStyleProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
Remarks
The MajorTickStyle property defines the style of the major ticks on the axis.
NameProperty
Identifies the Name bindable property.
Declaration
public static readonly BindableProperty NameProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
Remarks
The Name property defines the name of the axis, used for identification purposes.
PlotOffsetEndProperty
Identifies the PlotOffsetEnd bindable property.
Declaration
public static readonly BindableProperty PlotOffsetEndProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
Remarks
The PlotOffsetEnd property specifies the ending offset for the plot area relative to the axis.
PlotOffsetStartProperty
Identifies the PlotOffsetStart bindable property.
Declaration
public static readonly BindableProperty PlotOffsetStartProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
Remarks
The PlotOffsetStart property specifies the starting offset for the plot area relative to the axis.
RenderNextToCrossingValueProperty
Identifies the RenderNextToCrossingValue bindable property.
Declaration
public static readonly BindableProperty RenderNextToCrossingValueProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
Remarks
The RenderNextToCrossingValue property defines whether the axis is rendered next to its crossing value.
ShowMajorGridLinesProperty
Identifies the ShowMajorGridLines bindable property.
Declaration
public static readonly BindableProperty ShowMajorGridLinesProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
Remarks
The ShowMajorGridLines property specifies whether the major grid lines are shown on the chart.
ShowTrackballLabelProperty
Identifies the ShowTrackballLabel bindable property.
Declaration
public static readonly BindableProperty ShowTrackballLabelProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
Remarks
Determines whether the trackball label is displayed or hidden.
TickPositionProperty
Identifies the TickPosition bindable property.
Declaration
public static readonly BindableProperty TickPositionProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
Remarks
Defines the position of the axis tick lines.
TitleProperty
Identifies the Title bindable property.
Declaration
public static readonly BindableProperty TitleProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
Remarks
The Title property defines the title of the axis, which appears next to the axis line.
TrackballLabelStyleProperty
Identifies the TrackballLabelStyle bindable property.
Declaration
public static readonly BindableProperty TrackballLabelStyleProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
Remarks
Defines the style for the trackball label.
TrackballLabelTemplateProperty
Identifies the TrackballLabelTemplate bindable property.
Declaration
public static readonly BindableProperty TrackballLabelTemplateProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
Remarks
Defines the template for the trackball label content.
ZoomFactorProperty
Identifies the ZoomFactor bindable property.
Declaration
public static readonly BindableProperty ZoomFactorProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
Remarks
The ZoomFactor property defines the percentage of the visible range from the total range of axis values.
ZoomPositionProperty
Identifies the ZoomPosition bindable property.
Declaration
public static readonly BindableProperty ZoomPositionProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
Remarks
The ZoomPosition property defines the zoom position for the actual range of the axis.
Properties
AutoScrollingDelta
Gets or sets the delta value that specifies the range of data that should always be visible in the chart. It determines the amount of range the chart will scroll by when new data points are added, ensuring that a specified range of data is always visible.
Declaration
public double AutoScrollingDelta { get; set; }
Property Value
Type | Description |
---|---|
System.Double | It accepts System.Double values, and its default value is System.Double.NaN |
Remarks
Note: This is only applicable for SfCartesianChart.
Examples
<chart:SfCartesianChart>
<chart:SfCartesianChart.XAxes>
<chart:CategoryAxis AutoScrollingDelta="3"/>
</chart:SfCartesianChart.XAxes>
</chart:SfCartesianChart>
AutoScrollingMode
Gets or sets the mode to determine whether the axis should be auto scrolled from the start or end positions.
Declaration
public ChartAutoScrollingMode AutoScrollingMode { get; set; }
Property Value
Type | Description |
---|---|
ChartAutoScrollingMode | It accepts ChartAutoScrollingMode values, and its default value is End, means that the chart will always display the most recent data points, and the axis will be automatically scrolled to the right to show the newly added data. |
Remarks
Note: This is only applicable for SfCartesianChart.
Examples
<chart:SfCartesianChart>
<chart:SfCartesianChart.XAxes>
<chart:CategoryAxis AutoScrollingMode="End"/>
</chart:SfCartesianChart.XAxes>
</chart:SfCartesianChart>
AxisLineOffset
Gets or sets a value to provide padding to the axis line.
Declaration
public double AxisLineOffset { get; set; }
Property Value
Type | Description |
---|---|
System.Double | It accepts |
Examples
<chart:SfCartesianChart>
<chart:SfCartesianChart.XAxes>
<chart:CategoryAxis AxisLineOffset = "30" />
</chart:SfCartesianChart.XAxes>
</chart:SfCartesianChart>
AxisLineStyle
Gets or sets the value to customize the appearance of the chart axis line.
Declaration
public ChartLineStyle AxisLineStyle { get; set; }
Property Value
Type | Description |
---|---|
ChartLineStyle | This property accepts the ChartLineStyle value. |
Remarks
To customize the axis line appearance, you need to create an instance of the ChartLineStyle class and set to the AxisLineStyle property.
Null values are invalid.
Note: This is only applicable for the secondary axis of the SfPolarChart.
Examples
<chart:SfCartesianChart>
<chart:SfCartesianChart.XAxes>
<chart:NumericalAxis>
<chart:NumericalAxis.AxisLineStyle>
<chart:ChartLineStyle StrokeWidth="2" Stroke="Red"/>
</chart:NumericalAxis.AxisLineStyle>
</chart:NumericalAxis>
</chart:SfCartesianChart.XAxes>
<chart:SfCartesianChart.YAxes>
<chart:NumericalAxis/>
</chart:SfCartesianChart.YAxes>
</chart:SfCartesianChart>
CrossAxisName
Gets or sets the value for the CrossAxisName of chart axis.
Declaration
public string CrossAxisName { get; set; }
Property Value
Type | Description |
---|---|
System.String | It accepts string value and the default value is null. |
Remarks
Note: This is only applicable for SfCartesianChart.
Examples
<chart:SfCartesianChart>
<chart:SfCartesianChart.XAxes>
<chart:NumericalAxis CrossesAt="5" CrossingAxisName="yAxis"/>
</chart:SfCartesianChart.XAxes>
<chart:SfCartesianChart.YAxes>
<chart:NumericalAxis Name="yAxis"/>
</chart:SfCartesianChart.YAxes>
</chart:SfCartesianChart>
CrossesAt
Gets or sets a value that can be used to position an axis anywhere in the chart area.
Declaration
public object CrossesAt { get; set; }
Property Value
Type | Description |
---|---|
System.Object | This property takes the |
Remarks
Note: This is only applicable for SfCartesianChart.
Examples
<chart:SfCartesianChart>
<chart:SfCartesianChart.XAxes>
<chart:NumericalAxis CrossesAt="{Static x:Double.MaxValue}"/>
</chart:SfCartesianChart.XAxes>
<chart:SfCartesianChart.YAxes>
<chart:NumericalAxis/>
</chart:SfCartesianChart.YAxes>
</chart:SfCartesianChart>
EdgeLabelsDrawingMode
Gets or sets a value to customize the rendering position of the edge labels.
Declaration
public EdgeLabelsDrawingMode EdgeLabelsDrawingMode { get; set; }
Property Value
Type | Description |
---|---|
EdgeLabelsDrawingMode | It accepts the EdgeLabelsDrawingMode value and its default value is Center. |
Remarks
Note: This is only applicable for the secondary axis of the SfPolarChart.
Examples
<chart:SfCartesianChart>
<chart:SfCartesianChart.XAxes>
<chart:CategoryAxis EdgeLabelsDrawingMode="Fit" />
</chart:SfCartesianChart.XAxes>
</chart:SfCartesianChart>
EnableAutoIntervalOnZooming
Gets or sets a value indicating whether to calculate the axis intervals on zooming.
Declaration
public bool EnableAutoIntervalOnZooming { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | It accepts the bool values and its default value is |
Remarks
Note: This is only applicable for SfCartesianChart.
Examples
<chart:SfCartesianChart>
<chart:SfCartesianChart.XAxes>
<chart:CategoryAxis EnableAutoIntervalOnZooming = "False" />
</chart:SfCartesianChart.XAxes>
</chart:SfCartesianChart>
IsInversed
Gets or sets the value that indicates whether the axis' visible range is inversed.
Declaration
public bool IsInversed { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | It accepts the bool values and its default value is |
Remarks
When the axis is inversed, it will render points from right to left for the horizontal axis, and top to bottom for the vertical axis.
Examples
<chart:SfCartesianChart>
<chart:SfCartesianChart.XAxes>
<chart:CategoryAxis IsInversed ="True" />
</chart:SfCartesianChart.XAxes>
</chart:SfCartesianChart>
IsVisible
Gets or sets a value indicating whether to show/hide the chart axis.
Declaration
public bool IsVisible { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | It accepts bool values and its default value is |
Examples
<chart:SfCartesianChart>
<chart:SfCartesianChart.XAxes>
<chart:CategoryAxis IsVisible = "False" />
</chart:SfCartesianChart.XAxes>
</chart:SfCartesianChart>
LabelExtent
Gets or sets the value that determines the distance between the axis label and axis title.
Declaration
public double LabelExtent { get; set; }
Property Value
Type | Description |
---|---|
System.Double | This property take double value and its default value is 0. |
Examples
<chart:SfCartesianChart>
<chart:SfCartesianChart.XAxes>
<chart:CategoryAxis LabelExtent="30" />
</chart:SfCartesianChart.XAxes>
<chart:SfCartesianChart.YAxes>
<chart:NumericalAxis LabelExtent="30" />
</chart:SfCartesianChart.YAxes>
</chart:SfCartesianChart>
LabelRotation
Gets or sets the value for the rotation angle of the axis labels.
Declaration
public double LabelRotation { get; set; }
Property Value
Type | Description |
---|---|
System.Double | It accepts the |
Remarks
Label rotation angle can be set from -90 to 90 degrees.
Note: This is only applicable for the secondary axis of the SfPolarChart.
Examples
<chart:SfCartesianChart>
<chart:SfCartesianChart.XAxes>
<chart:CategoryAxis LabelRotation = "90" />
</chart:SfCartesianChart.XAxes>
</chart:SfCartesianChart>
LabelsIntersectAction
Gets or sets a value that determines the mechanism for avoiding the overlapping of axis labels. The overlapping labels can be hidden, wrapped or placed on the next row.
Declaration
public AxisLabelsIntersectAction LabelsIntersectAction { get; set; }
Property Value
Type | Description |
---|---|
AxisLabelsIntersectAction | It accepts AxisLabelsIntersectAction values and the default value is Hide. |
Examples
<chart:SfCartesianChart>
<chart:SfCartesianChart.XAxes>
<chart:CategoryAxis LabelsIntersectAction="Wrap"/>
</chart:SfCartesianChart.XAxes>
<chart:SfCartesianChart.YAxes>
<chart:NumericalAxis LabelsIntersectAction="Wrap"/>
</chart:SfCartesianChart.YAxes>
</chart:SfCartesianChart>
LabelsPosition
Gets or sets the position of the axis labels.
Declaration
public AxisElementPosition LabelsPosition { get; set; }
Property Value
Type | Description |
---|---|
AxisElementPosition | It accepts AxisElementPosition values and its default value is Outside. |
Remarks
Edge labels may overlap when both primary and secondary axis labels are positioned inside. In this case, we can utilize the inside element support, depending on the scenario.
Note: This is only applicable for the secondary axis of the SfPolarChart.
Examples
<chart:SfCartesianChart>
<chart:SfCartesianChart.XAxes>
<chart:CategoryAxis LabelsPosition="Inside" />
</chart:SfCartesianChart.XAxes>
<chart:SfCartesianChart.YAxes>
<chart:NumericalAxis LabelsPosition="Inside" />
</chart:SfCartesianChart.YAxes>
</chart:SfCartesianChart>
LabelStyle
Gets or sets the value to customize the appearance of chart axis labels.
Declaration
public ChartAxisLabelStyle LabelStyle { get; set; }
Property Value
Type | Description |
---|---|
ChartAxisLabelStyle | It accepts the ChartAxisLabelStyle value. |
Remarks
To customize the axis labels appearance, you need to create an instance of the ChartAxisLabelStyle class and set to the LabelStyle property.
Null values are invalid.
Examples
<chart:SfCartesianChart>
<chart:SfCartesianChart.XAxes>
<chart:CategoryAxis>
<chart:CategoryAxis.LabelStyle>
<chart:ChartAxisLabelStyle TextColor = "Red" FontSize="14"/>
</chart:CategoryAxis.LabelStyle>
</chart:CategoryAxis>
</chart:SfCartesianChart.XAxes>
</chart:SfCartesianChart>
MajorGridLineStyle
Gets or sets the ChartLineStyle to customize the appearance of the major grid lines.
Declaration
public ChartLineStyle MajorGridLineStyle { get; set; }
Property Value
Type | Description |
---|---|
ChartLineStyle | It accepts the ChartLineStyle. |
Remarks
To customize the major grid line appearance, you need to create an instance of the ChartLineStyle class and set to the MajorGridLineStyle property.
Null values are invalid.
Examples
<chart:SfCartesianChart>
<chart:SfCartesianChart.Resources>
<DoubleCollection x:Key="dashArray">
<x:Double>3</x:Double>
<x:Double>3</x:Double>
</DoubleCollection>
</chart:SfCartesianChart.Resources>
<chart:SfCartesianChart.XAxes>
<chart:NumericalAxis>
<chart:NumericalAxis.MajorGridLineStyle>
<chart:ChartLineStyle StrokeDashArray="{StaticResource dashArray}" Stroke="Black" StrokeWidth="2" />
</chart:NumericalAxis.MajorGridLineStyle>
</chart:NumericalAxis>
</chart:SfCartesianChart.XAxes>
<chart:SfCartesianChart.YAxes>
<chart:NumericalAxis/>
</chart:SfCartesianChart.YAxes>
</chart:SfCartesianChart>
MajorTickStyle
Gets or sets the ChartAxisTickStyle to customize the appearance of the major tick lines.
Declaration
public ChartAxisTickStyle MajorTickStyle { get; set; }
Property Value
Type | Description |
---|---|
ChartAxisTickStyle | It accepts the ChartAxisTickStyle value. |
Remarks
To customize the axis major tick line appearance, you need to create an instance of the ChartAxisTickStyle class and set to the MajorTickStyle property.
Null values are invalid.
Examples
<chart:SfCartesianChart>
<chart:SfCartesianChart.XAxes>
<chart:NumericalAxis>
<chart:NumericalAxis.MajorTickStyle>
<chart:ChartAxisTickStyle Stroke="Red" StrokeWidth="1"/>
</chart:NumericalAxis.MajorTickStyle>
</chart:NumericalAxis>
</chart:SfCartesianChart.XAxes>
<chart:SfCartesianChart.YAxes>
<chart:NumericalAxis/>
</chart:SfCartesianChart.YAxes>
</chart:SfCartesianChart>
Name
Gets or sets the unique name of the axis, which will be used to identify the segment axis of the strip line.
Declaration
public string Name { get; set; }
Property Value
Type | Description |
---|---|
System.String | This property takes the string value and its default value is string.Empty. |
PlotOffsetEnd
Gets or sets a value to provide padding to the axis at end position.
Declaration
public double PlotOffsetEnd { get; set; }
Property Value
Type | Description |
---|---|
System.Double | It accepts |
Remarks
PlotOffsetEnd applies padding at end of the plot area where the axis and its elements are rendered in the chart with padding at the end.
Examples
<chart:SfCartesianChart>
<chart:SfCartesianChart.XAxes>
<chart:CategoryAxis PlotOffsetEnd = "30" />
</chart:SfCartesianChart.XAxes>
<chart:SfCartesianChart.YAxes>
<chart:NumericalAxis PlotOffsetEnd = "30" />
</chart:SfCartesianChart.YAxes>
</chart:SfCartesianChart>
PlotOffsetStart
Gets or sets a value to provide padding to the axis at the start position.
Declaration
public double PlotOffsetStart { get; set; }
Property Value
Type | Description |
---|---|
System.Double | It accepts |
Remarks
PlotOffsetStart applies padding at the start of a plot area where the axis and its elements are rendered in a chart with padding at the start.
Examples
<chart:SfCartesianChart>
<chart:SfCartesianChart.XAxes>
<chart:CategoryAxis PlotOffsetStart = "30" />
</chart:SfCartesianChart.XAxes>
<chart:SfCartesianChart.YAxes>
<chart:NumericalAxis PlotOffsetStart = "30" />
</chart:SfCartesianChart.YAxes>
</chart:SfCartesianChart>
RenderNextToCrossingValue
Gets or sets a value that determines whether the crossing axis should be placed at the crossing position or not.
Declaration
public bool RenderNextToCrossingValue { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | It accepts bool values and the default value is |
Remarks
Note: This is only applicable for SfCartesianChart.
Examples
<chart:SfCartesianChart>
<chart:SfCartesianChart.XAxes>
<chart:NumericalAxis RenderNextToCrossingValue="False"/>
</chart:SfCartesianChart.XAxes>
<chart:SfCartesianChart.YAxes>
<chart:NumericalAxis/>
</chart:SfCartesianChart.YAxes>
</chart:SfCartesianChart>
ShowMajorGridLines
Gets or sets a value indicating whether the axis grid lines can be displayed or not.
Declaration
public bool ShowMajorGridLines { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | It accepts the bool value and its default value is |
Examples
<chart:SfCartesianChart>
<chart:SfCartesianChart.XAxes>
<chart:CategoryAxis ShowMajorGridLines = "False" />
</chart:SfCartesianChart.XAxes>
</chart:SfCartesianChart>
ShowTrackballLabel
Gets or sets the value that indicates whether to show the trackball axis label.
Declaration
public bool ShowTrackballLabel { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | It accepts the bool values and its default value is |
Remarks
Note: This is only applicable for SfCartesianChart.
Examples
<chart:SfCartesianChart>
<chart:SfCartesianChart.XAxes>
<chart:CategoryAxis ShowTrackballLabel = "True" />
</chart:SfCartesianChart.XAxes>
</chart:SfCartesianChart>
TickPosition
Gets or sets the position of the axis tick lines.
Declaration
public AxisElementPosition TickPosition { get; set; }
Property Value
Type | Description |
---|---|
AxisElementPosition | It accepts AxisElementPosition values and its default value is Outside. |
Remarks
Note: This is only applicable for the secondary axis of the SfPolarChart.
Examples
<chart:SfCartesianChart>
<chart:SfCartesianChart.XAxes>
<chart:CategoryAxis TickPosition="Inside" />
</chart:SfCartesianChart.XAxes>
<chart:SfCartesianChart.YAxes>
<chart:NumericalAxis TickPosition="Inside" />
</chart:SfCartesianChart.YAxes>
</chart:SfCartesianChart>
Title
Gets or sets the title for the chart axis.
Declaration
public ChartAxisTitle Title { get; set; }
Property Value
Type | Description |
---|---|
ChartAxisTitle | It accepts ChartAxisTitle value. |
Remarks
The ChartAxisTitle provides options to customize the text and font of axis title.
Note: This is only applicable for the secondary axis of the SfPolarChart.
Examples
<chart:SfCartesianChart>
<chart:SfCartesianChart.XAxes>
<chart:CategoryAxis>
<chart:CategoryAxis.Title>
<chart:ChartAxisTitle Text="Category"/>
</chart:CategoryAxis.Title>
</chart:CategoryAxis>
</chart:SfCartesianChart.XAxes>
</chart:SfCartesianChart>
TrackballLabelStyle
Gets or sets option for customize the trackball axis label.
Declaration
public ChartLabelStyle TrackballLabelStyle { get; set; }
Property Value
Type | Description |
---|---|
ChartLabelStyle | It accepts the bool values and its default value is |
Remarks
To customize the trackball label appearance, you need to create an instance of the ChartLabelStyle class and set to the TrackballLabelStyle property.
Null values are invalid.
Examples
<chart:SfCartesianChart>
<chart:SfCartesianChart.XAxes>
<chart:CategoryAxis ShowTrackballLabel="True">
<chart:CategoryAxis.TrackballLabelStyle>
<chart:ChartLabelStyle Background = "Black" TextColor="White"/>
</chart:CategoryAxis.TrackballLabelStyle>
</chart:CategoryAxis>
</chart:SfCartesianChart.XAxes>
</chart:SfCartesianChart>
Note: This is only applicable for SfCartesianChart.
TrackballLabelTemplate
Gets or sets the DataTemplate to customize the appearance of the axis Trackball labels.
Declaration
public DataTemplate TrackballLabelTemplate { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.Maui.Controls.DataTemplate | It accepts the Microsoft.Maui.Controls.DataTemplatevalue and its default value is null. |
Examples
<chart:SfCartesianChart>
<chart:SfCartesianChart.TrackballBehavior>
<chart:ChartTrackballBehavior />
</chart:SfCartesianChart.TrackballBehavior>
<chart:SfCartesianChart.Resources>
<DataTemplate x:Key="AxisTrackballTemplate">
<HorizontalStackLayout>
<Image Source="image.png"
WidthRequest="20"
HeightRequest="20"/>
<Label Text="{Binding Label}"
TextColor="Black"
FontAttributes="Bold"
FontSize="12"/>
</HorizontalStackLayout>
</DataTemplate>
</chart:SfCartesianChart.Resources>
<chart:SfCartesianChart.XAxes>
<chart:NumericalAxis ShowTrackballLabel = "True"
TrackballLabelTemplate="{StaticResource AxisTrackballTemplate}" />
</chart:SfCartesianChart.XAxes>
<chart:SfCartesianChart.YAxes>
<chart:NumericalAxis/>
</chart:SfCartesianChart.YAxes>
<chart:SfCartesianChart.Series>
<chart:LineSeries ItemsSource="{Binding Data}"
XBindingPath="XValue"
YBindingPath="YValue">
</chart:LineSeries>
</chart:SfCartesianChart.Series>
</chart:SfCartesianChart>
VisibleLabels
Gets the axis labels visible
Declaration
public ObservableCollection<ChartAxisLabel> VisibleLabels { get; }
Property Value
Type |
---|
System.Collections.ObjectModel.ObservableCollection<ChartAxisLabel> |
VisibleMaximum
Gets the double value that represents the maximum visible value of the axis range.
Declaration
public double VisibleMaximum { get; }
Property Value
Type |
---|
System.Double |
VisibleMinimum
Gets the double value that represents the minimum visible value of the axis range.
Declaration
public double VisibleMinimum { get; }
Property Value
Type |
---|
System.Double |
ZoomFactor
Gets or sets the value that defines the percentage of the visible range from the total range of axis values.
Declaration
public double ZoomFactor { get; set; }
Property Value
Type | Description |
---|---|
System.Double | It accepts the double values and its default value is 1. |
Remarks
The value must be between 0 and 1.
Note: This is only applicable for SfCartesianChart.
Examples
<chart:SfCartesianChart>
<chart:SfCartesianChart.XAxes>
<chart:CategoryAxis ZoomFactor="0.3" ZoomPosition="0.5" />
</chart:SfCartesianChart.XAxes>
<chart:SfCartesianChart.ZoomPanBehavior>
<chart:ChartZoomPanBehavior/>
</chart:SfCartesianChart.ZoomPanBehavior>
</chart:SfCartesianChart>
ZoomPosition
Gets or sets the value that defines the zoom position for the actual range of the axis.
Declaration
public double ZoomPosition { get; set; }
Property Value
Type | Description |
---|---|
System.Double | It accepts the double values and its default value is 0. |
Remarks
The value must be between 0 and 1.
Note: This is only applicable for SfCartesianChart.
Examples
<chart:SfCartesianChart>
<chart:SfCartesianChart.XAxes>
<chart:CategoryAxis ZoomFactor="0.3" ZoomPosition="0.5" />
</chart:SfCartesianChart.XAxes>
<chart:SfCartesianChart.ZoomPanBehavior>
<chart:ChartZoomPanBehavior/>
</chart:SfCartesianChart.ZoomPanBehavior>
</chart:SfCartesianChart>
Methods
ApplyRangePadding(DoubleRange, Double)
Determines whether padding is applied to the axis range, typically used to add space between the plotted data points and the axis edges.
Declaration
protected virtual DoubleRange ApplyRangePadding(DoubleRange range, double interval)
Parameters
Type | Name | Description |
---|---|---|
DoubleRange | range | |
System.Double | interval |
Returns
Type |
---|
DoubleRange |
CalculateActualInterval(DoubleRange, Size)
Determines the actual interval between axis labels or gridlines based on the axis range and chart size.
Declaration
protected virtual double CalculateActualInterval(DoubleRange range, Size availableSize)
Parameters
Type | Name | Description |
---|---|---|
DoubleRange | range | |
Microsoft.Maui.Graphics.Size | availableSize |
Returns
Type |
---|
System.Double |
CalculateActualRange()
Calculates the actual range of values for an axis based on the data points and axis settings.
Declaration
protected virtual DoubleRange CalculateActualRange()
Returns
Type |
---|
DoubleRange |
CalculateNiceInterval(DoubleRange, Size)
Calculates the actual interval for the axis based on the provided range of values and the available size, ensuring appropriate spacing between axis labels or ticks.
Declaration
protected virtual double CalculateNiceInterval(DoubleRange actualRange, Size availableSize)
Parameters
Type | Name | Description |
---|---|---|
DoubleRange | actualRange | |
Microsoft.Maui.Graphics.Size | availableSize |
Returns
Type |
---|
System.Double |
CalculateVisibleInterval(DoubleRange, Size)
Calculates the interval between visible axis labels or gridlines, considering the zoom level or any applied range restrictions.
Declaration
protected virtual double CalculateVisibleInterval(DoubleRange visibleRange, Size availableSize)
Parameters
Type | Name | Description |
---|---|---|
DoubleRange | visibleRange | |
Microsoft.Maui.Graphics.Size | availableSize |
Returns
Type |
---|
System.Double |
CalculateVisibleRange(DoubleRange, Size)
Computes the range of values currently visible on the axis, typically after zooming or panning operations.
Declaration
protected virtual DoubleRange CalculateVisibleRange(DoubleRange actualRange, Size availableSize)
Parameters
Type | Name | Description |
---|---|---|
DoubleRange | actualRange | |
Microsoft.Maui.Graphics.Size | availableSize |
Returns
Type |
---|
DoubleRange |
ComputeDesiredSize(Size)
Calculates the desired size of a chart axis elements.
Declaration
protected virtual Size ComputeDesiredSize(Size availableSize)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.Maui.Graphics.Size | availableSize |
Returns
Type |
---|
Microsoft.Maui.Graphics.Size |
DrawAxis(ICanvas, Rect)
Draws the axis and its elements.
Declaration
protected virtual void DrawAxis(ICanvas canvas, Rect arrangeRect)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.Maui.Graphics.ICanvas | canvas | |
Microsoft.Maui.Graphics.Rect | arrangeRect |
DrawAxisLine(ICanvas, Single, Single, Single, Single)
Draws the axis lines.
Declaration
protected virtual void DrawAxisLine(ICanvas canvas, float x1, float y1, float x2, float y2)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.Maui.Graphics.ICanvas | canvas | |
System.Single | x1 | |
System.Single | y1 | |
System.Single | x2 | |
System.Single | y2 |
DrawGridLine(ICanvas, Double, Single, Single, Single, Single)
Draws the axis grid lines.
Declaration
protected virtual void DrawGridLine(ICanvas canvas, double position, float x1, float y1, float x2, float y2)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.Maui.Graphics.ICanvas | canvas | |
System.Double | position | |
System.Single | x1 | |
System.Single | y1 | |
System.Single | x2 | |
System.Single | y2 |
DrawMajorTick(ICanvas, Double, PointF, PointF)
Draws the axis major tick lines.
Declaration
protected virtual void DrawMajorTick(ICanvas canvas, double tickPosition, PointF point1, PointF point2)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.Maui.Graphics.ICanvas | canvas | |
System.Double | tickPosition | |
Microsoft.Maui.Graphics.PointF | point1 | |
Microsoft.Maui.Graphics.PointF | point2 |
DrawMinorTick(ICanvas, Double, PointF, PointF)
Draw the axis minor tick lines.
Declaration
protected virtual void DrawMinorTick(ICanvas canvas, double tickPosition, PointF point1, PointF point2)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.Maui.Graphics.ICanvas | canvas | |
System.Double | tickPosition | |
Microsoft.Maui.Graphics.PointF | point1 | |
Microsoft.Maui.Graphics.PointF | point2 |
GetActualDesiredIntervalsCount(Size)
Retrieves the actual number of intervals desired on an axis, typically based on the axis range, size, and interval settings.
Declaration
protected double GetActualDesiredIntervalsCount(Size availableSize)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.Maui.Graphics.Size | availableSize |
Returns
Type |
---|
System.Double |
OnCreateLabels()
Using this method, we can adjust the axis labels visible
Declaration
protected virtual void OnCreateLabels()
OnLabelCreated(ChartAxisLabel)
Declaration
protected virtual void OnLabelCreated(ChartAxisLabel label)
Parameters
Type | Name | Description |
---|---|---|
ChartAxisLabel | label |
PointToValue(Double, Double)
Converts a given pixel or screen coordinate (point) into a corresponding value on the chart's axis.
Declaration
public double PointToValue(double x, double y)
Parameters
Type | Name | Description |
---|---|---|
System.Double | x | |
System.Double | y |
Returns
Type |
---|
System.Double |
ValueToPoint(Double)
Converts a value from the chart's axis into a corresponding pixel or screen coordinate (point) on the chart.
Declaration
public float ValueToPoint(double value)
Parameters
Type | Name | Description |
---|---|---|
System.Double | value |
Returns
Type |
---|
System.Single |
Events
ActualRangeChanged
This event occurs when the actual range is changed.
Declaration
public event EventHandler<ActualRangeChangedEventArgs> ActualRangeChanged
Event Type
Type |
---|
System.EventHandler<ActualRangeChangedEventArgs> |
Remarks
The ActualRangeChangedEventArgs contains information on the chart axis' minimum and maximum values.
Examples
<chart:SfCartesianChart>
<chart:SfCartesianChart.XAxes>
<chart:NumericalAxis ActualRangeChanged="xAxis_ActualRangeChanged"/>
</chart:SfCartesianChart.XAxes>
<chart:SfCartesianChart.YAxes>
<chart:NumericalAxis/>
</chart:SfCartesianChart.YAxes>
</chart:SfCartesianChart>
LabelCreated
This event occurs when the axis label is created.
Declaration
public event EventHandler<ChartAxisLabelEventArgs> LabelCreated
Event Type
Type |
---|
System.EventHandler<ChartAxisLabelEventArgs> |
Remarks
The ChartAxisLabelEventArgs contains the information of AxisLabel.
Examples
<chart:SfCartesianChart>
<chart:SfCartesianChart.XAxes>
<chart:CategoryAxis LabelCreated="OnLabelCreated" />
</chart:SfCartesianChart.XAxes>
</chart:SfCartesianChart>