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 }
(since 6.11) enum class StrokeStyle { SolidLine, DashLine }

Properties

Public Functions

Qt::PenCapStyle capStyle() const
qreal dashOffset() const
QVector<qreal> dashPattern() const
QPointF dataPointCoordinatesAt(qreal x, qreal y)
Qt::PenJoinStyle joinStyle() const
QLineSeries::LineStyle lineStyle() const
void setCapStyle(Qt::PenCapStyle newCapStyle)
void setDashOffset(qreal newDashOffset)
void setDashPattern(const QVector<qreal> &array)
void setJoinStyle(Qt::PenJoinStyle newJoinStyle)
void setLineStyle(QLineSeries::LineStyle newLineStyle)
void setStrokeStyle(QLineSeries::StrokeStyle newStrokeStyle)
void setWidth(qreal newWidth)
QLineSeries::StrokeStyle strokeStyle() const
qreal width() const

Reimplemented Public Functions

virtual QAbstractSeries::SeriesType type() const override

Signals

void capStyleChanged()
void dashOffsetChanged(qreal)
void dashPatternChanged(QVector<qreal>)
void joinStyleChanged(Qt::PenJoinStyle)
void lineStyleChanged(QLineSeries::LineStyle)
void strokeStyleChanged(QLineSeries::StrokeStyle)
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.

[since 6.11] enum class QLineSeries::StrokeStyle

Represents the stroke style of the series. The default value is StrokeStyle.SolidLine.

ConstantValueDescription
QLineSeries::StrokeStyle::SolidLineQt::SolidLineA plain line.
QLineSeries::StrokeStyle::DashLineQt::DashLineDashes separated by a few pixels.

This enum was introduced in Qt 6.11.

Property Documentation

capStyle : Qt::PenCapStyle

This property holds the cap style used for line endings.

The default value is Qt.SquareCap.

Access functions:

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

Notifier signal:

void capStyleChanged()

[since 6.11] dashOffset : qreal

This property holds the dash offset when strokeStyle is set to LineSeries.DashLine.

This property was introduced in Qt 6.11.

Access functions:

qreal dashOffset() const
void setDashOffset(qreal newDashOffset)

Notifier signal:

void dashOffsetChanged(qreal)

[since 6.11] dashPattern : QVector<qreal>

This property holds the dash pattern when strokeStyle is set to LineSeries.DashLine.

This property was introduced in Qt 6.11.

Access functions:

QVector<qreal> dashPattern() const
void setDashPattern(const QVector<qreal> &array)

Notifier signal:

void dashPatternChanged(QVector<qreal>)

[since 6.11] joinStyle : Qt::PenJoinStyle

This property holds the join style used for line endings.

The default value is Qt.BevelJoin.

This property was introduced in Qt 6.11.

Access functions:

Qt::PenJoinStyle joinStyle() const
void setJoinStyle(Qt::PenJoinStyle newJoinStyle)

Notifier signal:

void joinStyleChanged(Qt::PenJoinStyle)

[since 6.11] lineStyle : QLineSeries::LineStyle

This property holds the line style used for lines rendering.

The default value is LineSeries.Straight.

This property was introduced in Qt 6.11.

Access functions:

QLineSeries::LineStyle lineStyle() const
void setLineStyle(QLineSeries::LineStyle newLineStyle)

Notifier signal:

void lineStyleChanged(QLineSeries::LineStyle)

[since 6.11] strokeStyle : QLineSeries::StrokeStyle

This property holds the stroke style of the series.

The default value is LineSeries.SolidLine.

This property was introduced in Qt 6.11.

Access functions:

QLineSeries::StrokeStyle strokeStyle() const
void setStrokeStyle(QLineSeries::StrokeStyle newStrokeStyle)

Notifier signal:

void strokeStyleChanged(QLineSeries::StrokeStyle)

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.