- Qt 6.8
- Qt Graphs
- C++ Classes
- QtGraphs
- QAbstractSeries
- Qt Graphs | Commercial or GPLv3

# QAbstractSeries Class

The QAbstractSeries class is a base class for all Qt Graphs for 2D series. More...

Header: | #include <QAbstractSeries>
CMake: | find_package(Qt6 REQUIRED COMPONENTS Graphs) target_link_libraries(mytarget PRIVATE Qt6::Graphs)
qmake: | QT += graphs
Instantiated By: | AbstractSeries
Inherits: | QObject and QQmlParserStatus
Inherited By: | QAreaSeries, QBarSeries, QPieSeries, and QXYSeries

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

## Public Types

enum class | SeriesType { Line, Bar, Scatter, Pie, Spline, Area }

## Properties

hoverable : bool legendData : const QList<QLegendData> name : QString opacity : qreal selectable : bool | theme : QSeriesTheme* type : const SeriesType valuesMultiplier : qreal visible : bool

## Public Functions

virtual | ~QAbstractSeries() override
bool | attachAxis(QAbstractAxis *axis)
QList<QAbstractAxis *> | attachedAxes()
bool | detachAxis(QAbstractAxis *axis)
QGraphsView * | graph() const
void | hide()
bool | hoverable() const
bool | isVisible() const
const QList<QLegendData> | legendData() const
QString | name() const
qreal | opacity() const
bool | selectable() const
QQmlListProperty<QObject> | seriesChildren()
void | setHoverable(bool newHoverable)
void | setName(const QString &name)
void | setOpacity(qreal opacity)
void | setSelectable(bool selectable)
void | setTheme(QSeriesTheme *newTheme)
void | setValuesMultiplier(qreal valuesMultiplier)
void | setVisible(bool visible = true)
void | show()
QSeriesTheme * | theme() const
virtual QAbstractSeries::SeriesType | type() const = 0
qreal | valuesMultiplier() const

## Signals

void | hover(QString seriesName, QPointF position, QPointF value)
void | hoverEnter(QString seriesName, QPointF position, QPointF value)
void | hoverExit(QString seriesName, QPointF position)
void | hoverableChanged()
void | legendDataChanged()
void | nameChanged()
void | opacityChanged()
void | selectableChanged()
void | themeChanged()
void | valuesMultiplierChanged()
void | visibleChanged()

## Detailed Description

Usually, the series type specific inherited classes are used instead of the base class.

See also QLineSeries, QSplineSeries, QScatterSeries, QBarSeries, and QXYSeries.

## Member Type Documentation

### enum class QAbstractSeries::SeriesType

This enum describes the type of the series.

Constant | Value | Description
--- | --- | ---
`QAbstractSeries::SeriesType::Line` | `0` | A line graph.
`QAbstractSeries::SeriesType::Bar` | `2` | A bar graph.
`QAbstractSeries::SeriesType::Scatter` | `4` | A scatter graph.
`QAbstractSeries::SeriesType::Pie` | `3` | A pie graph.
`QAbstractSeries::SeriesType::Spline` | `5` | A spline graph.
`QAbstractSeries::SeriesType::Area` | `1` | An area graph.

## Property Documentation

### hoverable : bool

Controls if the series is hoverable.

Controls if the series can be hovered with mouse/touch. By default, hoverable is set to `false`.

Access functions:

bool | hoverable() const
void | setHoverable(bool newHoverable)

Notifier signal:

void | hoverableChanged()

### `[read-only]` legendData : const QList<QLegendData>

Contains information needed to create a legend marker for a data set in a graph.

Access functions:

const QList<QLegendData> | legendData() const

Notifier signal:

void | legendDataChanged()

See also QLegendData.

### name : QString

This property holds the name of the series.

The name is displayed in the legend for the series and it supports HTML formatting.

Access functions:

QString | name() const
void | setName(const QString &name)

Notifier signal:

void | nameChanged()

### opacity : qreal

This property holds the opacity of the series.

By default, the opacity is 1.0. The valid values range from 0.0 (transparent) to 1.0 (opaque).

Access functions:

qreal | opacity() const
void | setOpacity(qreal opacity)

Notifier signal:

void | opacityChanged()

### selectable : bool

Controls if the series is selectable.

Controls if the series can be selected with mouse/touch. By default, selectable is set to `false`.

Access functions:

bool | selectable() const
void | setSelectable(bool selectable)

Notifier signal:

void | selectableChanged()

### theme : QSeriesTheme*

This property holds the theme of the series.

The theme used for this series.

Access functions:

QSeriesTheme * | theme() const
void | setTheme(QSeriesTheme *newTheme)

Notifier signal:

void | themeChanged()

### `[read-only]` type : const SeriesType

This property holds the type of the series.

Access functions:

virtual QAbstractSeries::SeriesType | type() const = 0

### valuesMultiplier : qreal

Controls the series values effective visible value.

This variable can be used for animating the series values so they scale from 0 to actual value size. By default, the valuesMultiplier is 1.0. The valid values range from 0.0 (height 0) to 1.0 (full value).

Access functions:

qreal | valuesMultiplier() const
void | setValuesMultiplier(qreal valuesMultiplier)

Notifier signal:

void | valuesMultiplierChanged()

### visible : bool

Visibility of the series.

The visibility used for this series. By default, visible is set to `true`.

Access functions:

bool | isVisible() const
void | setVisible(bool visible = true)

Notifier signal:

void | visibleChanged()

## Member Function Documentation

### `[override virtual noexcept]` QAbstractSeries::~QAbstractSeries()

Virtual destructor for the graph series.

### bool QAbstractSeries::attachAxis(QAbstractAxis *axis)

Attaches the axis specified by axis to the series.

Returns `true` if the axis was attached successfully, `false` otherwise.

Note: If multiple axes of the same orientation are attached to the same series, they will have the same minimum and maximum values.

### QList<QAbstractAxis *> QAbstractSeries::attachedAxes()

Returns the list of axes attached to the series. Usually, an x-axis and a y-axis are attached to a series, except for QPieSeries, which does not have any axes attached.

See also attachAxis() and detachAxis().

### bool QAbstractSeries::detachAxis(QAbstractAxis *axis)

Detaches the axis specified by axis from the series.

Returns `true` if the axis was detached successfully, `false` otherwise.

### QGraphsView *QAbstractSeries::graph() const

Returns the graph that the series belongs to.

Set automatically when the series is added to the graph, and unset when the series is removed from the graph.

### void QAbstractSeries::hide()

Sets the visibility of the series to `false`.

See also setVisible() and isVisible().

### `[signal]` void QAbstractSeries::hover(QString seriesName, QPointF position, QPointF value)

This signal is emitted when the series hovering changes. The name of the series is in seriesName, the mouse/touch position in position, and the series value in value.

Note: This signal is only emitted when hoverable is set to true.

### `[signal]` void QAbstractSeries::hoverEnter(QString seriesName, QPointF position, QPointF value)

This signal is emitted when the series hovering starts. The name of the series is in seriesName, the mouse/touch position in position, and the series value in value.

Note: This signal is only emitted when hoverable is set to true.

### `[signal]` void QAbstractSeries::hoverExit(QString seriesName, QPointF position)

This signal is emitted when the series hovering ends. The name of the series is in seriesName, and the mouse/touch position in position.

Note: This signal is only emitted when hoverable is set to true.

### `[signal]` void QAbstractSeries::hoverableChanged()

This signal is emitted when the series hoverable changes.

Note: Notifier signal for property hoverable.

### `[signal]` void QAbstractSeries::legendDataChanged()

This signal is emitted when legend data changes.

Note: Notifier signal for property legendData.

### `[signal]` void QAbstractSeries::nameChanged()

This signal is emitted when the series name changes.

Note: Notifier signal for property name.

### `[signal]` void QAbstractSeries::opacityChanged()

This signal is emitted when the opacity of the series changes.

Note: Notifier signal for property opacity.

### `[signal]` void QAbstractSeries::selectableChanged()

This signal is emitted when the series selectable changes.

Note: Notifier signal for property selectable.

### void QAbstractSeries::show()

Sets the visibility of the series to `true`.

See also setVisible() and isVisible().

### `[signal]` void QAbstractSeries::themeChanged()

This signal is emitted when the series theme changes.

Note: Notifier signal for property theme.

### `[signal]` void QAbstractSeries::valuesMultiplierChanged()

This signal is emitted when the valuesMultiplier of the series changes.

Note: Notifier signal for property valuesMultiplier.

### `[signal]` void QAbstractSeries::visibleChanged()

This signal is emitted when the series visibility changes.

Note: Notifier signal for property visible.