CategoryAxis QML Type

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

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

AbstractAxis

プロパティ

方法

  • append(string label, real endValue)
  • remove(string label)
  • 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

軸上の最初のカテゴリの下限。


メソッドの説明

append(string label, real endValue)

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


remove(string label)

ラベルlabel によって指定されたカテゴリを軸から削除します。


replace(string oldLabel, string newLabel)

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


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