QBarCategoryAxis Class▲
-
Header: QBarCategoryAxis
-
Inherited By:
-
Instantiated By: qml-qtcharts-barcategoryaxis.xml
-
Inherits: QAbstractAxis
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. 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-&
gt;chart()-&
gt;addSeries(series);
chartView-&
gt;chart()-&
gt;createDefaultAxes();
QBarCategoryAxis *
axisX =
new
QBarCategoryAxis;
QStringList categories;
categories &
lt;&
lt; "Jan"
&
lt;&
lt; "Feb"
&
lt;&
lt; "Mar"
&
lt;&
lt; "Apr"
&
lt;&
lt; "May"
&
lt;&
lt; "Jun"
;
axisX-&
gt;append(categories);
axisX-&
gt;setRange("Feb"
, "May"
);
chartView-&
gt;chart()-&
gt;setAxisX(axisX, series);
Property Documentation▲
categories : QStringList▲
This property holds the categories of an axis.
Access functions:
-
void setCategories(const &categories)
Notifier signal:
-
void categoriesChanged()
[read-only] count : const int▲
This property holds the number of categories of an axis.
Access functions:
-
int count() const
Notifier signal:
-
void countChanged()
max : QString▲
This property holds the maximum value on the axis.
Access functions:
Notifier signal:
-
void maxChanged(const &max)
min : QString▲
This property holds the minimum value on the axis.
Access functions:
Notifier signal:
-
void minChanged(const &min)
Member Function Documentation▲
[explicit] QBarCategoryAxis::QBarCategoryAxis(QObject *parent = nullptr)▲
Constructs an axis object that is the child of parent.
[virtual] QBarCategoryAxis::~QBarCategoryAxis()▲
Destroys the axis object.
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.
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.
QString QBarCategoryAxis::at(int index) const▲
Returns the category at index. The index must be valid.
QStringList QBarCategoryAxis::categories()▲
void QBarCategoryAxis::categoriesChanged()▲
This signal is emitted when the categories of the axis change.
Notifier signal for property categories.
void QBarCategoryAxis::clear()▲
Removes all categories. Sets the maximum and minimum values of the axis range to QString::null.
int QBarCategoryAxis::count() const▲
Returns the number of categories.
Getter function for property count.
void QBarCategoryAxis::countChanged()▲
This signal is emitted when the number of categories of an axis changes.
Notifier signal for property count.
void QBarCategoryAxis::insert(int 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.
QString QBarCategoryAxis::max() const▲
void QBarCategoryAxis::maxChanged(const QString &max)▲
This signal is emitted when the max value of the axis changes.
Notifier signal for property max.
QString QBarCategoryAxis::min() const▲
void QBarCategoryAxis::minChanged(const QString &min)▲
This signal is emitted when the min value of the axis changes.
Notifier signal for property min.
void QBarCategoryAxis::rangeChanged(const QString &min, const QString &max)▲
This signal is emitted when min or max value of the axis changes.
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.
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.
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.
Setter function for property categories.
See Also▲
See also categories()
void QBarCategoryAxis::setMax(const QString &max)▲
void QBarCategoryAxis::setMin(const QString &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.