QScatterSeries Class
The QScatterSeries class draws a marker at each of its points. More…
| Header | #include <QScatterSeries> |
|---|---|
| CMake | target_link_libraries(app PRIVATE Nt::Charts) |
| Module | Nt Charts C++ Classes |
| Inherits | QXYSeries |
List of all members, including inherited members
Public Types
| enum | MarkerShape |
Public Functions
| QScatterSeries(QObject *parent = nullptr) | |
| ~QScatterSeries() | |
| void | setBorderColor(const QColor &color) |
| QColor | borderColor() const |
| MarkerShape | markerShape() const |
| void | setMarkerShape(MarkerShape shape) |
Reimplemented Public Functions
| QAbstractSeries::SeriesType | type() const |
| void | setPen(const QPen &pen) |
| void | setBrush(const QBrush &brush) |
| void | setColor(const QColor &color) |
| QColor | color() const |
Signals
| void | borderColorChanged(QColor color) |
| void | markerShapeChanged(MarkerShape shape) |
Detailed Description

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.
| Constant | Description |
|---|---|
QScatterSeries::MarkerShapeCircle | A circle. |
QScatterSeries::MarkerShapeRectangle | A square. |
QScatterSeries::MarkerShapeRotatedRectangle | A square standing on a corner. |
QScatterSeries::MarkerShapeTriangle | A triangle pointing up. |
QScatterSeries::MarkerShapeStar | A five-pointed star. |
QScatterSeries::MarkerShapePentagon | A pentagon. |
Member Function Documentation
QScatterSeries::QScatterSeries(QObject *parent = nullptr)
Constructs an empty scatter series with the given parent.
QScatterSeries::~QScatterSeries()
Destroys the series.
QColor QScatterSeries::borderColor() const
Returns the color of the borders of the markers.
void QScatterSeries::borderColorChanged(QColor color)
This signal is emitted when the border color of the markers changes to color.
QColor QScatterSeries::color() const
Reimplements QXYSeries::color().
Returns the fill color of the markers.
MarkerShape QScatterSeries::markerShape() const
Returns the shape of the markers.
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.
void QScatterSeries::setBrush(const QBrush &brush)
Reimplements QXYSeries::setBrush().
Sets the brush of the markers to brush.
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.
void QScatterSeries::setPen(const QPen &pen)
Reimplements QXYSeries::setPen().
Sets the pen of the borders of the markers to pen.
QAbstractSeries::SeriesType QScatterSeries::type() const
Reimplements QXYSeries::type().
Returns QAbstractSeries::SeriesTypeScatter.