XYSeries QML Type

所有 x 和 y 系列类型的父类型。更多

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

AbstractSeries

Inherited By:

LineSeries, ScatterSeries, and SplineSeries

属性

信号

方法

详细说明

在 XYSeries 中,数据点被定义为一个点类型列表,定义了 X 和 Y 位置。

属性文档

color : color

系列的主颜色。对于LineSeries ,这意味着线的颜色;对于ScatterSeries ,这意味着点的颜色。


count : int [read-only]

返回系列中数据点的数量。


pointDelegate : Component

用作数据点标记的自定义 QML 组件。

该组件的动态属性如下

类型名称描述
bool选中点当点被选中时,该值为 true。
颜色点颜色系列的颜色。该值来自GraphsThemeXYSeries::color (如果XYSeries 重载了颜色)。
颜色点边框颜色系列的边框颜色。该值来自GraphsTheme
颜色点选定颜色系列的选定颜色。该值来自GraphsTheme ,如果XYSeries 覆盖了颜色,则来自XYSeries::selectedColor
真实点边框宽度系列的边框宽度。该值来自GraphsTheme
pointValueXXYPoint::x 在此位置的值。
pointValueYXYPoint::y 在此位置的值。
intpointIndex点的索引,从 0 到点的数量 - 1。

要使用这些属性,请在自定义组件中添加定义名称的属性。例如"property color pointColor""property real pointValueX"


selectedColor : color

选定点的颜色。


selectedPoints : list<int> [read-only]

当前选中点的索引。


信号文档

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


[since 6.9] pointsAdded(int start, int end)

该信号在添加点列表时发出。新添加点的索引介于startend 之间。

注: 相应的处理程序是onPointsAdded

此信号在 Qt 6.9 中引入。


pointsReplaced()

当所有点都被替换时,将发出该信号。

注: 相应的处理程序是onPointsReplaced


pressed(point point)

当用户按下图形中的数据point 并按住鼠标按钮或手势时,将发出该信号。

注: 相应的处理程序是onPressed


released(point point)

当用户在数据point 上释放先前按下的鼠标按钮或手势时,将发出该信号。

注: 相应的处理程序是onReleased


selectedColorChanged(color color)

当所选系列的颜色变为color 时,将发出此信号。

注: 相应的处理程序是onSelectedColorChanged


selectedPointsChanged()

当所选点的集合发生变化时,将发出该信号。

注: 相应的处理程序是onSelectedPointsChanged


方法文档

append(list<point> points)

将坐标为points 的点添加到系列中。

注: 这比逐个添加数据点要快得多。当点添加完毕后,会发出pointsAdded


append(point point)

将坐标为point 的点添加到序列中。


append(real x, real y)

将坐标为xy 的点添加到序列中。


point at(int index)

返回index 指定位置上的点。如果索引无效,则返回 (0, 0)。


clear()

删除系列中的所有点。


deselectAllPoints()

取消选择系列中的所有点。

另请参见 setPointSelected().


deselectPoint(int index)

取消选择index 上的点。

另请参阅 setPointSelected() 。


deselectPoints(list<int> indexes)

indexes 列表中传递的多个点标记为取消选择。

另请参阅 setPointSelected() 。


int find(point point)

查找并返回point 定义的第一个匹配点的索引。如果未找到点,则返回-1。


insert(int index, point point)

将坐标为point 的点插入index 所指定的序列位置。如果索引为 0 或小于 0,该点将被添加到点列表中。如果索引等于或大于系列中的点数,则该点将被添加到点列表中。


bool isPointSelected(int index)

如果index 上的点在所选点中,则返回 true,否则返回 false。

注: 如果指定了选定颜色,则使用选定颜色绘制选定点。

另请参阅 selectedPoints,setPointSelected() 和selectedColor


remove(int index)

从序列中删除index 指定位置上的点。


remove(point point)

从序列中删除坐标为point 的点。如果点不存在,则不做任何操作。


remove(real x, real y)

将坐标为xy 的点从系列中删除。如果该点不存在,则不做任何操作。


removeMultiple(int index, int count)

index 指定的位置开始,从系列中删除count 指定数量的点。


replace(list<point> points)

用以下指定的点替换当前点points

注: 这比逐个替换数据点,或先清除所有数据,然后再添加新数据要快得多。当点被替换后,会弹出pointsReplaced


replace(int index, point newPoint)

用坐标为newPoint 的点替换index 指定位置上的点。


replace(point oldPoint, point newPoint)

用坐标为newPoint 的点替换坐标为oldPoint 的点。如果旧点不存在,则不做任何操作。


replace(int index, real newX, real newY)

用坐标为newXnewY 的点替换index 指定位置上的点。


replace(real oldX, real oldY, real newX, real newY)

将坐标为oldXoldY 的点替换为坐标为newXnewY 的点。如果旧点不存在,则不做任何操作。


selectAllPoints()

将系列中的所有点标记为选中点、

另请参阅 setPointSelected().


selectPoint(int index)

index 上的点标记为选中点。

另请参见 setPointSelected().


selectPoints(list<int> indexes)

indexes 列表中传递的多个点标记为选中点。

另请参阅 setPointSelected().


setPointSelected(int index, bool selected)

根据selected 的指定,将index 上的点标记为选中或取消选中。

注: 如果指定了选定颜色,则使用选定颜色绘制选定点。发射QXYSeries::selectedPointsChanged

另请参阅 isPointSelected(),selectAllPoints() 和selectedColor


bool take(point point)

从序列中选取一个点(由point 指定)。如果操作成功,则返回true


toggleSelection(list<int> indexes)

将给定indexes 处点的选择状态更改为相反状态。

另请参阅 setPointSelected() 。


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