Skip to main content

QualitativeAxisX Class

An axis that displays qualitative arguments.

Namespace: DevExpress.XamarinForms.Charts

Assembly: DevExpress.XamarinForms.Charts.dll

NuGet Package: DevExpress.XamarinForms.Charts

Declaration

public class QualitativeAxisX :
    AxisX

Remarks

The ChartView chooses the X-axis type depending on data in the first series. If arguments are string values, the chart uses a QualitativeAxisX.

The ChartView.AxisX property allows you to access the automatically created axis. If you need to create and customize axes for individual series, use the Series.AxisX property.

<dxc:ChartView>
    <!--Specify an X-axis at the chart level-->
    <dxc:ChartView.AxisX>
        <dxc:QualitativeAxisX />
    </dxc:ChartView.AxisX>

    <dxc:ChartView.Series>
        <dxc:LineSeries>
            <!--Specify an X-axis at the series level-->
            <dxc:LineSeries.AxisX>
                <dxc:QualitativeAxisX />
            </dxc:LineSeries.AxisX>
        </dxc:LineSeries>
    </dxc:ChartView.Series>
</dxc:ChartView>

The QualitativeAxisX class properties allow you to configure the axis range, labels, title, constant lines, strips, gridlines, tickmarks and interlacing colors, and change the axis position.

Qualitative Axis X Elements

Axis Range

The ChartView automatically calculates the axis range based on data series values. To specify a custom range for the axis, set the Range property to a QualitativeRange object and use the following settings:

  • Min and Max - Specify the entire range of the axis scale. A chart does not visualize data that is out of this range. A user can scroll the chart through this range when scroll is enabled for the X-axis (ChartView.AxisXNavigationMode).
  • VisualMin and VisualMax - Configure the axis scale range visible on the screen.
  • SideMargin - Sets the value of margins on both sides of the axis.

Axis Range

<dxc:QualitativeAxisX>
    <dxc:QualitativeAxisX.Range>
        <dxc:QualitativeRange Min="A" Max="G"
                              VisualMin="B" VisualMax="F"
                              SideMargin="0.3"/>
    </dxc:QualitativeAxisX.Range>
</dxc:QualitativeAxisX>

Axis Labels

To configure axis labels, set the Label property to an AxisLabel object and use the following settings:

  • TextFormat - Specifies the text pattern applied to axis labels.
  • Position - Specifies the position of axis labels.
  • Style - Allows you to access an AxisLabelStyle object that stores label appearance settings (TextStyle).
  • Visible - Allows you to show or hide axis labels.

Axis Label Sample

<dxc:QualitativeAxisX>
    <dxc:QualitativeAxisX.Label>
        <dxc:AxisLabel>
            <dxc:AxisLabel.Style>
                <dxc:AxisLabelStyle>
                    <dxc:AxisLabelStyle.TextStyle>
                        <dxc:TextStyle Size="10"/>
                    </dxc:AxisLabelStyle.TextStyle>
                </dxc:AxisLabelStyle>
            </dxc:AxisLabel.Style>
        </dxc:AxisLabel>
    </dxc:QualitativeAxisX.Label>
</dxc:QualitativeAxisX>

Axis Title

Use the Title property to access an AxisTitle object that stores the following settings of an axis title:

  • Text - Gets or sets the text the title displays.
  • Alignment - Gets or sets the axis title alignment.
  • Style - Allows you to access a TitleStyle object that stores title appearance settings (TextStyle).
  • Visible - Allows you to show or hide the axis title.

Axis Title Sample

<dxc:QualitativeAxisX>
    <dxc:QualitativeAxisX.Title>
        <dxc:AxisTitle Text="Country">
            <dxc:AxisTitle.Style>
                <dxc:TitleStyle>
                    <dxc:TitleStyle.TextStyle>
                        <dxc:TextStyle Size="15"/>
                    </dxc:TitleStyle.TextStyle>
                </dxc:TitleStyle>
            </dxc:AxisTitle.Style>
        </dxc:AxisTitle>
    </dxc:QualitativeAxisX.Title>
</dxc:QualitativeAxisX>

Constant Lines

A constant line highlights an axis value as a line perpendicular to the axis.

You can add a constant line to a qualitative X-axis. To do this, add a QualitativeConstantLine object with the specified AxisValue property to the QualitativeAxisX.ConstantLines collection. Use the following properties of the QualitativeConstantLine object to customize the constant line appearance and visibility:

  • Style - Gets or sets the constant line appearance settings.
  • ShowBehind - Specifies whether the constant line is displayed behind series.
  • Title, LegendText - Specify settings of the constant line captions displayed on the chart and in the chart legend.
  • Visible, VisibleInLegend - Specify whether the constant line is visible on the chart and in the chart legend.

Constant Line Sample

<dxc:QualitativeAxisX>
    <dxc:QualitativeAxisX.ConstantLines>
        <dxc:QualitativeConstantLine AxisValue="Triassic">
            <dxc:QualitativeConstantLine.Title>
                <dxc:ConstantLineTitle Text="First Dinosaurs">
                    <dxc:ConstantLineTitle.Style>
                        <dxc:TitleStyle>
                            <dxc:TitleStyle.TextStyle>
                                <dxc:TextStyle Color="Green" Size="20"/>
                            </dxc:TitleStyle.TextStyle>
                        </dxc:TitleStyle>
                    </dxc:ConstantLineTitle.Style>
                </dxc:ConstantLineTitle>
            </dxc:QualitativeConstantLine.Title>
            <dxc:QualitativeConstantLine.Style>
                <dxc:ConstantLineStyle Stroke="Green" Thickness="2"/>
            </dxc:QualitativeConstantLine.Style>
        </dxc:QualitativeConstantLine>
    </dxc:QualitativeAxisX.ConstantLines>
</dxc:QualitativeAxisX>

Strips

A strip highlights a range between two values of an axis and allows you to trace whether series point values fall in or out of that range. A strip can have its own label that is shown instead of axis labels.

To specify a strip for a qualitative X-axis, add a QualitativeStrip object to the QualitativeAxisX.Strips collection and use the following settings:

Strip for Qualitative Axis X

<dxc:QualitativeAxisX>
    <dxc:QualitativeAxisX.Strips>
        <dxc:QualitativeStrip MinLimit="Triassic" MaxLimit="Cretaceous" 
                              LegendText="Mesozoic Era" VisibleInLegend="True">
            <dxc:QualitativeStrip.Style>
                <dxc:StripStyle Fill="LightGreen"/>
            </dxc:QualitativeStrip.Style>
        </dxc:QualitativeStrip>
    </dxc:QualitativeAxisX.Strips>
</dxc:QualitativeAxisX>

Axis Appearance

Use the Style property to access an AxisStyle object that stores visibility and appearance settings for the following elements of an axis:

Element

Properties

Axis Line

LineVisible, LineColor, LineThickness

Major Tickmarks

MajorTickmarksVisible, MajorTickmarksThickness, MajorTickmarksLength

Minor Tickmarks

MinorTickmarksVisible, MinorTickmarksThickness, MinorTickmarksLength

Major Gridlines

MajorGridlinesVisible, MajorGridlinesColor, MajorGridlinesThickness

Minor Gridlines

MinorGridLinesVisible, MinorGridlinesColor, MinorGridlinesThickness

Interlacing

InterlacedVisible, InterlacedColor

Note

Axis labels, title, constant lines and strips have Style properties that manage the appearance of these elements.

Axis Appearance

<dxc:QualitativeAxisX>
    <dxc:QualitativeAxisX.Style>
        <dxc:AxisStyle LineColor="#757575" LineThickness="2"
                       MajorGridlinesVisible="True" MajorGridlinesColor="#909090"
                       MajorTickmarksVisible="True" MajorTickmarksLength="10" MajorTickmarksThickness="2"
                       MinorTickmarksVisible="True" MinorTickmarksLength="5"
                       InterlacedVisible="True" InterlacedColor="#f1f3f0"/>
    </dxc:QualitativeAxisX.Style>
</dxc:QualitativeAxisX>

Axis Position

Use the DisplayPosition property to specify where an X-axis should be positioned within the chart diagram.

This example anchors an X-axis to the top side of the chart’s plot area:

Axis Position

<dxc:QualitativeAxisX>
    <dxc:QualitativeAxisX.DisplayPosition>
        <dxc:AxisDisplayPositionFar/>
    </dxc:QualitativeAxisX.DisplayPosition>
</dxc:QualitativeAxisX>

Inheritance

See Also