6.0.0-rc4Source

QScatterSeries Class

The QScatterSeries class draws a marker at each of its points. More…

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

List of all members, including inherited members

Public Types

Public Functions

QScatterSeries(QObject *parent = nullptr)
~QScatterSeries()
voidsetBorderColor(const QColor &color)
QColorborderColor() const
MarkerShapemarkerShape() const
voidsetMarkerShape(MarkerShape shape)

Reimplemented Public Functions

QAbstractSeries::SeriesTypetype() const
voidsetPen(const QPen &pen)
voidsetBrush(const QBrush &brush)
voidsetColor(const QColor &color)
QColorcolor() const

Signals

voidborderColorChanged(QColor color)
voidmarkerShapeChanged(MarkerShape shape)

Detailed Description

Two scatter series with circle and diamond markers

auto *series = new QScatterSeries;
series->setName("Requests");
series->setMarkerSize(9);
for (int i = 0; i < 50; ++i)
    series->append(i * 37 % 100, 20 + (i * 37 % 100) * 0.7 + 10 * std::sin(i));

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

The markers are filled with brush() and outlined with pen(); markerSize() is their diameter.

See also QXYSeries.

Differences from Qt

Markers are drawn as shapes only; there are no image markers.

Member Type Documentation

enum QScatterSeries::MarkerShape

The shape of the markers.

ConstantDescription
QScatterSeries::MarkerShapeCircleA circle.
QScatterSeries::MarkerShapeRectangleA square.
QScatterSeries::MarkerShapeRotatedRectangleA square standing on a corner.
QScatterSeries::MarkerShapeTriangleA triangle pointing up.
QScatterSeries::MarkerShapeStarA five-pointed star.
QScatterSeries::MarkerShapePentagonA pentagon.

Member Function Documentation

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

Constructs an empty scatter series with the given parent.

[override] QScatterSeries::~QScatterSeries()

Destroys the series.

QColor QScatterSeries::borderColor() const

Returns the color of the borders of the markers.

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

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

[override] QColor QScatterSeries::color() const

Reimplements QXYSeries::color().

Returns the fill color of the markers.

MarkerShape QScatterSeries::markerShape() const

Returns the shape of the markers.

[signal] void QScatterSeries::markerShapeChanged(MarkerShape shape)

This signal is emitted when the shape of the markers changes to shape.

void QScatterSeries::setBorderColor(const QColor &color)

Sets the color of the borders of the markers to color.

[override] void QScatterSeries::setBrush(const QBrush &brush)

Reimplements QXYSeries::setBrush().

Sets the brush of the markers to brush.

[override] void QScatterSeries::setColor(const QColor &color)

Reimplements QXYSeries::setColor().

Sets the fill color of the markers to color.

void QScatterSeries::setMarkerShape(MarkerShape shape)

Sets the shape of the markers to shape.

[override] void QScatterSeries::setPen(const QPen &pen)

Reimplements QXYSeries::setPen().

Sets the pen of the borders of the markers to pen.

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

Reimplements QXYSeries::type().

Returns QAbstractSeries::SeriesTypeScatter.