本页内容

SplineSeries QML Type

以样条图的形式呈现数据。更多内容...

Import Statement: import QtCharts 2.12
In C++: QSplineSeries
Inherits:

XYSeries

Status: Deprecated

此类型已弃用。我们强烈建议不要在新代码中使用它。

属性

详细说明

样条系列存储了QPainterPath 绘制样条曲线所需的数据点和线段控制点。当数据发生变化时,控制点会自动计算。该算法通过计算这些点,确保能够绘制出标准的样条曲线。

一条曲线时而上升、时而下降、时而再次上升的样条图

以下 QML 代码演示了如何创建一个简单的样条图:

ChartView {
    title: "Spline Chart"
    anchors.fill: parent
    antialiasing: true

    SplineSeries {
        name: "Spline"
        XYPoint { x: 0; y: 0.0 }
        XYPoint { x: 1.1; y: 3.2 }
        XYPoint { x: 1.9; y: 2.4 }
        XYPoint { x: 2.1; y: 2.1 }
        XYPoint { x: 2.9; y: 2.6 }
        XYPoint { x: 3.4; y: 2.3 }
        XYPoint { x: 4.1; y: 3.1 }
    }
}

属性文档

capStyle : Qt::PenCapStyle

控制线的端点样式。可设置为以下其中一种:Qt.FlatCap 、Qt.SquareCap 或Qt.RoundCap 。默认情况下,端点样式为 Qt.SquareCap。

另请参阅 Qt::PenCapStyle 。

count : int

该序列中的数据点数量。

style : Qt::PenStyle

控制线条的样式。可设置为以下选项之一:Qt.NoPen 、Qt.SolidLine 、Qt.DashLine 、Qt.DotLine 、Qt.DashDotLine 或Qt.DashDotDotLine 。QML API 不支持使用Qt.CustomDashLine 。默认样式为 Qt.SolidLine。

另请参阅 Qt::PenStyle 。

width : real

线的宽度。默认情况下,宽度为 2.0。

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