In questa pagina

CategoryAxis QML Type

CategoryAxis inserisce intervalli denominati sull'asse. Maggiori informazioni...

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

AbstractAxis

Status: Deprecated

Questo tipo è deprecato. Si sconsiglia vivamente di utilizzarlo nel nuovo codice.

Proprietà

Metodi

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

Descrizione dettagliata

Questo tipo può essere utilizzato per spiegare i dati sottostanti aggiungendo categorie etichettate. Le larghezze degli intervalli delle categorie possono essere specificate liberamente.

Ad esempio:

Grafico lineare con un asse delle categorie contrassegnato con le etichette “critico”, “basso”, “normale”, “alto” ed “estremamente 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 }
    }
}

Documentazione sulle proprietà

categoriesLabels : StringList [read-only]

Le etichette delle categorie come elenco di stringhe.

count : int [read-only]

Il numero di categorie.

labelsPosition : enumeration

La posizione delle etichette delle categorie. Le etichette all'inizio e alla fine degli assi potrebbero sovrapporsi alle etichette di altri assi se posizionate in base al valore.

CostanteDescrizione
CategoryAxis.AxisLabelsPositionCenterLe etichette sono centrate rispetto alla categoria.
CategoryAxis.AxisLabelsPositionOnValueLe etichette sono posizionate sul limite superiore della categoria.

startValue : int

Il valore minimo della prima categoria sull'asse.

Documentazione sul metodo

void append(string label, real endValue)

Aggiunge una nuova categoria all'asse con l'etichetta label. L'etichetta di una categoria deve essere univoca. endValue specifica il limite massimo della categoria. Deve essere maggiore del limite massimo della categoria precedente. In caso contrario, il metodo termina senza aggiungere una nuova categoria.

void remove(string label)

Rimuove dall'asse una categoria specificata dall'etichetta “ label ”.

void replace(string oldLabel, string newLabel)

Sostituisce l'etichetta di una categoria esistente specificata da ` oldLabel ` con ` newLabel`. Se la vecchia etichetta non esiste, il metodo termina senza apportare alcuna modifica.

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