QCategoryAxis Class
The QCategoryAxis class allows putting a named ranges on the axis. More...
Header: | #include <QCategoryAxis> |
Instantiated By: | CategoryAxis |
Inherits: | QValueAxis |
Public Types
enum | AxisLabelsPosition { AxisLabelsPositionCenter, AxisLabelsPositionOnValue } |
Properties
- categoriesLabels : const QStringList
- count : const int
- labelsPosition : AxisLabelsPosition
- startValue : qreal
- 5 properties inherited from QValueAxis
- 27 properties inherited from QAbstractAxis
- 1 property inherited from QObject
Public Functions
QCategoryAxis(QObject *parent = Q_NULLPTR) | |
~QCategoryAxis() | |
void | append(const QString &categoryLabel, qreal categoryEndValue) |
QStringList | categoriesLabels() |
int | count() const |
qreal | endValue(const QString &categoryLabel) const |
QCategoryAxis::AxisLabelsPosition | labelsPosition() const |
void | remove(const QString &categoryLabel) |
void | replaceLabel(const QString &oldLabel, const QString &newLabel) |
void | setLabelsPosition(QCategoryAxis::AxisLabelsPosition position) |
void | setStartValue(qreal min) |
qreal | startValue(const QString &categoryLabel = QString()) const |
Reimplemented Public Functions
virtual AxisType | type() const |
- 12 public functions inherited from QValueAxis
- 58 public functions inherited from QAbstractAxis
- 31 public functions inherited from QObject
Signals
void | categoriesChanged() |
void | labelsPositionChanged(QCategoryAxis::AxisLabelsPosition position) |
- 6 signals inherited from QValueAxis
- 25 signals inherited from QAbstractAxis
- 2 signals inherited from QObject
Additional Inherited Members
- 1 public slot inherited from QValueAxis
- 1 public slot inherited from QObject
- 1 public variable inherited from QObject
- 10 static public members inherited from QObject
- 9 protected functions inherited from QObject
- 2 protected variables inherited from QObject
Detailed Description
The QCategoryAxis class allows putting a named ranges on the axis.
This class can be used when the underlying data needs to be given extra meaning. Unlike with the QBarCategoryAxis the QCategoryAxis allows the categories ranges widths to be specified freely.
Example code on how to use QCategoryAxis:
QChartView *chartView = new QChartView; QLineSeries *series = new QLineSeries; // ... chartView->chart()->addSeries(series); QCategoryAxis *axisY = new QCategoryAxis; axisY->setMin(0); axisY->setMax(52); axisY->setStartValue(15); axisY->append("First", 20); axisY->append("Second", 37); axisY->append("Third", 52); chartView->chart()->setAxisY(axisY, series);
Member Type Documentation
enum QCategoryAxis::AxisLabelsPosition
This enum describes the position of the category labels.
Constant | Value | Description |
---|---|---|
QCategoryAxis::AxisLabelsPositionCenter | 0x0 | Labels are centered to category. |
QCategoryAxis::AxisLabelsPositionOnValue | 0x1 | Labels are positioned to the high end limit of the category. |
Property Documentation
categoriesLabels : const QStringList
The category labels as a string list.
Access functions:
QStringList | categoriesLabels() |
count : const int
The count of categories.
Access functions:
int | count() const |
labelsPosition : AxisLabelsPosition
Defines the position of the category labels. The labels in the beginning and in the end of the axes may overlap other axes labels when positioned on value.
Access functions:
QCategoryAxis::AxisLabelsPosition | labelsPosition() const |
void | setLabelsPosition(QCategoryAxis::AxisLabelsPosition position) |
Notifier signal:
void | labelsPositionChanged(QCategoryAxis::AxisLabelsPosition position) |
startValue : qreal
Defines the low end of the first category on the axis.
Access functions:
qreal | startValue(const QString &categoryLabel = QString()) const |
void | setStartValue(qreal min) |
Member Function Documentation
QCategoryAxis::QCategoryAxis(QObject *parent = Q_NULLPTR)
Constructs an axis object which is a child of parent.
QCategoryAxis::~QCategoryAxis()
Destroys the object
void QCategoryAxis::append(const QString &categoryLabel, qreal categoryEndValue)
Appends new category to the axis with an categoryLabel. Category label has to be unique. Parameter categoryEndValue specifies the high end limit of the category. It has to be greater than the high end limit of the previous category. Otherwise the method returns without adding a new category.
[signal]
void QCategoryAxis::categoriesChanged()
Axis emits signal when the categories of the axis have changed.
QStringList QCategoryAxis::categoriesLabels()
Returns the list of the intervals labels
Note: Getter function for property categoriesLabels.
int QCategoryAxis::count() const
Returns number of intervals.
Note: Getter function for property count.
qreal QCategoryAxis::endValue(const QString &categoryLabel) const
Returns the high end limit of the interval specified by an categoryLabel
void QCategoryAxis::remove(const QString &categoryLabel)
Removes an interval specified by the categoryLabel from the axis
void QCategoryAxis::replaceLabel(const QString &oldLabel, const QString &newLabel)
Replaces oldLabel of an existing category with a newLabel If the old label does not exist the method returns without making any changes.
void QCategoryAxis::setStartValue(qreal min)
Sets min to be the low end limit of the first category on the axis. If there is already some categories added to the axis then passed value must be lower than the high end value of the already defined first category range. Otherwise nothing is done.
Note: Setter function for property startValue.
See also startValue().
qreal QCategoryAxis::startValue(const QString &categoryLabel = QString()) const
Returns the low end limit of the category specified by an categoryLabel
Note: Getter function for property startValue.
See also setStartValue().
[virtual]
AxisType QCategoryAxis::type() const
Reimplemented from QAbstractAxis::type().
Returns the type of the axis