ScatterSeries QML Type
ScatterSeries 类型用于在散点图中呈现数据。更多内容...
| Import Statement: | import QtGraphs |
| In C++: | QScatterSeries |
| Inherits: |
- 所有成员列表(包括继承的成员)
- ScatterSeries 属于Qt Graphs 的2D QML类型。
属性
- pointDelegate : Component
详细说明
散点数据在图表上以一组点的形式显示。每个点都指定了两个值,用于确定其在横轴和纵轴上的位置。

您可以通过在GraphsView 中创建一个ScatterSeries来呈现散点数据。通过为ScatterSeries创建XYPoints子节点(这些子节点定义了每个点的x和y值),即可将数据添加到图表中。
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 }
}
}通过将多个`ScatterSeries`作为GraphsView 的子元素,可以创建多个散点图。在这种情况下,应仅由一个系列定义所使用的坐标轴,因为多个定义只会覆盖之前的定义。
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 }
}
}属性文档
pointDelegate : Component
使用给定的 QML 组件标记点。
pointDelegate: Image {
source: "images/happy_box.png"
}© 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.