The QAbstractAxis class is a base class used for specialized axis classes. More...
Header: | #include <QAbstractAxis> |
Instantiated By: | AbstractAxis |
Inherits: | QObject |
Inherited By: |
QBarCategoryAxis, QColorAxis, QDateTimeAxis, QLogValueAxis, and QValueAxis |
enum | AxisType { AxisTypeNoAxis, AxisTypeValue, AxisTypeBarCategory, AxisTypeCategory, AxisTypeDateTime, …, AxisTypeColor } |
flags | AxisTypes |
|
|
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 |
bool | labelsEditable() const |
QFont | labelsFont() const |
bool | labelsTruncated() 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 | setLabelsEditable(bool editable = true) |
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 | setTruncateLabels(bool truncateLabels = 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 |
bool | truncateLabels() const |
virtual QAbstractAxis::AxisType | type() const = 0 |
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 | labelsEditableChanged(bool editable) |
void | labelsFontChanged(const QFont &font) |
void | labelsTruncatedChanged(bool labelsTruncated) |
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 | truncateLabelsChanged(bool truncateLabels) |
void | visibleChanged(bool visible) |
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.
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 |
QAbstractAxis::AxisTypeColor |
0x20 |
The AxisTypes type is a typedef for QFlags<AxisType>. It stores an OR combination of AxisType values.
[read-only]
alignment : const Qt::AlignmentThis property holds the alignment of the axis.
Can be Qt::AlignLeft, Qt::AlignRight, Qt::AlignBottom, or Qt::AlignTop.
Access functions:
Qt::Alignment | alignment() const |
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) |
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) |
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) |
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) |
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) |
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) |
This property holds the color of the axis labels.
Access functions:
QColor | labelsColor() const |
void | setLabelsColor(QColor color) |
Notifier signal:
void | labelsColorChanged(QColor color) |
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) |
[read-only]
labelsTruncated : const boolReturns true
if at least one label on the axis is truncated.
Returned value will not be accurate before the axis is shown.
Access functions:
bool | labelsTruncated() const |
Notifier signal:
void | labelsTruncatedChanged(bool labelsTruncated) |
This property holds whether axis labels are visible.
Access functions:
bool | labelsVisible() const |
void | setLabelsVisible(bool visible = true) |
Notifier signal:
void | labelsVisibleChanged(bool visible) |
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) |
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) |
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) |
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) |
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) |
[read-only]
orientation : const Qt::OrientationThis 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 |
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) |
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) |
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) |
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) |
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) |
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) |
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) |
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) |
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) |
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) |
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:
bool | truncateLabels() const |
void | setTruncateLabels(bool truncateLabels = true) |
Notifier signal:
void | truncateLabelsChanged(bool truncateLabels) |
This property holds the visibility of the axis.
Access functions:
bool | isVisible() const |
void | setVisible(bool visible = true) |
Notifier signal:
void | visibleChanged(bool visible) |
[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.
[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.
[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.
[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.
[signal, since 5.13]
void QAbstractAxis::labelsEditableChanged(bool editable)This signal is emitted when the editable state of the label changes.
This function was introduced in Qt 5.13.
[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, since 6.2]
void QAbstractAxis::labelsTruncatedChanged(bool
labelsTruncated)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.
Note: Notifier signal for property labelsTruncated.
This function was introduced in Qt 6.2.
[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.
[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.
[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.
[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.
[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.
[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.
[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.
[signal, since 6.2]
void QAbstractAxis::truncateLabelsChanged(bool truncateLabels)This signal is emitted when the truncation of the labels changes to truncateLabels.
Note: Notifier signal for property truncateLabels.
This function was introduced in Qt 6.2.
[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.
[virtual]
QAbstractAxis::~QAbstractAxis()Destructs the axis object. When the axis is added to a chart, the chart object takes ownership.
Returns the pen used to draw the grid.
Note: Getter function for property gridLinePen.
See also setGridLinePen().
Makes the axis, shades, labels, and grid lines invisible.
Returns the brush used to draw labels.
Note: Getter function for property labelsBrush.
See also setLabelsBrush().
[since 5.13]
bool QAbstractAxis::labelsEditable() constReturns true
if axis labels are editable.
This function was introduced in Qt 5.13.
See also setLabelsEditable().
Returns the font used to draw labels.
Note: Getter function for property labelsFont.
See also setLabelsFont().
Returns the pen used to draw the axis line and tick marks.
Note: Getter function for property linePen.
See also setLinePen().
Returns the orientation of the axis (vertical or horizontal).
Note: Getter function for property orientation.
Sets the pen used to draw the grid lines to pen.
Note: Setter function for property gridLinePen.
See also gridLinePen().
Sets the brush used to draw labels to brush.
Note: Setter function for property labelsBrush.
See also labelsBrush().
[since 5.13]
void QAbstractAxis::setLabelsEditable(bool editable = true)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.
This function was introduced in Qt 5.13.
See also labelsEditable().
Sets the font used to draw labels to font.
Note: Setter function for property labelsFont.
See also labelsFont().
Sets the pen used to draw the axis line and tick marks to pen.
Note: Setter function for property linePen.
See also linePen().
Determines whether the axis line and tick marks are visible.
Note: Setter function for property lineVisible.
See also isLineVisible().
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.
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.
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.
Sets the brush used to draw shades to brush.
Note: Setter function for property shadesBrush.
See also shadesBrush().
Sets the pen used to draw shades to pen.
Note: Setter function for property shadesPen.
See also shadesPen().
Sets the brush used to draw titles to brush.
Note: Setter function for property titleBrush.
See also titleBrush().
Sets the font used to draw titles to font.
Note: Setter function for property titleFont.
See also titleFont().
Sets the visibility of the axis, shades, labels, and grid lines to visible.
Note: Setter function for property visible.
See also isVisible().
Returns the brush used to draw shades.
Note: Getter function for property shadesBrush.
See also setShadesBrush().
Returns the pen used to draw shades.
Note: Getter function for property shadesPen.
See also setShadesPen().
Makes the axis, shades, labels, and grid lines visible.
Returns the brush used to draw titles.
Note: Getter function for property titleBrush.
See also setTitleBrush().
Returns the font used to draw titles.
Note: Getter function for property titleFont.
See also setTitleFont().
[pure virtual]
QAbstractAxis::AxisType QAbstractAxis::type() constReturns the type of the axis.