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.