6.0.0-rc4Source

QAreaSeries Class

The QAreaSeries class fills the area between two lines, or below one. More…

Header#include <QAreaSeries>
CMaketarget_link_libraries(app PRIVATE Nt::Charts)
ModuleNt Charts C++ Classes
InheritsQAbstractSeries

List of all members, including inherited members

Public Functions

QAreaSeries(QObject *parent = nullptr)
QAreaSeries(QLineSeries *upperSeries, QLineSeries *lowerSeries = nullptr)
~QAreaSeries()
voidsetUpperSeries(QLineSeries *series)
QLineSeries *upperSeries() const
voidsetLowerSeries(QLineSeries *series)
QLineSeries *lowerSeries() const
voidsetPen(const QPen &pen)
QPenpen() const
voidsetBrush(const QBrush &brush)
QBrushbrush() const
voidsetColor(const QColor &color)
QColorcolor() const
voidsetBorderColor(const QColor &color)
QColorborderColor() const
voidsetPointsVisible(bool visible = true)
boolpointsVisible() const
voidsetPointLabelsFormat(const QString &format)
QStringpointLabelsFormat() const
voidsetPointLabelsVisible(bool visible = true)
boolpointLabelsVisible() const

Reimplemented Public Functions

Signals

voidclicked(const QPointF &point)
voidhovered(const QPointF &point, bool state)
voidpressed(const QPointF &point)
voidreleased(const QPointF &point)
voiddoubleClicked(const QPointF &point)
voidcolorChanged(QColor color)
voidborderColorChanged(QColor color)
voidpointLabelsFormatChanged(const QString &format)
voidpointLabelsVisibilityChanged(bool visible)

Detailed Description

Two area series stacked on each other

The area is bounded by the points of an upper QLineSeries and of a lower one. Without a lower series it reaches down to zero, or to the edge of the plot area if zero is not shown.

auto *upper = new QLineSeries;
for (int t = 0; t < 24; ++t)
    upper->append(t, 2.0 + std::sin(t / 4.0));

auto *series = new QAreaSeries(upper);
series->setName("Memory");

auto *chart = new QChart;
chart->addSeries(series);
chart->createDefaultAxes();

The line series are not added to the chart themselves. The area series watches them: changing their points redraws it. A line series without a parent becomes a child of the area series.

See also QLineSeries.

Differences from Qt

There is no best-fit line, and the point labels are drawn for the upper series only.

Member Function Documentation

[explicit] QAreaSeries::QAreaSeries(QObject *parent = nullptr)

Constructs an area series without line series, with the given parent.

[explicit] QAreaSeries::QAreaSeries(QLineSeries *upperSeries, QLineSeries *lowerSeries = nullptr)

Constructs an area series between upperSeries and lowerSeries, which may be nullptr.

[override] QAreaSeries::~QAreaSeries()

Destroys the series.

QColor QAreaSeries::borderColor() const

Returns the color of the border.

[signal] void QAreaSeries::borderColorChanged(QColor color)

This signal is emitted when the border color changes to color.

QBrush QAreaSeries::brush() const

Returns the brush that fills the area.

[signal] void QAreaSeries::clicked(const QPointF &point)

This signal is emitted when the user clicks the area at point, in the coordinates of the series.

QColor QAreaSeries::color() const

Returns the fill color.

[signal] void QAreaSeries::colorChanged(QColor color)

This signal is emitted when the fill color changes to color.

[signal] void QAreaSeries::doubleClicked(const QPointF &point)

This signal is emitted when the user double-clicks the area at point.

[signal] void QAreaSeries::hovered(const QPointF &point, bool state)

This signal is emitted when the mouse enters or leaves the area at point; state is true when it enters.

QLineSeries * QAreaSeries::lowerSeries() const

Returns the series that bounds the area from below, or nullptr.

QPen QAreaSeries::pen() const

Returns the pen of the border of the area.

QString QAreaSeries::pointLabelsFormat() const

Returns the format of the point labels.

[signal] void QAreaSeries::pointLabelsFormatChanged(const QString &format)

This signal is emitted when the format of the point labels changes to format.

[signal] void QAreaSeries::pointLabelsVisibilityChanged(bool visible)

This signal is emitted when the point labels are shown or hidden; visible is the new state.

bool QAreaSeries::pointLabelsVisible() const

Returns true if the point labels are drawn; otherwise returns false.

bool QAreaSeries::pointsVisible() const

Returns true if markers are drawn at the points; otherwise returns false.

[signal] void QAreaSeries::pressed(const QPointF &point)

This signal is emitted when the user presses a mouse button on the area at point.

[signal] void QAreaSeries::released(const QPointF &point)

This signal is emitted when the user releases a mouse button on the area at point.

void QAreaSeries::setBorderColor(const QColor &color)

Sets the color of the border to color.

void QAreaSeries::setBrush(const QBrush &brush)

Sets the brush that fills the area to brush.

void QAreaSeries::setColor(const QColor &color)

Sets the fill color to color.

void QAreaSeries::setLowerSeries(QLineSeries *series)

Sets the series that bounds the area from below to series, or to nullptr for zero.

void QAreaSeries::setPen(const QPen &pen)

Sets the pen of the border of the area to pen.

void QAreaSeries::setPointLabelsFormat(const QString &format)

Sets the format of the point labels to format, as QXYSeries::setPointLabelsFormat() does.

void QAreaSeries::setPointLabelsVisible(bool visible = true)

Draws a label above each point of the upper series if visible is true.

void QAreaSeries::setPointsVisible(bool visible = true)

Draws a marker at each point of the bounding series if visible is true.

void QAreaSeries::setUpperSeries(QLineSeries *series)

Sets the series that bounds the area from above to series.

[override] QAbstractSeries::SeriesType QAreaSeries::type() const

Reimplements QAbstractSeries::type().

Returns QAbstractSeries::SeriesTypeArea.

QLineSeries * QAreaSeries::upperSeries() const

Returns the series that bounds the area from above.