Class ChartAxis
The ChartAxis is the base class for all types of axes.
Namespace: Syncfusion.Maui.Charts
Assembly: Syncfusion.Maui.Charts.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 |
AutoScrollingModeProperty
Identifies the AutoScrollingMode bindable property.
Declaration
public static readonly BindableProperty AutoScrollingModeProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
AxisLineOffsetProperty
Identifies the AxisLineOffset bindable property.
Declaration
public static readonly BindableProperty AxisLineOffsetProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
AxisLineStyleProperty
Identifies the AxisLineStyle bindable property.
Declaration
public static readonly BindableProperty AxisLineStyleProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
CrossAxisNameProperty
Identifies the CrossAxisName bindable property.
Declaration
public static readonly BindableProperty CrossAxisNameProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
CrossesAtProperty
Identifies the CrossesAt bindable property.
Declaration
public static readonly BindableProperty CrossesAtProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
EdgeLabelsDrawingModeProperty
Identifies the EdgeLabelsDrawingMode bindable property.
Declaration
public static readonly BindableProperty EdgeLabelsDrawingModeProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
EnableAutoIntervalOnZoomingProperty
Identifies the EnableAutoIntervalOnZooming bindable property.
Declaration
public static readonly BindableProperty EnableAutoIntervalOnZoomingProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
IsInversedProperty
Identifies the IsInversed bindable property.
Declaration
public static readonly BindableProperty IsInversedProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
IsVisibleProperty
Identifies the IsVisible bindable property.
Declaration
public static readonly BindableProperty IsVisibleProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
LabelExtentProperty
Identifies the LabelExtent bindable property.
Declaration
public static readonly BindableProperty LabelExtentProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
LabelRotationProperty
Identifies the LabelRotation bindable property.
Declaration
public static readonly BindableProperty LabelRotationProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
LabelsIntersectActionProperty
Identifies the LabelsIntersectAction bindable property.
Declaration
public static readonly BindableProperty LabelsIntersectActionProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
LabelsPositionProperty
Gets or sets the position of the axis labels.
Declaration
public static readonly BindableProperty LabelsPositionProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
LabelStyleProperty
Identifies the LabelStyle bindable property.
Declaration
public static readonly BindableProperty LabelStyleProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
MajorGridLineStyleProperty
Identifies the MajorGridLineStyle bindable property.
Declaration
public static readonly BindableProperty MajorGridLineStyleProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
MajorTickStyleProperty
Identifies the MajorTickStyle bindable property.
Declaration
public static readonly BindableProperty MajorTickStyleProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
NameProperty
Identifies the Name bindable property.
Declaration
public static readonly BindableProperty NameProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
PlotOffsetEndProperty
Identifies the PlotOffsetEnd bindable property.
Declaration
public static readonly BindableProperty PlotOffsetEndProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
PlotOffsetStartProperty
Identifies the PlotOffsetStart bindable property.
Declaration
public static readonly BindableProperty PlotOffsetStartProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
RenderNextToCrossingValueProperty
Identifies the RenderNextToCrossingValue bindable property.
Declaration
public static readonly BindableProperty RenderNextToCrossingValueProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
ShowMajorGridLinesProperty
Identifies the ShowMajorGridLines bindable property.
Declaration
public static readonly BindableProperty ShowMajorGridLinesProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
ShowTrackballLabelProperty
Identifies the ShowTrackballLabel bindable property.
Declaration
public static readonly BindableProperty ShowTrackballLabelProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
TickPositionProperty
Gets or sets the position of the axis tick lines.
Declaration
public static readonly BindableProperty TickPositionProperty
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 |
TrackballLabelStyleProperty
Identifies the TrackballLabelStyle bindable property.
Declaration
public static readonly BindableProperty TrackballLabelStyleProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
TrackballLabelTemplateProperty
Identifies the TrackballLabelTemplate bindable property.
Declaration
public static readonly BindableProperty TrackballLabelTemplateProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
ZoomFactorProperty
Identifies the ZoomFactor bindable property.
Declaration
public static readonly BindableProperty ZoomFactorProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
ZoomPositionProperty
Identifies the ZoomPosition bindable property.
Declaration
public static readonly BindableProperty ZoomPositionProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
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.
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 | The default value is double.NaN. |
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. |
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.
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. |
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. |
Examples
<chart:SfCartesianChart>
<chart:SfCartesianChart.XAxes>
<chart:NumericalAxis MinorTicksPerInterval="4">
<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. |
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 |
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)
Declaration
protected virtual DoubleRange ApplyRangePadding(DoubleRange range, double interval)
Parameters
Type | Name | Description |
---|---|---|
DoubleRange | range | |
System.Double | interval |
Returns
Type |
---|
DoubleRange |
CalculateActualInterval(DoubleRange, 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()
Declaration
protected virtual DoubleRange CalculateActualRange()
Returns
Type |
---|
DoubleRange |
CalculateNiceInterval(DoubleRange, Size)
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)
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)
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)
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)
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)
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)
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)
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)
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)
Declaration
protected double GetActualDesiredIntervalsCount(Size availableSize)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.Maui.Graphics.Size | availableSize |
Returns
Type |
---|
System.Double |
OnBindingContextChanged()
Declaration
protected override void OnBindingContextChanged()
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 |
OnParentSet()
Declaration
protected override void OnParentSet()
PointToValue(Double, Double)
Declaration
public double PointToValue(double x, double y)
Parameters
Type | Name | Description |
---|---|---|
System.Double | x | |
System.Double | y |
Returns
Type |
---|
System.Double |
ValueToPoint(Double)
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>