QCategoryAxis Class

QCategoryAxis 클래스는 축에 명명된 범위를 배치합니다. 더 보기...

Header: #include <QCategoryAxis>
In QML: CategoryAxis
Inherits: QValueAxis

공용 유형

enum AxisLabelsPosition { AxisLabelsPositionCenter, AxisLabelsPositionOnValue }

속성

공용 함수

QCategoryAxis(QObject *parent = nullptr)
virtual ~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 QAbstractAxis::AxisType type() const override

신호

void categoriesChanged()
void labelsPositionChanged(QCategoryAxis::AxisLabelsPosition position)

상세 설명

이 클래스는 레이블이 지정된 카테고리를 추가하여 기초 데이터를 설명하는 데 사용할 수 있습니다. QBarCategoryAxis 와 달리 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

이 열거형은 카테고리 레이블의 위치를 설명합니다.

Constant설명
QCategoryAxis::AxisLabelsPositionCenter0x0레이블은 카테고리의 중앙에 위치합니다.
QCategoryAxis::AxisLabelsPositionOnValue0x1레이블은 카테고리의 최상단 한계에 위치합니다.

속성 문서

[read-only] categoriesLabels : const QStringList

이 속성은 카테고리 레이블을 문자열 목록으로 저장합니다.

함수에 액세스합니다:

QStringList categoriesLabels()

[read-only] count : const int

이 속성은 카테고리 수를 보유합니다.

액세스 함수:

int count() const

labelsPosition : AxisLabelsPosition

이 속성은 카테고리 레이블의 위치를 유지합니다. 축의 시작과 끝에 있는 레이블은 값에 위치할 때 다른 축의 레이블과 겹칠 수 있습니다.

기능에 액세스합니다:

QCategoryAxis::AxisLabelsPosition labelsPosition() const
void setLabelsPosition(QCategoryAxis::AxisLabelsPosition position)

알림 신호:

void labelsPositionChanged(QCategoryAxis::AxisLabelsPosition position)

startValue : qreal

이 속성은 축에서 첫 번째 카테고리의 하위 카테고리를 보유합니다.

액세스 함수입니다:

qreal startValue(const QString &categoryLabel = QString()) const
void setStartValue(qreal min)

멤버 함수 문서

[explicit] QCategoryAxis::QCategoryAxis(QObject *parent = nullptr)

parent 의 자식인 축 객체를 생성합니다.

[virtual noexcept] QCategoryAxis::~QCategoryAxis()

개체를 파괴합니다.

void QCategoryAxis::append(const QString &categoryLabel, qreal categoryEndValue)

categoryLabel 레이블을 사용하여 축에 새 카테고리를 추가합니다. 카테고리 레이블은 고유해야 합니다. categoryEndValue 은 카테고리의 최상위 한도를 지정합니다. 이전 카테고리의 최상위 제한보다 커야 합니다. 그렇지 않으면 새 카테고리를 추가하지 않고 메서드가 반환됩니다.

[signal] void QCategoryAxis::categoriesChanged()

이 신호는 축의 카테고리가 변경될 때 발생합니다.

QStringList QCategoryAxis::categoriesLabels()

카테고리의 레이블 목록을 반환합니다.

참고: 프로퍼티 카테고리 레이블에 대한 게터 함수입니다.

int QCategoryAxis::count() const

카테고리 수를 반환합니다.

참고: 속성 개수에 대한 게터 함수입니다.

qreal QCategoryAxis::endValue(const QString &categoryLabel) const

categoryLabel 에 지정된 카테고리의 상한을 반환합니다.

void QCategoryAxis::remove(const QString &categoryLabel)

categoryLabel 레이블로 지정된 카테고리를 축에서 제거합니다.

void QCategoryAxis::replaceLabel(const QString &oldLabel, const QString &newLabel)

oldLabel 에 지정된 기존 카테고리 레이블을 newLabel 로 바꿉니다. 이전 레이블이 존재하지 않으면 메서드는 변경하지 않고 반환합니다.

void QCategoryAxis::setStartValue(qreal min)

min 을 축의 첫 번째 카테고리의 하한으로 설정합니다. 카테고리가 이미 축에 추가된 경우 전달된 값은 이미 정의된 첫 번째 카테고리 범위의 최상위 값보다 작아야 합니다. 그렇지 않으면 아무 작업도 수행되지 않습니다.

참고: 속성에 대한 설정자 함수 startValue.

startValue()도 참조하세요 .

qreal QCategoryAxis::startValue(const QString &categoryLabel = QString()) const

categoryLabel 에 지정된 카테고리의 하한값을 반환합니다.

참고: 시작값 프로퍼티에 대한 게터 함수입니다.

setStartValue()도 참조하세요 .

[override virtual] QAbstractAxis::AxisType QCategoryAxis::type() const

재구현합니다: QValueAxis::type() const.

축의 타입을 반환합니다.

© 2025 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.