- Qt 6.12
- Qt Graphs
- C++ Classes
- QtGraphs
- QLineSeries
- Qt Graphs | Commercial or GPLv3

# 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

- List of all members, including inherited members
- QLineSeries is part of Qt Graphs C++ Classes for 2D.

## Public Types

`(since 6.11)` enum class | LineStyle { Straight, StepLeft, StepRight, StepCenter }
`(since 6.11)` enum class | StrokeStyle { SolidLine, DashLine }

## Properties

capStyle : Qt::PenCapStyle `(since 6.11)` dashOffset : qreal `(since 6.11)` dashPattern : QList<qreal> `(since 6.11)` joinStyle : Qt::PenJoinStyle | `(since 6.11)` lineStyle : QLineSeries::LineStyle `(since 6.11)` strokeStyle : QLineSeries::StrokeStyle width : qreal

## Public Functions

Qt::PenCapStyle | capStyle() const
qreal | dashOffset() const
QList<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 QList<qreal> &pattern)
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

## Signals

void | capStyleChanged()
void | dashOffsetChanged(qreal newDashOffset)
void | dashPatternChanged(const QList<qreal> &newDashPattern)
void | joinStyleChanged(Qt::PenJoinStyle newJoinStyle)
void | lineStyleChanged(QLineSeries::LineStyle newLineStyle)
void | strokeStyleChanged(QLineSeries::StrokeStyle newStrokeStyle)
void | widthChanged()

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

Constant | Value | Description
--- | --- | ---
`QLineSeries::LineStyle::Straight` | `0` | The points are connected by a straight line.
`QLineSeries::LineStyle::StepLeft` | `1` | The points are connected by steps where each step height is the value from the left.
`QLineSeries::LineStyle::StepRight` | `2` | The points are connected by steps where each step height is the value from the right.
`QLineSeries::LineStyle::StepCenter` | `3` | The 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.

Constant | Value | Description
--- | --- | ---
`QLineSeries::StrokeStyle::SolidLine` | `Qt::SolidLine` | A plain line.
`QLineSeries::StrokeStyle::DashLine` | `Qt::DashLine` | Dashes 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 enumeration was introduced in Qt 6.11.

Access functions:

qreal | dashOffset() const
void | setDashOffset(qreal newDashOffset)

Notifier signal:

void | dashOffsetChanged(qreal newDashOffset)

### `[since 6.11]` dashPattern : QList<qreal>

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

This enumeration was introduced in Qt 6.11.

Access functions:

QList<qreal> | dashPattern() const
void | setDashPattern(const QList<qreal> &pattern)

Notifier signal:

void | dashPatternChanged(const QList<qreal> &newDashPattern)

### `[since 6.11]` joinStyle : Qt::PenJoinStyle

This property holds the join style used for line endings.

The default value is Qt.BevelJoin.

This enumeration was introduced in Qt 6.11.

Access functions:

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

Notifier signal:

void | joinStyleChanged(Qt::PenJoinStyle newJoinStyle)

### `[since 6.11]` lineStyle : QLineSeries::LineStyle

This property holds the line style used for lines rendering.

The default value is LineSeries.Straight.

This enumeration was introduced in Qt 6.11.

Access functions:

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

Notifier signal:

void | lineStyleChanged(QLineSeries::LineStyle newLineStyle)

### `[since 6.11]` strokeStyle : QLineSeries::StrokeStyle

This property holds the stroke style of the series.

The default value is LineSeries.SolidLine.

This enumeration was introduced in Qt 6.11.

Access functions:

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

Notifier signal:

void | strokeStyleChanged(QLineSeries::StrokeStyle newStrokeStyle)

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