本页内容

LineSeries QML Type

以折线图形式展示数据。更多...

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

XYSeries

Status: Deprecated

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

属性

详细说明

折线图用于将信息以一系列由直线连接的数据点形式呈现。

以下 QML 示例演示了如何创建一个简单的折线图:

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

    LineSeries {
        name: "Line"
        XYPoint { x: 0; y: 0 }
        XYPoint { x: 1.1; y: 2.1 }
        XYPoint { x: 1.9; y: 3.3 }
        XYPoint { x: 2.1; y: 2.1 }
        XYPoint { x: 2.9; y: 4.9 }
        XYPoint { x: 3.4; y: 3.0 }
        XYPoint { x: 4.1; y: 3.3 }
    }
}

一条上升线达到峰值后趋于平稳的折线图


属性文档

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.