En esta página

CategoryAxis QML Type

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

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

AbstractAxis

Propiedades

Métodos

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

Descripción detallada

Este tipo puede utilizarse para explicar los datos subyacentes añadiendo categorías etiquetadas. La anchura de los intervalos de categorías puede especificarse libremente.

Por ejemplo

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 categoría como una lista de cadenas.

count : int [read-only]

El número de categorías.

labelsPosition : enumeration

La posición de las etiquetas de categoría. Las etiquetas del principio y del final de los ejes pueden solaparse con las etiquetas de otros ejes cuando se posicionan sobre el valor.

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

startValue : int

El extremo inferior de la primera categoría del eje.

Documentación del método

void append(string label, real endValue)

Añade una nueva categoría al eje con la etiqueta label. Una etiqueta de 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 vuelve sin añadir una nueva categoría.

void remove(string label)

Elimina del eje una 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 antigua no existe, el método devuelve 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.