QAreaSeries Class | Qt Charts 5.7

Qt 5.7 | Qt Charts | C++ Classes | QAreaSeries

Qt 5.7.1 Reference Documentation

# QAreaSeries Class

The QAreaSeries class is used for making area charts. More...

Header: | #include <QAreaSeries>
Instantiated By: | AreaSeries
Inherits: | QAbstractSeries

- List of all members, including inherited members

## Properties

borderColor : QColor color : QColor lowerSeries : QLineSeries * const pointLabelsClipping : bool pointLabelsColor : QColor | pointLabelsFont : QFont pointLabelsFormat : QString pointLabelsVisible : bool upperSeries : QLineSeries * const

- 5 properties inherited from QAbstractSeries

## Public Functions

| QAreaSeries(QObject *parent = Q_NULLPTR)
| QAreaSeries(QLineSeries *upperSeries, QLineSeries *lowerSeries = Q_NULLPTR)
| ~QAreaSeries()
QColor | borderColor() const
QBrush | brush() const
QColor | color() const
QLineSeries * | lowerSeries() const
QPen | pen() const
bool | pointLabelsClipping() const
QColor | pointLabelsColor() const
QFont | pointLabelsFont() const
QString | pointLabelsFormat() const
bool | pointLabelsVisible() const
bool | pointsVisible() const
void | setBorderColor(const QColor &color)
void | setBrush(const QBrush &brush)
void | setColor(const QColor &color)
void | setLowerSeries(QLineSeries *series)
void | setPen(const QPen &pen)
void | setPointLabelsClipping(bool enabled = true)
void | setPointLabelsColor(const QColor &color)
void | setPointLabelsFont(const QFont &font)
void | setPointLabelsFormat(const QString &format)
void | setPointLabelsVisible(bool visible = true)
void | setPointsVisible(bool visible = true)
void | setUpperSeries(QLineSeries *series)
QLineSeries * | upperSeries() const

## Reimplemented Public Functions

virtual QAbstractSeries::SeriesType | type() const

- 15 public functions inherited from QAbstractSeries

## Signals

void | borderColorChanged(QColor color)
void | clicked(const QPointF &point)
void | colorChanged(QColor color)
void | doubleClicked(const QPointF &point)
void | hovered(const QPointF &point, bool state)
void | pointLabelsClippingChanged(bool clipping)
void | pointLabelsColorChanged(const QColor &color)
void | pointLabelsFontChanged(const QFont &font)
void | pointLabelsFormatChanged(const QString &format)
void | pointLabelsVisibilityChanged(bool visible)
void | pressed(const QPointF &point)
void | released(const QPointF &point)
void | selected()

- 4 signals inherited from QAbstractSeries

## Detailed Description

The QAreaSeries class is used for making area charts.

An area series is used to show quantitative data. It is based on line series, in the way that the area between the boundary lines is emphasized with color. Since the area series is based on line series, QAreaSeries constructor needs a QLineSeries instance, which defines "upper" boundary of the area. The area chart is drawn using the bottom of the plot area as the "lower" boundary by default. Instead of the bottom of the plot area, the "lower" boundary can be specified by another line. In that case QAreaSeries should be initialized with two QLineSeries instances. Please note that the terms "upper" and "lower" boundary can be misleading in cases where the "lower" boundary has bigger values than the "upper" one. The main point is that the area between these two boundary lines will be filled.

See the area chart example to learn how to create a simple area chart.

## Property Documentation

### borderColor : QColor

Line (pen) color of the series. This is a convenience property for modifying the color of pen.

Access functions:

QColor | borderColor() const
void | setBorderColor(const QColor &color)

Notifier signal:

void | borderColorChanged(QColor color)

See also QAreaSeries::pen().

### color : QColor

Fill (brush) color of the series. This is a convenience property for modifying the color of brush.

Access functions:

QColor | color() const
void | setColor(const QColor &color)

Notifier signal:

void | colorChanged(QColor color)

See also QAreaSeries::brush().

### lowerSeries : QLineSeries * const

The lower one of the two line series used to define are series boundaries. Note if QAreaSeries was constructed without a lowerSeries this is null.

Access functions:

QLineSeries * | lowerSeries() const

### pointLabelsClipping : bool

Defines the clipping for data point labels. True by default. The labels on the edge of the plot area are cut when clipping is enabled.

Access functions:

bool | pointLabelsClipping() const
void | setPointLabelsClipping(bool enabled = true)

Notifier signal:

void | pointLabelsClippingChanged(bool clipping)

See also pointLabelsVisible.

### pointLabelsColor : QColor

Defines the color used for data point labels. By default, the color is the color of the brush defined in theme for labels.

Access functions:

QColor | pointLabelsColor() const
void | setPointLabelsColor(const QColor &color)

Notifier signal:

void | pointLabelsColorChanged(const QColor &color)

See also QAreaSeries::pointLabelsFormat.

### pointLabelsFont : QFont

Defines the font used for data point labels.

Access functions:

QFont | pointLabelsFont() const
void | setPointLabelsFont(const QFont &font)

Notifier signal:

void | pointLabelsFontChanged(const QFont &font)

See also QAreaSeries::pointLabelsFormat.

### pointLabelsFormat : QString

The format used for showing labels with series points.

QAreaSeries supports the following format tags:

@xPoint | The x value of the data point
@yPoint | The y value of the data point

For example, the following usage of the format tags would produce labels that have the data point (x, y) shown inside brackets separated by a comma:

      series->setPointLabelsFormat("(@xPoint, @yPoint)");

By default, the labels format is set to '@xPoint, @yPoint'. The labels are shown on the plot area, labels on the edge of the plot area are cut. If the points are close to each other the labels may overlap.

Access functions:

QString | pointLabelsFormat() const
void | setPointLabelsFormat(const QString &format)

Notifier signal:

void | pointLabelsFormatChanged(const QString &format)

See also QAreaSeries::pointLabelsVisible, QAreaSeries::pointLabelsFont, and QAreaSeries::pointLabelsColor.

### pointLabelsVisible : bool

Defines the visibility for data point labels. False by default.

Access functions:

bool | pointLabelsVisible() const
void | setPointLabelsVisible(bool visible = true)

Notifier signal:

void | pointLabelsVisibilityChanged(bool visible)

See also QAreaSeries::pointLabelsFormat and QAreaSeries::pointLabelsClipping.

### upperSeries : QLineSeries * const

This property holds the upper one of the two line series used to define area series boundaries.

Access functions:

QLineSeries * | upperSeries() const

## Member Function Documentation

### QAreaSeries::QAreaSeries(QObject *parent = Q_NULLPTR)

Constructs area series object without upper or lower series with parent object.

### QAreaSeries::QAreaSeries(QLineSeries *upperSeries, QLineSeries *lowerSeries = Q_NULLPTR)

Constructs area series object which is a child of upperSeries. Area will be spanned between upperSeries line and lowerSeries line. If no lowerSeries is passed to constructor, area is specified by axis x (y=0) instead. When series object is added to QChartView or QChart instance ownerships is transferred.

### QAreaSeries::~QAreaSeries()

Destroys the object.

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

Signal is emitted when the line (pen) color has changed to color.

Note: Notifier signal for property borderColor.

### QBrush QAreaSeries::brush() const

Returns the brush used to draw line for this series.

See also setBrush().

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

Signal is emitted when user clicks the point on area chart. The point is the point where the press was triggered.

See also pressed, released, and doubleClicked.

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

Signal is emitted when the fill (brush) color has changed to color.

Note: Notifier signal for property color.

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

Signal is emitted when user doubleclicks the point on area chart. The point is the point where the first press was triggered.

See also pressed, released, and clicked.

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

This signal is emitted when user has hovered over or away from the series. point shows the origin (coordinate) of the hover event. state is true when user has hovered over the series and false when hover has moved away from the series.

### QPen QAreaSeries::pen() const

Returns the pen used to draw line for this series.

See also setPen().

### `[signal]` void QAreaSeries::pointLabelsClippingChanged(bool clipping)

The clipping of the data point labels is changed to clipping.

Note: Notifier signal for property pointLabelsClipping.

### `[signal]` void QAreaSeries::pointLabelsColorChanged(const QColor &color)

The color used for data point labels is changed to color.

Note: Notifier signal for property pointLabelsColor.

### `[signal]` void QAreaSeries::pointLabelsFontChanged(const QFont &font)

The font used for data point labels is changed to font.

Note: Notifier signal for property pointLabelsFont.

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

Signal is emitted when the format of data point labels is changed.

Note: Notifier signal for property pointLabelsFormat.

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

The visibility of the data point labels is changed to visible.

Note: Notifier signal for property pointLabelsVisible.

### bool QAreaSeries::pointsVisible() const

Returns if the points are drawn for this series.

See also setPointsVisible().

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

Signal is emitted when user presses the point on area chart.

See also clicked, released, and doubleClicked.

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

Signal is emitted when user releases a press that was triggered on a point on area chart.

See also pressed, clicked, and doubleClicked.

### `[signal]` void QAreaSeries::selected()

The signal is emitted if the user selects/deselects the XY series. The logic for maintaining selections should be implemented by the user of QAreaSeries API.

### void QAreaSeries::setBrush(const QBrush &brush)

Sets brush used for filling the area.

See also brush().

### void QAreaSeries::setLowerSeries(QLineSeries *series)

Sets the series that is to be used as the area chart lower series.

See also lowerSeries().

### void QAreaSeries::setPen(const QPen &pen)

Sets pen used for drawing area outline.

See also pen().

### void QAreaSeries::setPointsVisible(bool visible = true)

Sets if data points are visible and should be drawn on line.

See also pointsVisible().

### void QAreaSeries::setUpperSeries(QLineSeries *series)

Sets the series that is to be used as the area chart upper series. If the upper series is null, the area chart is not drawn, even if it has a lower series.

See also upperSeries().

### `[virtual]` QAbstractSeries::SeriesType QAreaSeries::type() const

Reimplemented from QAbstractSeries::type().

Returns QAbstractSeries::SeriesTypeArea.