XYSeries QML Type

直线、样条曲线和散点数列的基本类型。更多

Import Statement: import QtCharts 2.9
In C++: QXYSeries
Inherits:

AbstractSeries

Inherited By:

LineSeries, ScatterSeries, and SplineSeries

属性

信号

方法

详细说明

XYSeries 支持在图表上显示最佳拟合线。最佳拟合线是一条穿过图表的线,用于表达点之间的关系。

属性文档

axisAngular : AbstractAxis

用于系列的角轴,围绕极坐标图表视图绘制。

另请参阅 axisX


axisRadial : AbstractAxis

用于序列的径向轴,在极坐标图表视图内部绘制。

另请参阅 axisY


axisX : AbstractAxis

用于系列的 X 轴。如果不定义 axisX 和axisXTop ,则会为系列创建一个值轴。

另请参阅 axisXTopValueAxis


axisXTop : AbstractAxis

用于系列的 X 轴,绘制在图表视图的顶部。

注意: 只能提供axisX 或 axisXTop,不能同时提供。

另请参阅 axisX


axisY : AbstractAxis

用于系列的 Y 轴。如果不定义 axisY 和axisYRight ,则会为系列创建一个值轴。

另请参阅 axisYRightValueAxis


axisYRight : AbstractAxis

用于系列的 Y 轴,在图表视图中向右绘制。

注意: 只能提供axisY 或 axisYRight,不能同时提供。

另请参阅 axisY


bestFitLineColor : color

最佳拟合线的颜色。

另请参阅 bestFitLineVisible


bestFitLineVisible : bool

最佳拟合线的可见性。该属性默认为false


color : color

系列的颜色。如果是LineSeriesSplineSeries ,则为线条(笔)颜色;如果是ScatterSeriesAreaSeries ,则为填充(画笔)颜色。


pointLabelsClipping : bool

数据点标签的剪切。该属性默认为true 。启用剪切后,绘图区域边缘的标签将被剪切。

另请参阅 pointLabelsVisible


pointLabelsColor : font

数据点标签的颜色。默认情况下,颜色是标签主题中定义的笔刷颜色。

另请参阅 pointLabelsFormat


pointLabelsFont : font

数据点标签使用的字体。

另请参阅 pointLabelsFormat


pointLabelsFormat : string

用于显示数据点标签的格式。

另请参阅 pointLabelsVisible,pointLabelsFont, 和pointLabelsColor


pointLabelsVisible : bool

数据点标签的可见性。该属性默认为false

另请参见 pointLabelsFormatpointLabelsClipping


pointsVisible : bool

数据点是否可见并应绘制。


selectedColor : color

选定点的颜色。这是标记为选中点的填充(画笔)颜色。如果未指定,默认值为QXYSeries::color

另请参阅 color


信号文档

clicked(point point)

当用户通过点击图表中的点point 触发鼠标事件时,将发出该信号。例如

LineSeries {
    XYPoint { x: 0; y: 0 }
    XYPoint { x: 1.1; y: 2.1 }
    onClicked: console.log("onClicked: " + point.x + ", " + point.y);
}

相应的信号处理程序是onClicked()

注: 相应的处理程序是onClicked

另请参阅 pressed(),released() 和doubleClicked()。


doubleClicked(point point)

当用户双击图表中的数据点point 时,将发出该信号。point 是触发第一次按压的点。例如

LineSeries {
    XYPoint { x: 0; y: 0 }
    XYPoint { x: 1.1; y: 2.1 }
    onDoubleClicked: console.log("onDoubleClicked: " + point.x + ", " + point.y);
}

相应的信号处理程序是onDoubleClicked()

注: 相应的处理程序是onDoubleClicked

另请参阅 pressed()、released() 和clicked()。


hovered(point point, bool state)

当鼠标悬停在图表中的点point 上时,将发出该信号。当鼠标移至该点时,state 会变成true ,当鼠标再次移开时,会变成false

相应的信号处理程序是onHovered()

注: 相应的处理程序是onHovered


pointAdded(int index)

index 指定的位置添加一个点时,会发出该信号。

相应的信号处理程序是onPointAdded()

注: 相应的处理程序是onPointAdded


pointRemoved(int index)

当从index 指定的位置移除一个点时,会发出该信号。

相应的信号处理程序是onPointRemoved()

注: 相应的处理程序是onPointRemoved


pointReplaced(int index)

index 指定的位置上的点被替换时,将发出该信号。

相应的信号处理程序是onPointReplaced()

注: 相应的处理程序是onPointReplaced


pointsRemoved(int index, int count)

index 指定的位置开始移除count 指定数量的点时,发出该信号。

相应的信号处理程序是onPointRemoved()

注: 相应的处理程序是onPointsRemoved


pointsReplaced()

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

相应的信号处理程序是onPointsReplaced()

注: 相应的处理程序是onPointsReplaced


pressed(point point)

当用户按下图表中的数据点point 并按住鼠标键时,将发出该信号。例如

LineSeries {
    XYPoint { x: 0; y: 0 }
    XYPoint { x: 1.1; y: 2.1 }
    onPressed: console.log("onPressed: " + point.x + ", " + point.y);
}

相应的信号处理程序是onPressed()

注: 相应的处理程序是onPressed

另请参阅 clicked(),released() 和doubleClicked()。


released(point point)

当用户在point 指定的数据点上松开鼠标时,将发出该信号。例如

LineSeries {
    XYPoint { x: 0; y: 0 }
    XYPoint { x: 1.1; y: 2.1 }
    onReleased: console.log("onReleased: " + point.x + ", " + point.y);
}

相应的信号处理程序是onReleased()

注: 相应的处理程序是onReleased

另请参阅 pressed(),clicked() 和doubleClicked()。


方法文档

append(real x, real y)

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


QPointF at(int index)

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


insert(int index, real x, real y)

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


remove(int index)

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


remove(real x, real y)

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


removePoints(int index, int count)

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


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

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


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