QXYSeries Class

The QXYSeries class is a base class for line, spline and scatter series. More...

Header: #include <QXYSeries>
Instantiated By: XYSeries
Inherits: QAbstractSeries
Inherited By:

QLineSeries and QScatterSeries

Properties

Public Functions

~QXYSeries()
void append(qreal x, qreal y)
void append(const QPointF &point)
void append(const QList<QPointF> &points)
const QPointF &at(int index) const
QBrush brush() const
void clear()
virtual QColor color() const
int count() const
void insert(int index, const QPointF &point)
QPen pen() const
bool pointLabelsClipping() const
QColor pointLabelsColor() const
QFont pointLabelsFont() const
QString pointLabelsFormat() const
bool pointLabelsVisible() const
QList<QPointF> points() const
QVector<QPointF> pointsVector() const
bool pointsVisible() const
void remove(qreal x, qreal y)
void remove(const QPointF &point)
void remove(int index)
void removePoints(int index, int count)
void replace(qreal oldX, qreal oldY, qreal newX, qreal newY)
void replace(const QPointF &oldPoint, const QPointF &newPoint)
void replace(int index, qreal newX, qreal newY)
void replace(int index, const QPointF &newPoint)
void replace(QList<QPointF> points)
void replace(QVector<QPointF> points)
virtual void setBrush(const QBrush &brush)
virtual void setColor(const QColor &color)
virtual 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)
QXYSeries &operator<<(const QPointF &point)
QXYSeries &operator<<(const QList<QPointF> &points)

Signals

void clicked(const QPointF &point)
void colorChanged(QColor color)
void doubleClicked(const QPointF &point)
void hovered(const QPointF &point, bool state)
void penChanged(const QPen &pen)
void pointAdded(int index)
void pointLabelsClippingChanged(bool clipping)
void pointLabelsColorChanged(const QColor &color)
void pointLabelsFontChanged(const QFont &font)
void pointLabelsFormatChanged(const QString &format)
void pointLabelsVisibilityChanged(bool visible)
void pointRemoved(int index)
void pointReplaced(int index)
void pointsRemoved(int index, int count)
void pointsReplaced()
void pressed(const QPointF &point)
void released(const QPointF &point)

Additional Inherited Members

  • 1 public slot inherited from QObject
  • 11 static public members inherited from QObject
  • 9 protected functions inherited from QObject

Detailed Description

The QXYSeries class is a base class for line, spline and scatter series.

Property Documentation

color : QColor

The color of the series. This is line (pen) color in case of QLineSeries or QSplineSeries and fill (brush) color in case of QScatterSeries or QAreaSeries.

Access functions:

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

Notifier signal:

void colorChanged(QColor color)

See also pen() and brush().

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 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 pointLabelsFormat.

pointLabelsFormat : QString

The format used for showing labels with series points.

QXYSeries supports the following format tags:

@xPointThe x value of the data point
@yPointThe 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 pointLabelsVisible, pointLabelsFont, and 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 pointLabelsFormat and pointLabelsClipping.

pointsVisible : bool

Controls if the data points are visible and should be drawn.

Access functions:

bool pointsVisible() const
void setPointsVisible(bool visible = true)

Member Function Documentation

QXYSeries::~QXYSeries()

Destroys the object. Series added to QChart instances are owned by those, and are destroyed when QChart instances are destroyed.

void QXYSeries::append(qreal x, qreal y)

Adds data point (x, y) to the series.

void QXYSeries::append(const QPointF &point)

This is an overloaded function. Adds data point to the series.

void QXYSeries::append(const QList<QPointF> &points)

This is an overloaded function. Adds list of data points to the series.

const QPointF &QXYSeries::at(int index) const

Returns point at index in internal points vector.

QBrush QXYSeries::brush() const

Returns brush used to draw points for series.

See also setBrush().

void QXYSeries::clear()

Removes all points from the series.

See also pointsRemoved().

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

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

See also pressed, released, and doubleClicked.

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

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

Note: Notifier signal for property color.

int QXYSeries::count() const

Returns number of data points within series.

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

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

See also pressed, released, and clicked.

[signal] void QXYSeries::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.

void QXYSeries::insert(int index, const QPointF &point)

Inserts a point in the series at index position.

See also pointAdded().

QPen QXYSeries::pen() const

Returns pen used to draw points for series.

See also setPen().

[signal] void QXYSeries::penChanged(const QPen &pen)

Signal is emitted when the line pen has changed to pen.

[signal] void QXYSeries::pointAdded(int index)

Signal is emitted when a point has been added at index.

See also append() and insert().

[signal] void QXYSeries::pointLabelsClippingChanged(bool clipping)

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

Note: Notifier signal for property pointLabelsClipping.

[signal] void QXYSeries::pointLabelsColorChanged(const QColor &color)

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

Note: Notifier signal for property pointLabelsColor.

[signal] void QXYSeries::pointLabelsFontChanged(const QFont &font)

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

Note: Notifier signal for property pointLabelsFont.

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

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

Note: Notifier signal for property pointLabelsFormat.

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

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

Note: Notifier signal for property pointLabelsVisible.

[signal] void QXYSeries::pointRemoved(int index)

Signal is emitted when a point has been removed from index.

See also remove().

[signal] void QXYSeries::pointReplaced(int index)

Signal is emitted when a point has been replaced at index.

See also replace().

QList<QPointF> QXYSeries::points() const

Returns the points in the series as a list. Use QXYSeries::pointsVector() for better performance.

[signal] void QXYSeries::pointsRemoved(int index, int count)

Signal is emitted when a count of points has been removed starting at index.

See also removePoints() and clear().

[signal] void QXYSeries::pointsReplaced()

Signal is emitted when all points have been replaced with other points.

See also replace().

QVector<QPointF> QXYSeries::pointsVector() const

Returns the points in the series as a vector. This is more efficient that calling QXYSeries::points();

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

Signal is emitted when user presses the point on chart.

See also clicked, released, and doubleClicked.

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

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

See also pressed, clicked, and doubleClicked.

void QXYSeries::remove(qreal x, qreal y)

Removes the point (x, y) from the series.

See also pointRemoved().

void QXYSeries::remove(const QPointF &point)

Removes the point from the series.

See also pointRemoved().

void QXYSeries::remove(int index)

Removes the point at index from the series.

See also pointRemoved().

void QXYSeries::removePoints(int index, int count)

Removes count number of points from the series starting at index.

See also pointsRemoved().

void QXYSeries::replace(qreal oldX, qreal oldY, qreal newX, qreal newY)

Replaces data point (oldX, oldY) with data point (newX, newY).

See also pointReplaced().

void QXYSeries::replace(const QPointF &oldPoint, const QPointF &newPoint)

Replaces oldPoint with newPoint.

See also pointReplaced().

void QXYSeries::replace(int index, qreal newX, qreal newY)

Replaces the point at index with data point (newX, newY).

See also pointReplaced().

void QXYSeries::replace(int index, const QPointF &newPoint)

Replaces the point at index with newPoint.

See also pointReplaced().

void QXYSeries::replace(QList<QPointF> points)

Replaces the current points with points.

Note: This is much faster than replacing data points one by one, or first clearing all data, and then appending the new data. Emits QXYSeries::pointsReplaced() when the points have been replaced. However, note that using the overload that takes QVector<QPointF> as parameter is faster than using this overload.

See also pointsReplaced().

void QXYSeries::replace(QVector<QPointF> points)

Replaces the current points with points.

Note: This is much faster than replacing data points one by one, or first clearing all data, and then appending the new data. Emits QXYSeries::pointsReplaced() when the points have been replaced.

See also pointsReplaced().

[virtual] void QXYSeries::setBrush(const QBrush &brush)

Sets brush used for drawing points on the chart. If the brush is not defined, brush from chart theme setting is used.

See also brush() and QChart::setTheme().

[virtual] void QXYSeries::setPen(const QPen &pen)

Sets pen used for drawing points on the chart. If the pen is not defined, the pen from chart theme is used.

See also pen() and QChart::setTheme().

QXYSeries &QXYSeries::operator<<(const QPointF &point)

Stream operator for adding a data point to the series.

See also append().

QXYSeries &QXYSeries::operator<<(const QList<QPointF> &points)

Stream operator for adding a list of points to the series.

See also append().

© 2016 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.