The QBarCategoryAxis class adds categories to a chart's axes. More...
Header: | #include <QBarCategoryAxis> |
Instantiated By: | BarCategoryAxis |
Inherits: | QAbstractAxis |
QBarCategoryAxis(QObject *parent = nullptr) | |
virtual | ~QBarCategoryAxis() |
void | append(const QStringList &categories) |
void | append(const QString &category) |
QString | at(int index) const |
QStringList | categories() |
void | clear() |
int | count() const |
void | insert(int index, const QString &category) |
QString | max() const |
QString | min() const |
void | remove(const QString &category) |
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) |
virtual QAbstractAxis::AxisType | type() const override |
void | categoriesChanged() |
void | countChanged() |
void | maxChanged(const QString &max) |
void | minChanged(const QString &min) |
void | rangeChanged(const QString &min, const QString &max) |
QBarCategoryAxis can be set up to show an axis line with tick marks, grid lines, and shades. Categories are drawn between the ticks. It can be used also with a line series, as demonstrated by the Line and BarChart Example.
The following code illustrates how to use QBarCategoryAxis:
QChartView *chartView = new QChartView; QBarSeries *series = new QBarSeries; // ... chartView->chart()->addSeries(series); chartView->chart()->createDefaultAxes(); QBarCategoryAxis *axisX = new QBarCategoryAxis; QStringList categories; categories << "Jan" << "Feb" << "Mar" << "Apr" << "May" << "Jun"; axisX->append(categories); axisX->setRange("Feb", "May"); chartView->chart()->setAxisX(axisX, series);
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 intThis property holds the number of categories of an axis.
Access functions:
int | count() const |
Notifier signal:
void | countChanged() |
This property holds the maximum value on the axis.
Access functions:
Notifier signal:
void | maxChanged(const QString &max) |
This property holds the minimum value on the axis.
Access functions:
Notifier signal:
void | minChanged(const QString &min) |
Constructs an axis object that is the child of parent.
[signal]
void QBarCategoryAxis::categoriesChanged()This signal is emitted when the categories of the axis change.
Note: Notifier signal for property categories.
[signal]
void QBarCategoryAxis::countChanged()This signal is emitted when the number of categories of an axis changes.
Note: Notifier signal for property count.
[signal]
void QBarCategoryAxis::maxChanged(const QString &max)This signal is emitted when the max value of the axis changes.
Note: Notifier signal for property max.
[signal]
void QBarCategoryAxis::minChanged(const QString &min)This signal is emitted when the min value of the axis changes.
Note: Notifier signal for property min.
[signal]
void QBarCategoryAxis::rangeChanged(const QString &min,
const QString &max)This signal is emitted when min or max value of the axis changes.
[virtual]
QBarCategoryAxis::~QBarCategoryAxis()Destroys the axis object.
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.
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.
Returns the category at index. The index must be valid.
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.
Returns the number of categories.
Note: Getter function for property count.
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.
Returns the maximum category.
Note: Getter function for property max.
See also setMax().
Returns the minimum category.
Note: Getter function for property min.
See also setMin().
Removes category from the axis. Removing a category that currently sets the maximum or minimum value on the axis will affect the axis range.
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.
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().
Sets the maximum category to max.
Note: Setter function for property max.
See also max().
Sets the minimum category to min.
Note: Setter function for property min.
See also min().
Sets the axis range from minCategory to maxCategory.
[override virtual]
QAbstractAxis::AxisType QBarCategoryAxis::type() constReimplements: QAbstractAxis::type() const.
Returns the type of the axis.