QCategoryAxis Class
The QCategoryAxis class places named ranges on the axis. 更多...
头文件: | #include <QCategoryAxis> |
Instantiated By: | CategoryAxis |
基类: | QValueAxis |
公有类型
enum | AxisLabelsPosition { AxisLabelsPositionCenter, AxisLabelsPositionOnValue } |
属性
- categoriesLabels : const QStringList
- count : const int
- labelsPosition : AxisLabelsPosition
- startValue : qreal
- 5 个属性继承自 QValueAxis
- 27 个属性继承自 QAbstractAxis
- 1 个属性继承自 QObject
公有函数
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 |
重新实现的公有函数
virtual AxisType | type() const |
- 12 个公有函数继承自 QValueAxis
- 58 个公有函数继承自 QAbstractAxis
- 32 个公有函数继承自 QObject
信号
void | categoriesChanged() |
void | labelsPositionChanged(QCategoryAxis::AxisLabelsPosition position) |
- 6 个信号继承自 QValueAxis
- 25 个信号继承自 QAbstractAxis
- 2 个信号继承自 QObject
其他继承的成员
- 1 个公有槽函数继承自 QValueAxis
- 1 个公有槽函数继承自 QObject
- 1 个公有变量继承自 QObject
- 10 个静态公有成员继承自 QObject
- 9 个受保护的函数继承自 QObject
- 2 个受保护的变量继承自 QObject
详细描述
The QCategoryAxis class places named ranges on the axis.
This class can be used to explain the underlying data by adding labeled categories. Unlike QBarCategoryAxis, QCategoryAxis allows the widths of the category ranges 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);
成员类型
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. |
属性
categoriesLabels : const QStringList
This property holds the category labels as a string list.
访问函数:
QStringList | categoriesLabels() |
count : const int
This property holds the number of categories.
访问函数:
int | count() const |
labelsPosition : AxisLabelsPosition
This property holds 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.
访问函数:
QCategoryAxis::AxisLabelsPosition | labelsPosition() const |
void | setLabelsPosition(QCategoryAxis::AxisLabelsPosition position) |
Notifier signal:
void | labelsPositionChanged(QCategoryAxis::AxisLabelsPosition position) |
startValue : qreal
This property holds the low end of the first category on the axis.
访问函数:
qreal | startValue(const QString &categoryLabel = QString()) const |
void | setStartValue(qreal min) |
成员函数
QCategoryAxis::QCategoryAxis(QObject *parent = Q_NULLPTR)
Constructs an axis object that is a child of parent.
QCategoryAxis::~QCategoryAxis()
Destroys the object.
void QCategoryAxis::append(const QString &categoryLabel, qreal categoryEndValue)
Appends a new category to the axis with the label categoryLabel. A category label has to be unique. 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()
This signal is emitted when the categories of the axis change.
QStringList QCategoryAxis::categoriesLabels()
Returns the list of the categories' labels.
Note: Getter function for property categoriesLabels.
int QCategoryAxis::count() const
Returns the number of categories.
Note: Getter function for property count.
qreal QCategoryAxis::endValue(const QString &categoryLabel) const
Returns the high end limit of the category specified by categoryLabel.
void QCategoryAxis::remove(const QString &categoryLabel)
Removes a category specified by the label categoryLabel from the axis.
void QCategoryAxis::replaceLabel(const QString &oldLabel, const QString &newLabel)
Replaces an existing category label specified by oldLabel with 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 categories have already been added to the axis, the passed value must be less than the high end value of the already defined first category range. Otherwise nothing is done.
Note: Setter function for property startValue.
参见 startValue().
qreal QCategoryAxis::startValue(const QString &categoryLabel = QString()) const
Returns the low end limit of the category specified by categoryLabel.
Note: Getter function for property startValue.
参见 setStartValue().
[virtual]
AxisType QCategoryAxis::type() const
Reimplemented from QAbstractAxis::type().
Returns the type of the axis.