QBarCategoryAxis Class
The QBarCategoryAxis class adds categories to a graph's axes. More...
Header: | #include <QBarCategoryAxis> |
CMake: | find_package(Qt6 REQUIRED COMPONENTS Graphs) target_link_libraries(mytarget PRIVATE Qt6::Graphs) |
qmake: | QT += graphs |
In QML: | BarCategoryAxis |
Inherits: | QAbstractAxis |
- List of all members, including inherited members
- QBarCategoryAxis is part of Qt Graphs C++ Classes for 2D.
Properties
- categories : QStringList
- count : const qsizetype
- max : QString
- min : QString
Public Functions
QBarCategoryAxis(QObject *parent = nullptr) | |
virtual | ~QBarCategoryAxis() override |
void | append(const QString &category) |
void | append(const QStringList &categories) |
QString | at(qsizetype index) const |
QStringList | categories() |
void | clear() |
qsizetype | count() const |
void | insert(qsizetype index, const QString &category) |
QString | max() const |
QString | min() const |
void | remove(const QString &category) |
void | remove(qsizetype index) |
void | replace(const QString &oldCategory, const QString &newCategory) |
void | setCategories(const QStringList &categories) |
void | setMax(const QString &max) |
void | setMin(const QString &min) |
void | setRange(const QString &minCategory, const QString &maxCategory) |
Reimplemented Public Functions
virtual QAbstractAxis::AxisType | type() const override |
Signals
void | categoriesChanged() |
void | countChanged() |
void | maxChanged(const QString &max) |
void | minChanged(const QString &min) |
Detailed Description
QBarCategoryAxis can be set up to show an axis line with tick marks, grid lines, and shades. Categories are drawn between the ticks.
Property Documentation
categories : QStringList
This property holds the categories of an axis.
Access functions:
QStringList | categories() |
void | setCategories(const QStringList &categories) |
Notifier signal:
void | categoriesChanged() |
[read-only]
count : const qsizetype
This property holds the number of categories of an axis.
Access functions:
qsizetype | count() const |
Notifier signal:
void | countChanged() |
max : QString
This property holds the maximum value on the axis.
The maximum value on the axis. The given value should be contained in categories
.
Access functions:
Notifier signal:
void | maxChanged(const QString &max) |
min : QString
This property holds the minimum value on the axis.
The minimum value on the axis. The given value should be contained in categories
.
Access functions:
Notifier signal:
void | minChanged(const QString &min) |
Member Function Documentation
[explicit]
QBarCategoryAxis::QBarCategoryAxis(QObject *parent = nullptr)
Constructs an axis object that is the child of parent.
[override virtual noexcept]
QBarCategoryAxis::~QBarCategoryAxis()
Destroys the axis object.
[invokable]
void QBarCategoryAxis::append(const QString &category)
Appends category to an axis. The maximum value on the axis will be changed to match the last category. If no categories were previously defined, the minimum value on the axis will also be changed to match category.
A category has to be a valid QString and it cannot be duplicated. Duplicated categories will not be appended.
Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.
[invokable]
void QBarCategoryAxis::append(const QStringList &categories)
Appends categories to an axis. The maximum value on the axis will be changed to match the last category in categories. If no categories were previously defined, the minimum value on the axis will also be changed to match the first category in categories.
A category has to be a valid QString and it cannot be duplicated. Duplicated categories will not be appended.
Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.
[invokable]
QString QBarCategoryAxis::at(qsizetype index) const
Returns the category at index.
Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.
QStringList QBarCategoryAxis::categories()
Returns categories.
Note: Getter function for property categories.
See also setCategories().
[invokable]
void QBarCategoryAxis::clear()
Removes all categories. Sets the maximum and minimum values of the axis range to QString::null.
Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.
qsizetype QBarCategoryAxis::count() const
Returns the number of categories.
Note: Getter function for property count.
[invokable]
void QBarCategoryAxis::insert(qsizetype index, const QString &category)
Inserts category to the axis at index. category has to be a valid QString and it cannot be duplicated. If category is prepended or appended to other categories, the minimum and maximum values on the axis are updated accordingly.
Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.
QString QBarCategoryAxis::max() const
Returns the maximum category.
Note: Getter function for property max.
See also setMax().
QString QBarCategoryAxis::min() const
Returns the minimum category.
Note: Getter function for property min.
See also setMin().
[invokable]
void QBarCategoryAxis::remove(const QString &category)
Removes category from the axis. Removing a category that currently sets the maximum or minimum value on the axis will affect the axis range.
Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.
[invokable]
void QBarCategoryAxis::remove(qsizetype index)
Removes a category at index from the axis. Removing a category that currently sets the maximum or minimum value on the axis will affect the axis range.
Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.
[invokable]
void QBarCategoryAxis::replace(const QString &oldCategory, const QString &newCategory)
Replaces oldCategory with newCategory. If oldCategory does not exist on the axis, nothing is done. newCategory has to be a valid QString and it cannot be duplicated. If the minimum or maximum category is replaced, the minimum and maximum values on the axis are updated accordingly.
Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.
void QBarCategoryAxis::setCategories(const QStringList &categories)
Sets categories and discards the old ones. The axis range is adjusted to match the first and last category in categories.
A category has to be a valid QString and it cannot be duplicated.
Note: Setter function for property categories.
See also categories().
void QBarCategoryAxis::setMax(const QString &max)
Sets the maximum category to max.
Note: Setter function for property max.
See also max().
void QBarCategoryAxis::setMin(const QString &min)
Sets the minimum category to min.
Note: Setter function for property min.
See also min().
void QBarCategoryAxis::setRange(const QString &minCategory, const QString &maxCategory)
Sets the axis range from minCategory to maxCategory.
[override virtual]
QAbstractAxis::AxisType QBarCategoryAxis::type() const
Reimplements: QAbstractAxis::type() const.
Returns the type of the axis.