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 ではカテゴリ範囲の幅を自由に指定できます。

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

この列挙型はカテゴリーラベルの位置を記述する。

定数説明
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()

カテゴリのラベルのリストを返します。

注: プロパティ 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 で指定されたカテゴリの下限値を返す。

注: プロパティ startValue のゲッター関数。

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.