XYSeries QML Type
所有 x 和 y 系列类型的父类型。更多
Import Statement: | import QtGraphs |
In C++: | QXYSeries |
Inherits: | |
Inherited By: |
- 所有成员(包括继承成员)的列表
- XYSeries 是Qt Graphs QML Types for 2D 的一部分。
属性
- color : color
- count : int
- pointDelegate : Component
- selectedColor : color
- selectedPoints : list<int>
信号
- clicked(point point)
- colorChanged(color color)
- doubleClicked(point point)
- draggableChanged()
- pointMarkerChanged()
- pointReplaced(int index)
- pointsAdded(int start, int end)
(since 6.9)
- pointsReplaced()
- pressed(point point)
- released(point point)
- selectedColorChanged(color color)
- selectedPointsChanged()
方法
- append(list<point> points)
- append(point point)
- append(real x, real y)
- point at(int index)
- clear()
- deselectAllPoints()
- deselectPoint(int index)
- deselectPoints(list<int> indexes)
- int find(point point)
- insert(int index, point point)
- bool isPointSelected(int index)
- remove(int index)
- remove(point point)
- remove(real x, real y)
- removeMultiple(int index, int count)
- replace(list<point> points)
- replace(int index, point newPoint)
- replace(point oldPoint, point newPoint)
- replace(int index, real newX, real newY)
- replace(real oldX, real oldY, real newX, real newY)
- selectAllPoints()
- selectPoint(int index)
- selectPoints(list<int> indexes)
- setPointSelected(int index, bool selected)
- bool take(point point)
- toggleSelection(list<int> indexes)
详细说明
在 XYSeries 中,数据点被定义为一个点类型列表,定义了 X 和 Y 位置。
属性文档
color : color |
系列的主颜色。对于LineSeries ,这意味着线的颜色;对于ScatterSeries ,这意味着点的颜色。
count : int |
返回系列中数据点的数量。
pointDelegate : Component |
用作数据点标记的自定义 QML 组件。
该组件的动态属性如下
类型 | 名称 | 描述 |
---|---|---|
bool | 选中点 | 当点被选中时,该值为 true。 |
颜色 | 点颜色 | 系列的颜色。该值来自GraphsTheme 或XYSeries::color (如果XYSeries 重载了颜色)。 |
颜色 | 点边框颜色 | 系列的边框颜色。该值来自GraphsTheme 。 |
颜色 | 点选定颜色 | 系列的选定颜色。该值来自GraphsTheme ,如果XYSeries 覆盖了颜色,则来自XYSeries::selectedColor 。 |
真实 | 点边框宽度 | 系列的边框宽度。该值来自GraphsTheme 。 |
实 | pointValueX | XYPoint::x 在此位置的值。 |
实 | pointValueY | XYPoint::y 在此位置的值。 |
int | pointIndex | 点的索引,从 0 到点的数量 - 1。 |
要使用这些属性,请在自定义组件中添加定义名称的属性。例如"property color pointColor"
和"property real pointValueX"
。
selectedColor : color |
选定点的颜色。
信号文档
clicked(point point) |
当用户单击或点击图形中的point 时,将发出该信号。
注: 相应的处理程序是onClicked
。
colorChanged(color color) |
当线条颜色变为color 时,将发出该信号。
注: 相应的处理程序是onColorChanged
。
doubleClicked(point point) |
当用户双击或双击图形中的数据point 时,将发出该信号。point 是第一次按下的触发点。该信号总是发生在clicked 之后。
注: 相应的处理程序是onDoubleClicked
。
draggableChanged() |
当序列可通过鼠标/触摸拖动或固定时,将发出该信号。
注: 相应的处理程序是onDraggableChanged
。
pointMarkerChanged() |
当点发生变化时会发出该信号。
注: 相应的处理程序是onPointMarkerChanged
。
pointReplaced(int index) |
当一个点被替换到index 指定的位置时,将发出该信号。
注: 相应的处理程序是onPointReplaced
。
该信号在添加点列表时发出。新添加点的索引介于start 和end 之间。
注: 相应的处理程序是onPointsAdded
。
此信号在 Qt 6.9 中引入。
pointsReplaced() |
当所有点都被替换时,将发出该信号。
注: 相应的处理程序是onPointsReplaced
。
pressed(point point) |
当用户按下图形中的数据point 并按住鼠标按钮或手势时,将发出该信号。
注: 相应的处理程序是onPressed
。
released(point point) |
当用户在数据point 上释放先前按下的鼠标按钮或手势时,将发出该信号。
注: 相应的处理程序是onReleased
。
selectedColorChanged(color color) |
当所选系列的颜色变为color 时,将发出此信号。
注: 相应的处理程序是onSelectedColorChanged
。
selectedPointsChanged() |
当所选点的集合发生变化时,将发出该信号。
注: 相应的处理程序是onSelectedPointsChanged
。
方法文档
将坐标为points 的点添加到系列中。
注: 这比逐个添加数据点要快得多。当点添加完毕后,会发出pointsAdded 。
append(point point) |
将坐标为point 的点添加到序列中。
clear() |
删除系列中的所有点。
deselectAllPoints() |
deselectPoint(int index) |
将坐标为point 的点插入index 所指定的序列位置。如果索引为 0 或小于 0,该点将被添加到点列表中。如果索引等于或大于系列中的点数,则该点将被添加到点列表中。
如果index 上的点在所选点中,则返回 true,否则返回 false。
注: 如果指定了选定颜色,则使用选定颜色绘制选定点。
另请参阅 selectedPoints,setPointSelected() 和selectedColor 。
remove(int index) |
从序列中删除index 指定位置上的点。
remove(point point) |
从序列中删除坐标为point 的点。如果点不存在,则不做任何操作。
用以下指定的点替换当前点points
注: 这比逐个替换数据点,或先清除所有数据,然后再添加新数据要快得多。当点被替换后,会弹出pointsReplaced 。
将坐标为oldX 和oldY 的点替换为坐标为newX 和newY 的点。如果旧点不存在,则不做任何操作。
selectAllPoints() |
selectPoint(int index) |
根据selected 的指定,将index 上的点标记为选中或取消选中。
注: 如果指定了选定颜色,则使用选定颜色绘制选定点。发射QXYSeries::selectedPointsChanged
另请参阅 isPointSelected(),selectAllPoints() 和selectedColor 。
© 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.