ScatterSeries QML Type

Der Typ ScatterSeries stellt Daten in Streudiagrammen dar. Mehr...

Import Statement: import QtGraphs
In C++: QScatterSeries
Inherits:

XYSeries

Eigenschaften

Detaillierte Beschreibung

Die Streudaten werden als eine Sammlung von Punkten im Diagramm angezeigt. Für jeden Punkt werden zwei Werte angegeben, die seine Position auf der horizontalen Achse und der vertikalen Achse bestimmen.

Sie können Streuungsdaten darstellen, indem Sie eine ScatterSeries innerhalb von GraphsView erstellen. Die Daten können dem Diagramm hinzugefügt werden, indem XYPoints als untergeordnete Elemente der ScatterSeries erstellt werden, die die x- und y-Werte der einzelnen Punkte definieren.

GraphsView {
    anchors.fill: parent
    axisX: ValueAxis {
        max: 3
    }
    axisY: ValueAxis {
        max: 3
    }

    ScatterSeries {
        color: "#00ff00"
        XYPoint { x: 0.5; y: 0.5 }
        XYPoint { x: 1; y: 1 }
        XYPoint { x: 2; y: 2 }
        XYPoint { x: 2.5; y: 1.5 }
    }
}

Mehrere Streudiagramme können erstellt werden, indem mehrere ScatterSeries als untergeordnete Elemente von GraphsView hinzugefügt werden. In solchen Fällen sollte nur eine Serie die verwendete Achse definieren, da mehrere Definitionen nur die früheren überschreiben.

GraphsView {
    anchors.fill: parent
    ScatterSeries {
        color: "#00ff00"
        axisX: ValueAxis {
            max: 3
        }
        axisY: ValueAxis {
            max: 3
        }

        XYPoint { x: 0.5; y: 0.5 }
        XYPoint { x: 1; y: 1 }
        XYPoint { x: 2; y: 2 }
        XYPoint { x: 2.5; y: 1.5 }
    }

    ScatterSeries {
        color: "#ff0000"
        XYPoint { x: 0.5; y: 3 }
        XYPoint { x: 1; y: 2 }
        XYPoint { x: 2; y: 2.5 }
        XYPoint { x: 2.5; y: 1 }
    }
}

Eigenschaft Dokumentation

pointDelegate : Component

Markiert Punkte mit der angegebenen QML-Komponente.

pointDelegate: Image {
    source: "images/happy_box.png"
}

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