Nesta página

CategoryAxis QML Type

O CategoryAxis posiciona intervalos nomeados no eixo. Mais...

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

AbstractAxis

Status: Deprecated

Esse tipo está obsoleto. Recomendamos enfaticamente que você não o utilize em códigos novos.

Propriedades

Métodos

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

Descrição detalhada

Esse tipo pode ser usado para explicar os dados subjacentes por meio da adição de categorias rotuladas. As larguras dos intervalos das categorias podem ser definidas livremente.

Por exemplo:

Gráfico de linhas com um eixo de categorias intitulado “crítico”, “baixo”, “normal”, “alto” e “extremamente alto”

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 }
    }
}

Documentação de propriedades

categoriesLabels : StringList [read-only]

Os rótulos das categorias como uma lista de cadeias de caracteres.

count : int [read-only]

O número de categorias.

labelsPosition : enumeration

A posição dos rótulos das categorias. Os rótulos no início e no final dos eixos podem se sobrepor aos rótulos de outros eixos quando posicionados com base no valor.

ConstanteDescrição
CategoryAxis.AxisLabelsPositionCenterOs rótulos são centralizados na categoria.
CategoryAxis.AxisLabelsPositionOnValueOs rótulos são posicionados no limite superior da categoria.

startValue : int

A extremidade inferior da primeira categoria no eixo.

Documentação do método

void append(string label, real endValue)

Adiciona uma nova categoria ao eixo com o rótulo “ label ”. O rótulo de uma categoria deve ser único. “ endValue ” especifica o limite superior da categoria. Esse valor deve ser maior que o limite superior da categoria anterior. Caso contrário, o método retorna sem adicionar uma nova categoria.

void remove(string label)

Remove do eixo uma categoria especificada pelo rótulo “ label ”.

void replace(string oldLabel, string newLabel)

Substitui o nome de uma categoria existente, especificado por ` oldLabel `, por ` newLabel`. Se o nome antigo não existir, o método retorna sem realizar nenhuma alteração.

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