QLineSeries Class

The QLineSeries class presents data in line graphs. More...

Header: #include <QLineSeries>
CMake: find_package(Qt6 REQUIRED COMPONENTS Graphs)
target_link_libraries(mytarget PRIVATE Qt6::Graphs)
qmake: QT += graphs
In QML: LineSeries
Inherits: QXYSeries

Public Types

(since 6.11) enum class LineStyle { Straight, StepLeft, StepRight, StepCenter }

Properties

Public Functions

Qt::PenCapStyle capStyle() const
QPointF dataPointCoordinatesAt(qreal x, qreal y)
Qt::PenJoinStyle joinStyle() const
QLineSeries::LineStyle lineStyle() const
void setCapStyle(Qt::PenCapStyle newCapStyle)
void setJoinStyle(Qt::PenJoinStyle newJoinStyle)
void setLineStyle(QLineSeries::LineStyle newLineStyle)
void setWidth(qreal newWidth)
qreal width() const

Reimplemented Public Functions

virtual QAbstractSeries::SeriesType type() const override

Signals

void capStyleChanged()
void joinStyleChanged(Qt::PenJoinStyle)
void lineStyleChanged(QLineSeries::LineStyle)
void widthChanged()

Reimplemented Protected Functions

virtual void componentComplete() override

Detailed Description

A line graph is used to show information as a series of data points connected by straight lines or steps.

Member Type Documentation

[since 6.11] enum class QLineSeries::LineStyle

Represents the line style of the series.

ConstantValueDescription
QLineSeries::LineStyle::Straight0The points are connected by a straight line.
QLineSeries::LineStyle::StepLeft1The points are connected by steps where each step height is the value from the left.
QLineSeries::LineStyle::StepRight2The points are connected by steps where each step height is the value from the right.
QLineSeries::LineStyle::StepCenter3The points are connected by steps which change in the middle between two values.

This enum was introduced in Qt 6.11.

Property Documentation

capStyle : Qt::PenCapStyle

This property holds the cap style used for line endings.

This property holds the pen cap style used for rending line ends in the series.

Access functions:

Qt::PenCapStyle capStyle() const
void setCapStyle(Qt::PenCapStyle newCapStyle)

Notifier signal:

void capStyleChanged()

width : qreal

This property holds the width of the line in the series.

This property holds the pen width used to draw the series line.

Access functions:

qreal width() const
void setWidth(qreal newWidth)

Notifier signal:

void widthChanged()

Member Function Documentation

[invokable] QPointF QLineSeries::dataPointCoordinatesAt(qreal x, qreal y)

Returns x and y rendercoordinates converted into data point coordinates.

Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.

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