class QAbstractAxis#

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

Inheritance diagram of PySide6.QtCharts.QAbstractAxis

Inherited by: QValueAxis, QCategoryAxis, QLogValueAxis, QDateTimeAxis, QColorAxis, QBarCategoryAxis

Synopsis#

Properties#

Methods#

Virtual methods#

Signals#

Note

This documentation may contain snippets that were automatically translated from C++ to Python. We always welcome contributions to the snippet translation. If you see an issue with the translation, you can also let us know by creating a ticket on https:/bugreports.qt.io/projects/PYSIDE

Detailed Description#

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.

class AxisType#

This enum type specifies the type of the axis object.

Constant

Description

QAbstractAxis.AxisTypeNoAxis

QAbstractAxis.AxisTypeValue

QAbstractAxis.AxisTypeBarCategory

QAbstractAxis.AxisTypeCategory

QAbstractAxis.AxisTypeDateTime

QAbstractAxis.AxisTypeLogValue

QAbstractAxis.AxisTypeColor

Note

Properties can be used directly when from __feature__ import true_property is used or via accessor functions otherwise.

property alignmentᅟ: Combination of Qt.AlignmentFlag#

This property holds The alignment of the axis..

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

Access functions:
property colorᅟ: QColor#

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

Access functions:
property gridLineColorᅟ: QColor#

This property holds The color of the grid line..

Access functions:
property gridLinePenᅟ: QPen#

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

Access functions:
property gridVisibleᅟ: bool#

This property holds The visibility of the grid lines..

Access functions:
property labelsAngleᅟ: int#

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

Access functions:
property labelsBrushᅟ: QBrush#

This property holds The brush used to draw the labels..

Only the color of the brush is relevant.

Access functions:
property labelsColorᅟ: QColor#

This property holds The color of the axis labels..

Access functions:
property labelsFontᅟ: QFont#

This property holds The font of the axis labels..

Access functions:
property labelsTruncatedᅟ: bool#

This property holds Returns true if at least one label on the axis is truncated..

Returned value will not be accurate before the axis is shown.

Access functions:
property labelsVisibleᅟ: bool#

This property holds Whether axis labels are visible..

Access functions:
property linePenᅟ: QPen#

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

Access functions:
property lineVisibleᅟ: bool#

This property holds The visibility of the axis line..

Access functions:
property minorGridLineColorᅟ: QColor#

This property holds The color of the minor grid line..

Applies only to axes that support minor grid lines.

Access functions:
property 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:
property minorGridVisibleᅟ: bool#

This property holds The visibility of the minor grid lines..

Applies only to axes that support minor grid lines.

Access functions:
property orientationᅟ: 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:
property 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:
property shadesBorderColorᅟ: QColor#

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

Access functions:
property shadesBrushᅟ: QBrush#

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

Access functions:
property shadesColorᅟ: QColor#

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

Access functions:
property shadesPenᅟ: QPen#

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

Access functions:
property shadesVisibleᅟ: bool#

This property holds The visibility of the axis shades..

Access functions:
property titleBrushᅟ: QBrush#

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

Only the color of the brush is relevant.

Access functions:
property titleFontᅟ: QFont#

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

Access functions:
property titleTextᅟ: str#

This property holds The title of the axis..

Empty by default. Axis titles support HTML formatting.

Access functions:
property titleVisibleᅟ: bool#

This property holds The visibility of the axis title..

By default, the value is true.

Access functions:
property truncateLabelsᅟ: bool#

This property holds The truncation state of labels..

Indicates whether labels should be truncated if there is no enough space for full text. It is equal to true by default.

Access functions:
property visibleᅟ: bool#

This property holds The visibility of the axis..

Access functions:
alignment()#
Return type:

Combination of AlignmentFlag

Getter of property alignmentᅟ .

colorChanged(color)#
Parameters:

colorQColor

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

Notification signal of property colorᅟ .

gridLineColor()#
Return type:

QColor

Getter of property gridLineColorᅟ .

gridLineColorChanged(color)#
Parameters:

colorQColor

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

Notification signal of property gridLineColorᅟ .

gridLinePen()#
Return type:

QPen

Returns the pen used to draw the grid.

See also

setGridLinePen()

Getter of property gridLinePenᅟ .

gridLinePenChanged(pen)#
Parameters:

penQPen

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

Notification signal of property gridLinePenᅟ .

gridVisibleChanged(visible)#
Parameters:

visible – bool

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

Notification signal of property gridVisibleᅟ .

hide()#

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

isGridLineVisible()#
Return type:

bool

Getter of property gridVisibleᅟ .

isLineVisible()#
Return type:

bool

Getter of property lineVisibleᅟ .

isMinorGridLineVisible()#
Return type:

bool

Getter of property minorGridVisibleᅟ .

isReverse()#
Return type:

bool

Getter of property reverseᅟ .

isTitleVisible()#
Return type:

bool

Getter of property titleVisibleᅟ .

isVisible()#
Return type:

bool

Getter of property visibleᅟ .

labelsAngle()#
Return type:

int

See also

setLabelsAngle()

Getter of property labelsAngleᅟ .

labelsAngleChanged(angle)#
Parameters:

angle – int

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

Notification signal of property labelsAngleᅟ .

labelsBrush()#
Return type:

QBrush

Returns the brush used to draw labels.

See also

setLabelsBrush()

Getter of property labelsBrushᅟ .

labelsBrushChanged(brush)#
Parameters:

brushQBrush

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

Notification signal of property labelsBrushᅟ .

labelsColor()#
Return type:

QColor

See also

setLabelsColor()

Getter of property labelsColorᅟ .

labelsColorChanged(color)#
Parameters:

colorQColor

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

Notification signal of property labelsColorᅟ .

labelsEditable()#
Return type:

bool

Returns true if axis labels are editable.

labelsEditableChanged(editable)#
Parameters:

editable – bool

This signal is emitted when the editable state of the label changes.

labelsFont()#
Return type:

QFont

Returns the font used to draw labels.

See also

setLabelsFont()

Getter of property labelsFontᅟ .

labelsFontChanged(pen)#
Parameters:

penQFont

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

Notification signal of property labelsFontᅟ .

labelsTruncated()#
Return type:

bool

Getter of property labelsTruncatedᅟ .

labelsTruncatedChanged(labelsTruncated)#
Parameters:

labelsTruncated – bool

This signal is emitted in two cases; when the axis changes from having one or more truncated labels to having no truncated labels, and when the axis changes from having no truncated labels to having one or more truncated labels. Current state is identified by labelsTruncated.

Notification signal of property labelsTruncatedᅟ .

labelsVisible()#
Return type:

bool

Getter of property labelsVisibleᅟ .

labelsVisibleChanged(visible)#
Parameters:

visible – bool

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

Notification signal of property labelsVisibleᅟ .

linePen()#
Return type:

QPen

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

See also

setLinePen()

Getter of property linePenᅟ .

linePenChanged(pen)#
Parameters:

penQPen

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

Notification signal of property linePenᅟ .

linePenColor()#
Return type:

QColor

Getter of property colorᅟ .

lineVisibleChanged(visible)#
Parameters:

visible – bool

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

Notification signal of property lineVisibleᅟ .

minorGridLineColor()#
Return type:

QColor

Getter of property minorGridLineColorᅟ .

minorGridLineColorChanged(color)#
Parameters:

colorQColor

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

Notification signal of property minorGridLineColorᅟ .

minorGridLinePen()#
Return type:

QPen

Getter of property minorGridLinePenᅟ .

minorGridLinePenChanged(pen)#
Parameters:

penQPen

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

Notification signal of property minorGridLinePenᅟ .

minorGridVisibleChanged(visible)#
Parameters:

visible – bool

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

Notification signal of property minorGridVisibleᅟ .

orientation()#
Return type:

Orientation

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

Getter of property orientationᅟ .

reverseChanged(reverse)#
Parameters:

reverse – bool

Notification signal of property reverseᅟ .

setGridLineColor(color)#
Parameters:

colorQColor

See also

gridLineColor()

Setter of property gridLineColorᅟ .

setGridLinePen(pen)#
Parameters:

penQPen

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

See also

gridLinePen()

Setter of property gridLinePenᅟ .

setGridLineVisible([visible=true])#
Parameters:

visible – bool

Setter of property gridVisibleᅟ .

setLabelsAngle(angle)#
Parameters:

angle – int

See also

labelsAngle()

Setter of property labelsAngleᅟ .

setLabelsBrush(brush)#
Parameters:

brushQBrush

Sets the brush used to draw labels to brush.

See also

labelsBrush()

Setter of property labelsBrushᅟ .

setLabelsColor(color)#
Parameters:

colorQColor

See also

labelsColor()

Setter of property labelsColorᅟ .

setLabelsEditable([editable=true])#
Parameters:

editable – bool

Sets axis labels editability to editable.

When the labels are editable the user will be able to change the range of the axis conveniently by editing any of the labels. This feature is only supported for the QValueAxis and the QDateTimeAxis .

By default, labels are not editable.

See also

labelsEditable()

setLabelsFont(font)#
Parameters:

fontQFont

Sets the font used to draw labels to font.

See also

labelsFont()

Setter of property labelsFontᅟ .

setLabelsVisible([visible=true])#
Parameters:

visible – bool

See also

labelsVisible()

Setter of property labelsVisibleᅟ .

setLinePen(pen)#
Parameters:

penQPen

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

See also

linePen()

Setter of property linePenᅟ .

setLinePenColor(color)#
Parameters:

colorQColor

See also

linePenColor()

Setter of property colorᅟ .

setLineVisible([visible=true])#
Parameters:

visible – bool

Determines whether the axis line and tick marks are visible.

See also

isLineVisible()

Setter of property lineVisibleᅟ .

setMax(max)#
Parameters:

max – object

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.

setMin(min)#
Parameters:

min – object

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.

setMinorGridLineColor(color)#
Parameters:

colorQColor

Setter of property minorGridLineColorᅟ .

setMinorGridLinePen(pen)#
Parameters:

penQPen

Setter of property minorGridLinePenᅟ .

setMinorGridLineVisible([visible=true])#
Parameters:

visible – bool

Setter of property minorGridVisibleᅟ .

setRange(min, max)#
Parameters:
  • min – object

  • max – object

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.

setReverse([reverse=true])#
Parameters:

reverse – bool

See also

isReverse()

Setter of property reverseᅟ .

setShadesBorderColor(color)#
Parameters:

colorQColor

Setter of property shadesBorderColorᅟ .

setShadesBrush(brush)#
Parameters:

brushQBrush

Sets the brush used to draw shades to brush.

See also

shadesBrush()

Setter of property shadesBrushᅟ .

setShadesColor(color)#
Parameters:

colorQColor

See also

shadesColor()

Setter of property shadesColorᅟ .

setShadesPen(pen)#
Parameters:

penQPen

Sets the pen used to draw shades to pen.

See also

shadesPen()

Setter of property shadesPenᅟ .

setShadesVisible([visible=true])#
Parameters:

visible – bool

See also

shadesVisible()

Setter of property shadesVisibleᅟ .

setTitleBrush(brush)#
Parameters:

brushQBrush

Sets the brush used to draw titles to brush.

See also

titleBrush()

Setter of property titleBrushᅟ .

setTitleFont(font)#
Parameters:

fontQFont

Sets the font used to draw titles to font.

See also

titleFont()

Setter of property titleFontᅟ .

setTitleText(title)#
Parameters:

title – str

See also

titleText()

Setter of property titleTextᅟ .

setTitleVisible([visible=true])#
Parameters:

visible – bool

See also

isTitleVisible()

Setter of property titleVisibleᅟ .

setTruncateLabels([truncateLabels=true])#
Parameters:

truncateLabels – bool

See also

truncateLabels()

Setter of property truncateLabelsᅟ .

setVisible([visible=true])#
Parameters:

visible – bool

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

See also

isVisible()

Setter of property visibleᅟ .

shadesBorderColor()#
Return type:

QColor

Getter of property shadesBorderColorᅟ .

shadesBorderColorChanged(color)#
Parameters:

colorQColor

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

Notification signal of property shadesBorderColorᅟ .

shadesBrush()#
Return type:

QBrush

Returns the brush used to draw shades.

See also

setShadesBrush()

Getter of property shadesBrushᅟ .

shadesBrushChanged(brush)#
Parameters:

brushQBrush

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

Notification signal of property shadesBrushᅟ .

shadesColor()#
Return type:

QColor

See also

setShadesColor()

Getter of property shadesColorᅟ .

shadesColorChanged(color)#
Parameters:

colorQColor

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

Notification signal of property shadesColorᅟ .

shadesPen()#
Return type:

QPen

Returns the pen used to draw shades.

See also

setShadesPen()

Getter of property shadesPenᅟ .

shadesPenChanged(pen)#
Parameters:

penQPen

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

Notification signal of property shadesPenᅟ .

shadesVisible()#
Return type:

bool

Getter of property shadesVisibleᅟ .

shadesVisibleChanged(visible)#
Parameters:

visible – bool

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

Notification signal of property shadesVisibleᅟ .

show()#

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

titleBrush()#
Return type:

QBrush

Returns the brush used to draw titles.

See also

setTitleBrush()

Getter of property titleBrushᅟ .

titleBrushChanged(brush)#
Parameters:

brushQBrush

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

Notification signal of property titleBrushᅟ .

titleFont()#
Return type:

QFont

Returns the font used to draw titles.

See also

setTitleFont()

Getter of property titleFontᅟ .

titleFontChanged(font)#
Parameters:

fontQFont

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

Notification signal of property titleFontᅟ .

titleText()#
Return type:

str

See also

setTitleText()

Getter of property titleTextᅟ .

titleTextChanged(title)#
Parameters:

title – str

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

Notification signal of property titleTextᅟ .

titleVisibleChanged(visible)#
Parameters:

visible – bool

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

Notification signal of property titleVisibleᅟ .

truncateLabels()#
Return type:

bool

Getter of property truncateLabelsᅟ .

truncateLabelsChanged(truncateLabels)#
Parameters:

truncateLabels – bool

This signal is emitted when the truncation of the labels changes to truncateLabels.

Notification signal of property truncateLabelsᅟ .

abstract type()#
Return type:

AxisType

Returns the type of the axis.

visibleChanged(visible)#
Parameters:

visible – bool

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

Notification signal of property visibleᅟ .