QAbstractAxis Class | Qt Charts 5.12.2

Qt 5.12 | Qt Charts | C++ Classes | QAbstractAxis

Qt Charts | Commercial or GPLv3

# QAbstractAxis Class

The QAbstractAxis class is a base class used for specialized axis classes. More...

Header: | #include <QAbstractAxis>
Instantiated By: | AbstractAxis
Inherits: | QObject
Inherited By: | QBarCategoryAxis, QDateTimeAxis, QLogValueAxis, and QValueAxis

- List of all members, including inherited members
- Obsolete members

## Public Types

enum | AxisType { AxisTypeNoAxis, AxisTypeValue, AxisTypeBarCategory, AxisTypeCategory, AxisTypeDateTime, AxisTypeLogValue }
flags | AxisTypes

## Properties

- alignment : const Qt::Alignment
- color : QColor
- gridLineColor : QColor
- gridLinePen : QPen
- gridVisible : bool
- labelsAngle : int
- labelsBrush : QBrush
- labelsColor : QColor
- labelsFont : QFont
- labelsVisible : bool
- linePen : QPen
- lineVisible : bool
- minorGridLineColor : QColor
- minorGridLinePen : QPen

- minorGridVisible : bool
- orientation : const Qt::Orientation
- reverse : bool
- shadesBorderColor : QColor
- shadesBrush : QBrush
- shadesColor : QColor
- shadesPen : QPen
- shadesVisible : bool
- titleBrush : QBrush
- titleFont : QFont
- titleText : QString
- titleVisible : bool
- visible : bool

- 1 property inherited from QObject

## Public Functions

virtual | ~QAbstractAxis()
Qt::Alignment | alignment() const
QColor | gridLineColor()
QPen | gridLinePen() const
void | hide()
bool | isGridLineVisible() const
bool | isLineVisible() const
bool | isMinorGridLineVisible() const
bool | isReverse() const
bool | isTitleVisible() const
bool | isVisible() const
int | labelsAngle() const
QBrush | labelsBrush() const
QColor | labelsColor() const
QFont | labelsFont() const
bool | labelsVisible() const
QPen | linePen() const
QColor | linePenColor() const
QColor | minorGridLineColor()
QPen | minorGridLinePen() const
Qt::Orientation | orientation() const
void | setGridLineColor(const QColor &color)
void | setGridLinePen(const QPen &pen)
void | setGridLineVisible(bool visible = true)
void | setLabelsAngle(int angle)
void | setLabelsBrush(const QBrush &brush)
void | setLabelsColor(QColor color)
void | setLabelsFont(const QFont &font)
void | setLabelsVisible(bool visible = true)
void | setLinePen(const QPen &pen)
void | setLinePenColor(QColor color)
void | setLineVisible(bool visible = true)
void | setMax(const QVariant &max)
void | setMin(const QVariant &min)
void | setMinorGridLineColor(const QColor &color)
void | setMinorGridLinePen(const QPen &pen)
void | setMinorGridLineVisible(bool visible = true)
void | setRange(const QVariant &min, const QVariant &max)
void | setReverse(bool reverse = true)
void | setShadesBorderColor(QColor color)
void | setShadesBrush(const QBrush &brush)
void | setShadesColor(QColor color)
void | setShadesPen(const QPen &pen)
void | setShadesVisible(bool visible = true)
void | setTitleBrush(const QBrush &brush)
void | setTitleFont(const QFont &font)
void | setTitleText(const QString &title)
void | setTitleVisible(bool visible = true)
void | setVisible(bool visible = true)
QColor | shadesBorderColor() const
QBrush | shadesBrush() const
QColor | shadesColor() const
QPen | shadesPen() const
bool | shadesVisible() const
void | show()
QBrush | titleBrush() const
QFont | titleFont() const
QString | titleText() const
virtual QAbstractAxis::AxisType | type() const = 0

- 31 public functions inherited from QObject

## Signals

void | colorChanged(QColor color)
void | gridLineColorChanged(const QColor &color)
void | gridLinePenChanged(const QPen &pen)
void | gridVisibleChanged(bool visible)
void | labelsAngleChanged(int angle)
void | labelsBrushChanged(const QBrush &brush)
void | labelsColorChanged(QColor color)
void | labelsFontChanged(const QFont &font)
void | labelsVisibleChanged(bool visible)
void | linePenChanged(const QPen &pen)
void | lineVisibleChanged(bool visible)
void | minorGridLineColorChanged(const QColor &color)
void | minorGridLinePenChanged(const QPen &pen)
void | minorGridVisibleChanged(bool visible)
void | reverseChanged(bool reverse)
void | shadesBorderColorChanged(QColor color)
void | shadesBrushChanged(const QBrush &brush)
void | shadesColorChanged(QColor color)
void | shadesPenChanged(const QPen &pen)
void | shadesVisibleChanged(bool visible)
void | titleBrushChanged(const QBrush &brush)
void | titleFontChanged(const QFont &font)
void | titleTextChanged(const QString &text)
void | titleVisibleChanged(bool visible)
void | visibleChanged(bool visible)

- 2 signals inherited from QObject

## Static Public Members

const QMetaObject | staticMetaObject

- 9 static public members inherited from QObject

## Protected Variables

int | d_ptr

### Additional Inherited Members

- 1 public slot inherited from QObject
- 9 protected functions inherited from QObject

## Detailed Description

The QAbstractAxis class is a base class used for specialized axis classes.

Each series can be bound to one or more horizontal and vertical axes, but mixing axis types that would result in different domains is not supported, such as specifying QValueAxis and QLogValueAxis on the same orientation.

The properties and visibility of various axis elements, such as axis line, title, labels, grid lines, and shades, can be individually controlled.

## Member Type Documentation

### enum QAbstractAxis::AxisType
flags QAbstractAxis::AxisTypes

This enum type specifies the type of the axis object.

Constant | Value
--- | ---
`QAbstractAxis::AxisTypeNoAxis` | `0x0`
`QAbstractAxis::AxisTypeValue` | `0x1`
`QAbstractAxis::AxisTypeBarCategory` | `0x2`
`QAbstractAxis::AxisTypeCategory` | `0x4`
`QAbstractAxis::AxisTypeDateTime` | `0x8`
`QAbstractAxis::AxisTypeLogValue` | `0x10`

The AxisTypes type is a typedef for QFlags<AxisType>. It stores an OR combination of AxisType values.

## Property Documentation

### alignment : const Qt::Alignment

This property holds the alignment of the axis.

Can be Qt::AlignLeft, Qt::AlignRight, Qt::AlignBottom, or Qt::AlignTop.

Access functions:

Qt::Alignment | alignment() const

### color : QColor

This property holds the color of the axis and tick marks.

Access functions:

QColor | linePenColor() const
void | setLinePenColor(QColor color)

Notifier signal:

void | colorChanged(QColor color)

### gridLineColor : QColor

This property holds the color of the grid line.

Access functions:

QColor | gridLineColor()
void | setGridLineColor(const QColor &color)

Notifier signal:

void | gridLineColorChanged(const QColor &color)

### gridLinePen : QPen

This property holds the pen used to draw the grid line.

Access functions:

QPen | gridLinePen() const
void | setGridLinePen(const QPen &pen)

Notifier signal:

void | gridLinePenChanged(const QPen &pen)

### gridVisible : bool

This property holds the visibility of the grid lines.

Access functions:

bool | isGridLineVisible() const
void | setGridLineVisible(bool visible = true)

Notifier signal:

void | gridVisibleChanged(bool visible)

### labelsAngle : int

This property holds the angle of the axis labels in degrees.

Access functions:

int | labelsAngle() const
void | setLabelsAngle(int angle)

Notifier signal:

void | labelsAngleChanged(int angle)

### labelsBrush : QBrush

This property holds the brush used to draw the labels.

Only the color of the brush is relevant.

Access functions:

QBrush | labelsBrush() const
void | setLabelsBrush(const QBrush &brush)

Notifier signal:

void | labelsBrushChanged(const QBrush &brush)

### labelsColor : QColor

This property holds the color of the axis labels.

Access functions:

QColor | labelsColor() const
void | setLabelsColor(QColor color)

Notifier signal:

void | labelsColorChanged(QColor color)

### labelsFont : QFont

This property holds the font of the axis labels.

Access functions:

QFont | labelsFont() const
void | setLabelsFont(const QFont &font)

Notifier signal:

void | labelsFontChanged(const QFont &font)

### labelsVisible : bool

This property holds whether axis labels are visible.

Access functions:

bool | labelsVisible() const
void | setLabelsVisible(bool visible = true)

Notifier signal:

void | labelsVisibleChanged(bool visible)

### linePen : QPen

This property holds the pen used to draw the line.

Access functions:

QPen | linePen() const
void | setLinePen(const QPen &pen)

Notifier signal:

void | linePenChanged(const QPen &pen)

### lineVisible : bool

This property holds the visibility of the axis line.

Access functions:

bool | isLineVisible() const
void | setLineVisible(bool visible = true)

Notifier signal:

void | lineVisibleChanged(bool visible)

### minorGridLineColor : QColor

This property holds the color of the minor grid line.

Applies only to axes that support minor grid lines.

Access functions:

QColor | minorGridLineColor()
void | setMinorGridLineColor(const QColor &color)

Notifier signal:

void | minorGridLineColorChanged(const QColor &color)

### minorGridLinePen : QPen

This property holds the pen used to draw the minor grid line.

Applies only to axes that support minor grid lines.

Access functions:

QPen | minorGridLinePen() const
void | setMinorGridLinePen(const QPen &pen)

Notifier signal:

void | minorGridLinePenChanged(const QPen &pen)

### minorGridVisible : bool

This property holds the visibility of the minor grid lines.

Applies only to axes that support minor grid lines.

Access functions:

bool | isMinorGridLineVisible() const
void | setMinorGridLineVisible(bool visible = true)

Notifier signal:

void | minorGridVisibleChanged(bool visible)

### orientation : const Qt::Orientation

This property holds the orientation of the axis.

Fixed to either Qt::Horizontal or Qt::Vertical when the axis is added to a chart.

Access functions:

Qt::Orientation | orientation() const

### reverse : bool

This property holds whether a reverse axis is used.

By default, the value is `false`.

The reverse axis is supported with a line, spline, and scatter series, as well as an area series with a cartesian chart. All axes of the same orientation attached to the same series must be reversed if one is reversed or the behavior is undefined.

Access functions:

bool | isReverse() const
void | setReverse(bool reverse = true)

Notifier signal:

void | reverseChanged(bool reverse)

### shadesBorderColor : QColor

This property holds the border (pen) color of the axis shades.

Access functions:

QColor | shadesBorderColor() const
void | setShadesBorderColor(QColor color)

Notifier signal:

void | shadesBorderColorChanged(QColor color)

### shadesBrush : QBrush

This property holds the brush used to draw the axis shades (the area between the grid lines).

Access functions:

QBrush | shadesBrush() const
void | setShadesBrush(const QBrush &brush)

Notifier signal:

void | shadesBrushChanged(const QBrush &brush)

### shadesColor : QColor

This property holds the fill (brush) color of the axis shades.

Access functions:

QColor | shadesColor() const
void | setShadesColor(QColor color)

Notifier signal:

void | shadesColorChanged(QColor color)

### shadesPen : QPen

This property holds the pen used to draw the axis shades (the area between the grid lines).

Access functions:

QPen | shadesPen() const
void | setShadesPen(const QPen &pen)

Notifier signal:

void | shadesPenChanged(const QPen &pen)

### shadesVisible : bool

This property holds the visibility of the axis shades.

Access functions:

bool | shadesVisible() const
void | setShadesVisible(bool visible = true)

Notifier signal:

void | shadesVisibleChanged(bool visible)

### titleBrush : QBrush

This property holds the brush used to draw the title text.

Only the color of the brush is relevant.

Access functions:

QBrush | titleBrush() const
void | setTitleBrush(const QBrush &brush)

Notifier signal:

void | titleBrushChanged(const QBrush &brush)

### titleFont : QFont

This property holds the font of the title of the axis.

Access functions:

QFont | titleFont() const
void | setTitleFont(const QFont &font)

Notifier signal:

void | titleFontChanged(const QFont &font)

### titleText : QString

This property holds the title of the axis.

Empty by default. Axis titles support HTML formatting.

Access functions:

QString | titleText() const
void | setTitleText(const QString &title)

Notifier signal:

void | titleTextChanged(const QString &text)

### titleVisible : bool

This property holds the visibility of the axis title.

By default, the value is `true`.

Access functions:

bool | isTitleVisible() const
void | setTitleVisible(bool visible = true)

Notifier signal:

void | titleVisibleChanged(bool visible)

### visible : bool

This property holds the visibility of the axis.

Access functions:

bool | isVisible() const
void | setVisible(bool visible = true)

Notifier signal:

void | visibleChanged(bool visible)

## Member Function Documentation

### `[virtual]` QAbstractAxis::~QAbstractAxis()

Destructs the axis object. When the axis is added to a chart, the chart object takes ownership.

### `[signal]` void QAbstractAxis::colorChanged(QColor color)

This signal is emitted when the color of the axis changes to color.

Note: Notifier signal for property color.

### `[signal]` void QAbstractAxis::gridLineColorChanged(const QColor &color)

This signal is emitted when the color of the pen used to draw the grid line changes to color.

Note: Notifier signal for property gridLineColor.

### QPen QAbstractAxis::gridLinePen() const

Returns the pen used to draw the grid.

Note: Getter function for property gridLinePen.

See also setGridLinePen().

### `[signal]` void QAbstractAxis::gridLinePenChanged(const QPen &pen)

This signal is emitted when the pen used to draw the grid line changes to pen.

Note: Notifier signal for property gridLinePen.

### `[signal]` void QAbstractAxis::gridVisibleChanged(bool visible)

This signal is emitted when the visibility of the grid lines of the axis changes to visible.

Note: Notifier signal for property gridVisible.

### void QAbstractAxis::hide()

Makes the axis, shades, labels, and grid lines invisible.

### `[signal]` void QAbstractAxis::labelsAngleChanged(int angle)

This signal is emitted when the angle of the axis labels changes to angle.

Note: Notifier signal for property labelsAngle.

### QBrush QAbstractAxis::labelsBrush() const

Returns the brush used to draw labels.

Note: Getter function for property labelsBrush.

See also setLabelsBrush().

### `[signal]` void QAbstractAxis::labelsBrushChanged(const QBrush &brush)

This signal is emitted when the brush used to draw the axis labels changes to brush.

Note: Notifier signal for property labelsBrush.

### `[signal]` void QAbstractAxis::labelsColorChanged(QColor color)

This signal is emitted when the color of the axis labels changes to color.

Note: Notifier signal for property labelsColor.

### QFont QAbstractAxis::labelsFont() const

Returns the font used to draw labels.

Note: Getter function for property labelsFont.

See also setLabelsFont().

### `[signal]` void QAbstractAxis::labelsFontChanged(const QFont &font)

This signal is emitted when the font of the axis labels changes to font.

Note: Notifier signal for property labelsFont.

### `[signal]` void QAbstractAxis::labelsVisibleChanged(bool visible)

This signal is emitted when the visibility of the labels of the axis changes to visible.

Note: Notifier signal for property labelsVisible.

### QPen QAbstractAxis::linePen() const

Returns the pen used to draw the axis line and tick marks.

Note: Getter function for property linePen.

See also setLinePen().

### `[signal]` void QAbstractAxis::linePenChanged(const QPen &pen)

This signal is emitted when the pen used to draw the line of the axis changes to pen.

Note: Notifier signal for property linePen.

### `[signal]` void QAbstractAxis::lineVisibleChanged(bool visible)

This signal is emitted when the visibility of the axis line changes to visible.

Note: Notifier signal for property lineVisible.

### `[signal]` void QAbstractAxis::minorGridLineColorChanged(const QColor &color)

This signal is emitted when the color of the pen used to draw the minor grid line changes to color.

Note: Notifier signal for property minorGridLineColor.

### `[signal]` void QAbstractAxis::minorGridLinePenChanged(const QPen &pen)

This signal is emitted when the pen used to draw the minor grid line changes to pen.

Note: Notifier signal for property minorGridLinePen.

### `[signal]` void QAbstractAxis::minorGridVisibleChanged(bool visible)

This signal is emitted when the visibility of the minor grid lines of the axis changes to visible.

Note: Notifier signal for property minorGridVisible.

### Qt::Orientation QAbstractAxis::orientation() const

Returns the orientation of the axis (vertical or horizontal).

Note: Getter function for property orientation.

### void QAbstractAxis::setGridLinePen(const QPen &pen)

Sets the pen used to draw the grid lines to pen.

Note: Setter function for property gridLinePen.

See also gridLinePen().

### void QAbstractAxis::setLabelsBrush(const QBrush &brush)

Sets the brush used to draw labels to brush.

Note: Setter function for property labelsBrush.

See also labelsBrush().

### void QAbstractAxis::setLabelsFont(const QFont &font)

Sets the font used to draw labels to font.

Note: Setter function for property labelsFont.

See also labelsFont().

### void QAbstractAxis::setLinePen(const QPen &pen)

Sets the pen used to draw the axis line and tick marks to pen.

Note: Setter function for property linePen.

See also linePen().

### void QAbstractAxis::setLineVisible(bool visible = true)

Determines whether the axis line and tick marks are visible.

Note: Setter function for property lineVisible.

See also isLineVisible().

### void QAbstractAxis::setMax(const QVariant &max)

Sets the maximum value shown on the axis. Depending on the actual axis type, the max parameter is converted to the appropriate type of value. If the conversion is impossible, the function call does nothing.

### void QAbstractAxis::setMin(const QVariant &min)

Sets the minimum value shown on the axis. Depending on the actual axis type, the min parameter is converted to the appropriate type of value. If the conversion is impossible, the function call does nothing.

### void QAbstractAxis::setRange(const QVariant &min, const QVariant &max)

Sets the range shown on the axis. Depending on the actual axis type, the min and max parameters are converted to appropriate types of values. If the conversion is impossible, the function call does nothing.

### void QAbstractAxis::setShadesBrush(const QBrush &brush)

Sets the brush used to draw shades to brush.

Note: Setter function for property shadesBrush.

See also shadesBrush().

### void QAbstractAxis::setShadesPen(const QPen &pen)

Sets the pen used to draw shades to pen.

Note: Setter function for property shadesPen.

See also shadesPen().

### void QAbstractAxis::setTitleBrush(const QBrush &brush)

Sets the brush used to draw titles to brush.

Note: Setter function for property titleBrush.

See also titleBrush().

### void QAbstractAxis::setTitleFont(const QFont &font)

Sets the font used to draw titles to font.

Note: Setter function for property titleFont.

See also titleFont().

### void QAbstractAxis::setVisible(bool visible = true)

Sets the visibility of the axis, shades, labels, and grid lines to visible.

Note: Setter function for property visible.

See also isVisible().

### `[signal]` void QAbstractAxis::shadesBorderColorChanged(QColor color)

This signal is emitted when the border color of the axis shades changes to color.

Note: Notifier signal for property shadesBorderColor.

### QBrush QAbstractAxis::shadesBrush() const

Returns the brush used to draw shades.

Note: Getter function for property shadesBrush.

See also setShadesBrush().

### `[signal]` void QAbstractAxis::shadesBrushChanged(const QBrush &brush)

This signal is emitted when the brush used to draw the axis shades changes to brush.

Note: Notifier signal for property shadesBrush.

### `[signal]` void QAbstractAxis::shadesColorChanged(QColor color)

This signal is emitted when the color of the axis shades changes to color.

Note: Notifier signal for property shadesColor.

### QPen QAbstractAxis::shadesPen() const

Returns the pen used to draw shades.

Note: Getter function for property shadesPen.

See also setShadesPen().

### `[signal]` void QAbstractAxis::shadesPenChanged(const QPen &pen)

This signal is emitted when the pen used to draw the axis shades changes to pen.

Note: Notifier signal for property shadesPen.

### `[signal]` void QAbstractAxis::shadesVisibleChanged(bool visible)

This signal is emitted when the visibility of the axis shades changes to visible.

Note: Notifier signal for property shadesVisible.

### void QAbstractAxis::show()

Makes the axis, shades, labels, and grid lines visible.

### QBrush QAbstractAxis::titleBrush() const

Returns the brush used to draw titles.

Note: Getter function for property titleBrush.

See also setTitleBrush().

### `[signal]` void QAbstractAxis::titleBrushChanged(const QBrush &brush)

This signal is emitted when the brush used to draw the axis title changes to brush.

Note: Notifier signal for property titleBrush.

### QFont QAbstractAxis::titleFont() const

Returns the font used to draw titles.

Note: Getter function for property titleFont.

See also setTitleFont().

### `[signal]` void QAbstractAxis::titleFontChanged(const QFont &font)

This signal is emitted when the font of the axis title changes to font.

Note: Notifier signal for property titleFont.

### `[signal]` void QAbstractAxis::titleTextChanged(const QString &text)

This signal is emitted when the text of the axis title changes to text.

Note: Notifier signal for property titleText.

### `[signal]` void QAbstractAxis::titleVisibleChanged(bool visible)

This signal is emitted when the visibility of the title text of the axis changes to visible.

Note: Notifier signal for property titleVisible.

### `[pure virtual]` QAbstractAxis::AxisType QAbstractAxis::type() const

Returns the type of the axis.

### `[signal]` void QAbstractAxis::visibleChanged(bool visible)

This signal is emitted when the visibility of the axis changes to visible.

Note: Notifier signal for property visible.