Class ChartAxis
Serves as a base class for all types of axis. This class has options to customize axis grid lines and tick lines.
Namespace: Syncfusion.SfChart.XForms
Assembly: Syncfusion.SfChart.XForms.dll
Syntax
public abstract class ChartAxis : Element, IThemeElement
Remarks
The Chart requires a minimum of two axes namely primary axis and secondary axis to plot data points. Values / data in the chart are plotted against these two axes. Chart also supports adding multiple axes to the chart and the series can be drawn with reference to any x-axis,y-axis added to SfChart.
Constructors
ChartAxis()
Initializes a new instance of the ChartAxis class.
Declaration
public ChartAxis()
Fields
AutoScrollingDeltaProperty
Gets or sets the value that determines the range of value to be visible during auto scrolling. This is a bindable property.
Declaration
public static readonly BindableProperty AutoScrollingDeltaProperty
Field Value
| Type |
|---|
| Xamarin.Forms.BindableProperty |
AutoScrollingModeProperty
Gets or sets the enum ChartAutoScrollingMode to determine whether the axis should be auto scrolled at start or end position. This is a bindable property.
Declaration
public static readonly BindableProperty AutoScrollingModeProperty
Field Value
| Type |
|---|
| Xamarin.Forms.BindableProperty |
AxisLineOffsetProperty
Gets or sets the offset value for the axis line. This is a bindable property.
Declaration
public static readonly BindableProperty AxisLineOffsetProperty
Field Value
| Type |
|---|
| Xamarin.Forms.BindableProperty |
AxisLineStyleProperty
Gets or sets the options for customizing for the axis line. This is a bindable property.
Declaration
public static readonly BindableProperty AxisLineStyleProperty
Field Value
| Type |
|---|
| Xamarin.Forms.BindableProperty |
CrossesAtProperty
Gets or sets Date time or double that represents crossing value to axis. This is a bindable property.
Declaration
public static readonly BindableProperty CrossesAtProperty
Field Value
| Type |
|---|
| Xamarin.Forms.BindableProperty |
Remarks
This property takes only double or date time value.
EdgeLabelsDrawingModeProperty
Gets or sets a drawing mode of the axis labels for better user experience. This is a bindable property.
Declaration
public static readonly BindableProperty EdgeLabelsDrawingModeProperty
Field Value
| Type |
|---|
| Xamarin.Forms.BindableProperty |
EnableAutoIntervalOnZoomingProperty
Gets or sets the value that indicates whether to calculate the axis intervals on zooming. This is a bindable property.
Declaration
public static readonly BindableProperty EnableAutoIntervalOnZoomingProperty
Field Value
| Type |
|---|
| Xamarin.Forms.BindableProperty |
IsInversedProperty
Gets or sets the value that indicates whether the axis visible range is inversed. This is a bindable property.
Declaration
public static readonly BindableProperty IsInversedProperty
Field Value
| Type |
|---|
| Xamarin.Forms.BindableProperty |
IsVisibleProperty
Gets or sets the value that indicates whether the axis is visible in the chart. This is a bindable property.
Declaration
public static readonly BindableProperty IsVisibleProperty
Field Value
| Type |
|---|
| Xamarin.Forms.BindableProperty |
LabelExtentProperty
Gets or sets the value that determines the distance between the axis label and axis title. This is a bindable property.
Declaration
public static readonly BindableProperty LabelExtentProperty
Field Value
| Type |
|---|
| Xamarin.Forms.BindableProperty |
LabelRotationAngleProperty
Gets or sets the rotation angle of the axis labels. This is a bindable property.
Declaration
public static readonly BindableProperty LabelRotationAngleProperty
Field Value
| Type |
|---|
| Xamarin.Forms.BindableProperty |
LabelsIntersectActionProperty
Gets or sets an actions to be taken when two labels intersect in bounds. This is a bindable property.
Declaration
public static readonly BindableProperty LabelsIntersectActionProperty
Field Value
| Type |
|---|
| Xamarin.Forms.BindableProperty |
LabelStyleProperty
Gets or sets the options for customizing the axis labels. This is a bindable property.
Declaration
public static readonly BindableProperty LabelStyleProperty
Field Value
| Type |
|---|
| Xamarin.Forms.BindableProperty |
MajorGridLineStyleProperty
Gets or sets the options for customizing the major grid lines. This is a bindable property.
Declaration
public static readonly BindableProperty MajorGridLineStyleProperty
Field Value
| Type |
|---|
| Xamarin.Forms.BindableProperty |
MajorTickStyleProperty
Gets or sets the options for customizing the major tick lines. This is a bindable property.
Declaration
public static readonly BindableProperty MajorTickStyleProperty
Field Value
| Type |
|---|
| Xamarin.Forms.BindableProperty |
MaximumLabelsProperty
Gets or sets the value that determines the number of labels to be displayed per 100 pixels. This is a bindable property.
Declaration
public static readonly BindableProperty MaximumLabelsProperty
Field Value
| Type |
|---|
| Xamarin.Forms.BindableProperty |
NameProperty
Gets or sets the unique name of the axis, which will be used to identify the segment axis of the strip line. This is a bindable property.
Declaration
public static readonly BindableProperty NameProperty
Field Value
| Type |
|---|
| Xamarin.Forms.BindableProperty |
OpposedPositionProperty
Gets or sets the value that indicates whether to draw axis at the opposite side of axis in the chart. This is a bindable property.
Declaration
public static readonly BindableProperty OpposedPositionProperty
Field Value
| Type |
|---|
| Xamarin.Forms.BindableProperty |
PlotOffsetEndProperty
Gets or sets the value that used to offset the rendering of the axis at end position. This is a bindable property.
Declaration
public static readonly BindableProperty PlotOffsetEndProperty
Field Value
| Type |
|---|
| Xamarin.Forms.BindableProperty |
PlotOffsetProperty
Gets or sets the offset value for axis elements like labels and tick lines. This is a bindable property.
Declaration
public static readonly BindableProperty PlotOffsetProperty
Field Value
| Type |
|---|
| Xamarin.Forms.BindableProperty |
PlotOffsetStartProperty
Gets or sets the value that used to offset the rendering of the axis at start position. This is a bindable property.
Declaration
public static readonly BindableProperty PlotOffsetStartProperty
Field Value
| Type |
|---|
| Xamarin.Forms.BindableProperty |
PolarAngleProperty
Gets or sets the angle as a start position for polar or radar series. This is a bindable property.
Declaration
public static readonly BindableProperty PolarAngleProperty
Field Value
| Type |
|---|
| Xamarin.Forms.BindableProperty |
RangeStylesProperty
Gets or sets the options for customizing for the axis range. This is a bindable property.
Declaration
public static readonly BindableProperty RangeStylesProperty
Field Value
| Type |
|---|
| Xamarin.Forms.BindableProperty |
RenderNextToCrossingValueProperty
Gets or sets the value that determines whether crossing axis should be placed at crossing position or not. This is a bindable property.
Declaration
public static readonly BindableProperty RenderNextToCrossingValueProperty
Field Value
| Type |
|---|
| Xamarin.Forms.BindableProperty |
ShowMajorGridLinesProperty
Gets or sets the value that indicates whether to show the major grid lines for the axis. This is a bindable property.
Declaration
public static readonly BindableProperty ShowMajorGridLinesProperty
Field Value
| Type |
|---|
| Xamarin.Forms.BindableProperty |
ShowTrackballInfoProperty
Gets or sets the value that indicates whether to show the axis information, when the trackball is shown. This is a bindable property.
Declaration
public static readonly BindableProperty ShowTrackballInfoProperty
Field Value
| Type |
|---|
| Xamarin.Forms.BindableProperty |
TickPositionProperty
Gets or sets the position of the axis tick lines. This is a bindable property.
Declaration
public static readonly BindableProperty TickPositionProperty
Field Value
| Type |
|---|
| Xamarin.Forms.BindableProperty |
TitleProperty
Gets or sets the title for the axis. This is a mutable property.
Declaration
public static readonly BindableProperty TitleProperty
Field Value
| Type |
|---|
| Xamarin.Forms.BindableProperty |
TrackballLabelStyleProperty
Gets or sets the customized style for the axis track ball label. This is a bindable property.
Declaration
public static readonly BindableProperty TrackballLabelStyleProperty
Field Value
| Type |
|---|
| Xamarin.Forms.BindableProperty |
TrackballLabelTemplateProperty
Gets or sets the template for the Trackball label of axis. This is a bindable property.
Declaration
public static readonly BindableProperty TrackballLabelTemplateProperty
Field Value
| Type |
|---|
| Xamarin.Forms.BindableProperty |
ZoomFactorProperty
Gets or sets the value, between 0 to 1, that indicates the zoom level of the axis. This is a bindable property.
Declaration
public static readonly BindableProperty ZoomFactorProperty
Field Value
| Type |
|---|
| Xamarin.Forms.BindableProperty |
ZoomPositionProperty
Gets or sets the value, between 0 to 1, that indicates the start position in the actual range of the axis. This is a bindable property.
Declaration
public static readonly BindableProperty ZoomPositionProperty
Field Value
| Type |
|---|
| Xamarin.Forms.BindableProperty |
Properties
AutoScrollingDelta
Gets or sets the value that determines the range of value to be visible during auto scrolling. This is a bindable property.
Declaration
public Nullable<double> AutoScrollingDelta { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Nullable<System.Double> | This property takes the double value. |
AutoScrollingMode
Gets or sets the enum ChartAutoScrollingMode to determine whether the axis should be auto scrolled at start or end position. This is a bindable property.
Declaration
public ChartAutoScrollingMode AutoScrollingMode { get; set; }
Property Value
| Type | Description |
|---|---|
| ChartAutoScrollingMode | This property takes the ChartAutoScrollingMode as its value. |
AxisLineOffset
Gets or sets the offset value for the axis line. This is a bindable property.
Declaration
public double AxisLineOffset { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Double | This property takes the double value. |
AxisLineStyle
Gets or sets the options for customizing for the axis line. This is a bindable property.
Declaration
public ChartLineStyle AxisLineStyle { get; set; }
Property Value
| Type | Description |
|---|---|
| ChartLineStyle | This property takes the ChartLineStyle as its value. |
CrossesAt
Gets or sets Date time or double that represents crossing value to axis. This is a bindable property.
Declaration
public object CrossesAt { get; set; }
Property Value
| Type |
|---|
| System.Object |
Remarks
This property takes only double or date time value.
EdgeLabelsDrawingMode
Gets or sets a drawing mode of the axis labels for better user experience. This is a bindable property.
Declaration
public EdgeLabelsDrawingMode EdgeLabelsDrawingMode { get; set; }
Property Value
| Type | Description |
|---|---|
| EdgeLabelsDrawingMode | This property take the EdgeLabelsDrawingMode as its value. |
EnableAutoIntervalOnZooming
Gets or sets a value indicating whether to calculate the axis intervals on zooming. This is a bindable property.
Declaration
public bool EnableAutoIntervalOnZooming { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean | This property take |
IsInversed
Gets or sets a value indicating whether the axis visible range is inversed. This is a bindable property.
Declaration
public bool IsInversed { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean | This property takes the boolean property. |
IsVertical
Gets or sets a value indicating whether the axis should be placed in X or Y axis. This is a CLR property.
Declaration
public bool IsVertical { get; set; }
Property Value
| Type |
|---|
| System.Boolean |
Remarks
Do not change this property dynamically to set horizontal or vertical after the axis set for any series XAxis and YAxis.
IsVisible
Gets or sets a value indicating whether the axis is visible in the chart. This is a bindable property.
Declaration
public bool IsVisible { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean | This property takes the boolean value. |
LabelExtent
Gets or sets the value that determines the distance between the axis label and axis title. This is a bindable property.
Declaration
public double LabelExtent { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Double | This property take double value. |
LabelRotationAngle
Gets or sets the rotation angle of the axis labels. This is a bindable property.
Declaration
public double LabelRotationAngle { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Double | This property take the double value, representing the angle. |
Remarks
The default value is '0'.
LabelsIntersectAction
Gets or sets an actions to be taken when two labels intersect in bounds. This is a bindable property.
Declaration
public AxisLabelsIntersectAction LabelsIntersectAction { get; set; }
Property Value
| Type | Description |
|---|---|
| AxisLabelsIntersectAction | This property takes the AxisLabelsIntersectAction as its value. |
LabelStyle
Gets or sets the options for customizing the axis labels. This is a bindable property.
Declaration
public ChartAxisLabelStyle LabelStyle { get; set; }
Property Value
| Type | Description |
|---|---|
| ChartAxisLabelStyle | This property takes the ChartAxisLabelStyle as its value. |
MajorGridLineStyle
Gets or sets the options for customizing the major grid lines. This is a bindable property.
Declaration
public ChartLineStyle MajorGridLineStyle { get; set; }
Property Value
| Type | Description |
|---|---|
| ChartLineStyle | This property takes the ChartLineStyle as its value. |
MajorTickStyle
Gets or sets the options for customizing the major tick lines. This is a bindable property.
Declaration
public ChartAxisTickStyle MajorTickStyle { get; set; }
Property Value
| Type | Description |
|---|---|
| ChartAxisTickStyle | This property takes the ChartAxisTickStyle as its value. |
MaximumLabels
Gets or sets the value that determines the number of labels to be displayed per 100 pixels. This is a bindable property.
Declaration
public int MaximumLabels { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Int32 | This property takes the integer value. |
Remarks
This property used to give constrain over the auto generated labels, which reduces the number elements rendering in view.
Name
Gets or sets the unique name of the axis, which will be used to identify the segment axis of the strip line. This is a bindable property.
Declaration
public string Name { get; set; }
Property Value
| Type | Description |
|---|---|
| System.String | This property takes the string value. |
OpposedPosition
Gets or sets a value indicating whether to draw axis at the opposite side of axis in the chart. This is a bindable property.
Declaration
public bool OpposedPosition { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean | This property takes the boolean value. |
PlotOffset
Gets or sets the offset value for axis elements like labels and tick lines. This is a bindable property.
Declaration
public double PlotOffset { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Double | This property takes the double value. |
PlotOffsetEnd
Declaration
public double PlotOffsetEnd { get; set; }
Property Value
| Type |
|---|
| System.Double |
PlotOffsetStart
Declaration
public double PlotOffsetStart { get; set; }
Property Value
| Type |
|---|
| System.Double |
PolarAngle
Gets or sets the angle as a start positon for polar or radar series. This is a bindable property.
Declaration
public ChartPolarAngle PolarAngle { get; set; }
Property Value
| Type | Description |
|---|---|
| ChartPolarAngle | This property takes the ChartPolarAngle as its value. |
Remarks
The default value is 'Rotate270'.
RangeStyles
Gets or sets the collection of the ChartAxisRangeStyle to customize the axis GridLine, TickLine and LabelStyle for specific range. This is a bindable property.
Declaration
public ChartAxisRangeStyleCollection RangeStyles { get; set; }
Property Value
| Type | Description |
|---|---|
| ChartAxisRangeStyleCollection | This property takes the ChartAxisRangeStyleCollection as its value. |
RenderNextToCrossingValue
Gets or sets a value indicating whether crossing axis should be placed at crossing position or not. This is a bindable property.
Declaration
public bool RenderNextToCrossingValue { get; set; }
Property Value
| Type |
|---|
| System.Boolean |
ShowMajorGridLines
Gets or sets a value indicating whether to show the major grid lines for the axis. This is a bindable property.
Declaration
public bool ShowMajorGridLines { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean | This property take |
ShowTrackballInfo
Gets or sets a value indicating whether to show the axis information, when the trackball is shown. This is a bindable property.
Declaration
public bool ShowTrackballInfo { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean | This property take |
TickPosition
Gets or sets the position of the axis tick lines. This is a bindable property.
Declaration
public AxisElementPosition TickPosition { get; set; }
Property Value
| Type | Description |
|---|---|
| AxisElementPosition | This property takes the AxisElementPosition as its value. |
Title
Gets or sets a title for the axis. This is a mutable property. The Axis does not display the title by default.
Declaration
public ChartAxisTitle Title { get; set; }
Property Value
| Type | Description |
|---|---|
| ChartAxisTitle | This property takes ChartAxisTitle as its value. |
TrackballLabelStyle
Gets or sets the customized style for the axis track ball label. This is a bindable property.
Declaration
public ChartTrackballAxisLabelStyle TrackballLabelStyle { get; set; }
Property Value
| Type | Description |
|---|---|
| ChartTrackballAxisLabelStyle | This property takes the TrackballLabelStyle as its value. |
TrackballLabelTemplate
Gets or sets the template for the Trackball label of axis. This is a bindable property.
Declaration
public DataTemplate TrackballLabelTemplate { get; set; }
Property Value
| Type | Description |
|---|---|
| Xamarin.Forms.DataTemplate | This property takes the TrackballAxisLabelTemplate value. |
VisibleLabels
Gets the collection of axis labels in the visible region.
Declaration
public ChartAxisLabelCollection VisibleLabels { get; }
Property Value
| Type |
|---|
| ChartAxisLabelCollection |
VisibleMaximum
Gets the double value that represents observable maximum value of axis range.
Declaration
public double VisibleMaximum { get; }
Property Value
| Type |
|---|
| System.Double |
VisibleMinimum
Gets the double value that represents observable minimum value of axis range.
Declaration
public double VisibleMinimum { get; }
Property Value
| Type |
|---|
| System.Double |
ZoomFactor
Gets or sets the value, between 0 to 1, that indicates the zoom level of the axis. This is a bindable property.
Declaration
public double ZoomFactor { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Double | This property takes double value and its value falls within 0 to 1. |
Remarks
ZoomFactor default value is 1, which represents the full range.
ZoomPosition
Gets or sets the value, between 0 to 1, that indicates the start position in the actual range of the axis. This is a bindable property.
Declaration
public double ZoomPosition { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Double | This property takes double value and its value falls within 0 to 1. |
Remarks
ZoomFactor default value is 0, which position the axis to visible range start.
Methods
CoefficientToValue(Double)
Converts coefficient to chart value.
Declaration
public double CoefficientToValue(double value)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Double | value | value. |
Returns
| Type | Description |
|---|---|
| System.Double | The CoefficientToValue value. |
OnBindingContextChanged()
Override this method to execute an action when the BindingContext changes.
Declaration
protected override void OnBindingContextChanged()
OnCreateLabels()
Method to get the collection of axis labels in the visible region.
Declaration
protected virtual void OnCreateLabels()
OnParentSet()
Declaration
protected override void OnParentSet()
PointToValue(Point)
Converts screen point to chart value.
Declaration
public double PointToValue(Point value)
Parameters
| Type | Name | Description |
|---|---|---|
| Xamarin.Forms.Point | value | point value. |
Returns
| Type | Description |
|---|---|
| System.Double | The chart value. |
ValueToCoefficient(Double)
Converts chart value to coefficient.
Declaration
public double ValueToCoefficient(double value)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Double | value | value. |
Returns
| Type | Description |
|---|---|
| System.Double | The ValueToCoefficient value. |
ValueToPoint(Double)
Converts the chart value to screen point.
Declaration
public double ValueToPoint(double value)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Double | value | value. |
Returns
| Type | Description |
|---|---|
| System.Double | The screen point value. |
Events
ActualRangeChanged
Represents the ActualRangeChanged event, which occurs when the actual range of the chart axis is changed.
Declaration
public event EventHandler<ActualRangeChangedEventArgs> ActualRangeChanged
Event Type
| Type |
|---|
| System.EventHandler<ActualRangeChangedEventArgs> |
LabelClicked
Represents the LabelClicked event, which occurs when the axis label is clicked. The argument contains label content and position of axis label.
Declaration
public event EventHandler<LabelClickedEventArgs> LabelClicked
Event Type
| Type |
|---|
| System.EventHandler<LabelClickedEventArgs> |
LabelCreated
Represents the LabelCreated event, which occurs when the axis label is created. The argument contains label content, position, and label style of axis label.
Declaration
public event EventHandler<ChartAxisLabelEventArgs> LabelCreated
Event Type
| Type |
|---|
| System.EventHandler<ChartAxisLabelEventArgs> |