En esta página

CategoryAxis QML Type

CategoryAxis coloca rangos con nombre en el eje. Más información...

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

AbstractAxis

Status: Deprecated

Este tipo está obsoleto. Recomendamos encarecidamente no utilizarlo en código nuevo.

Propiedades

Métodos

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

Descripción detallada

Este tipo se puede utilizar para explicar los datos subyacentes añadiendo categorías etiquetadas. El ancho de los rangos de las categorías se puede especificar libremente.

Por ejemplo:

Gráfico de líneas con un eje de categorías con las etiquetas «crítico», «bajo», «normal», «alto» y «extremadamente 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 }
    }
}

Documentación de la propiedad

categoriesLabels : StringList [read-only]

Las etiquetas de las categorías como una lista de cadenas.

count : int [read-only]

El número de categorías.

labelsPosition : enumeration

La posición de las etiquetas de las categorías. Las etiquetas situadas al principio y al final de los ejes pueden solaparse con las de otros ejes cuando se colocan en función del valor.

ConstanteDescripción
CategoryAxis.AxisLabelsPositionCenterLas etiquetas se centran en la categoría.
CategoryAxis.AxisLabelsPositionOnValueLas etiquetas se sitúan en el límite superior de la categoría.

startValue : int

El extremo inferior de la primera categoría en el eje.

Documentación del método

void append(string label, real endValue)

Añade una nueva categoría al eje con la etiqueta « label ». La etiqueta de una categoría debe ser única. « endValue » especifica el límite superior de la categoría. Debe ser mayor que el límite superior de la categoría anterior. De lo contrario, el método finaliza sin añadir una nueva categoría.

void remove(string label)

Elimina del eje la categoría especificada por la etiqueta « label ».

void replace(string oldLabel, string newLabel)

Sustituye una etiqueta de categoría existente, especificada por ` oldLabel `, por ` newLabel`. Si la etiqueta anterior no existe, el método finaliza sin realizar ningún cambio.

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