このページでは

CategoryAxis QML Type

CategoryAxis は、軸上に名前付き範囲を配置します。詳細...

Import Statement: import QtCharts 2.12
In C++: QCategoryAxis
Inherits:

AbstractAxis

Status: Deprecated

この型は非推奨です。新しいコードでの使用は強く推奨しません。

プロパティ

方法

  • void append(string label, real endValue)
  • void remove(string label)
  • void replace(string oldLabel, string newLabel)

詳細な説明

このタイプは、ラベル付きのカテゴリを追加することで、基礎となるデータを説明するために使用できます。カテゴリ範囲の幅は自由に指定できます。

例:

「重要」、「低」、「正常」、「高」、「極めて高」とラベル付けされたカテゴリ軸を持つ折れ線グラフ

ChartView {
    title: "Numerical Data for Dummies"
    anchors.fill: parent
    legend.visible: false
    antialiasing: true

    LineSeries {
        axisY: CategoryAxis {
            min: 0
            max: 30
            CategoryRange {
                label: "critical"
                endValue: 2
            }
            CategoryRange {
                label: "low"
                endValue: 4
            }
            CategoryRange {
                label: "normal"
                endValue: 7
            }
            CategoryRange {
                label: "high"
                endValue: 15
            }
            CategoryRange {
                label: "extremely high"
                endValue: 30
            }
        }

        XYPoint { x: 0; y: 4.3 }
        XYPoint { x: 1; y: 4.1 }
        XYPoint { x: 2; y: 4.7 }
        XYPoint { x: 3; y: 3.9 }
        XYPoint { x: 4; y: 5.2 }
    }
}

プロパティのドキュメント

categoriesLabels : StringList [read-only]

カテゴリラベルは文字列のリストとして指定されます。

count : int [read-only]

カテゴリの数。

labelsPosition : enumeration

カテゴリラベルの位置。軸の始点および終点にあるラベルは、「値」を基準に配置した場合、他の軸のラベルと重なることがあります。

定数説明
CategoryAxis.AxisLabelsPositionCenterラベルはカテゴリの中央に配置されます。
CategoryAxis.AxisLabelsPositionOnValueラベルは、カテゴリの上限に配置されます。

startValue : int

軸上の第1のカテゴリーの最小値。

メソッドのドキュメント

void append(string label, real endValue)

ラベル「label 」を持つ新しいカテゴリを軸に追加します。カテゴリラベルは一意である必要があります。endValue は、そのカテゴリの上限値を指定します。この値は、前のカテゴリの上限値よりも大きくなければなりません。そうでない場合、このメソッドは新しいカテゴリを追加せずに終了します。

void remove(string label)

ラベル「label 」で指定されたカテゴリを軸から削除します。

void replace(string oldLabel, string newLabel)

oldLabel で指定された既存のカテゴリラベルを、newLabel に置き換えます。古いラベルが存在しない場合、このメソッドは変更を行わずに戻ります。

© 2026 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.