PySide6.QtGraphs.QXYSeries

class QXYSeries

The QXYSeries class is a parent class for all x & y series classes. More

Inheritance diagram of PySide6.QtGraphs.QXYSeries

Inherited by: QSplineSeries, QScatterSeries, QLineSeries

Synopsis

Properties

  • colorᅟ - Main color of the series. For QLineSeries this means the line color and for QScatterSeries the color of the point

  • countᅟ - Returns the number of data points in a series

  • draggableᅟ - Controls if the series is draggable

  • pointDelegateᅟ - A custom QML Component used as a marker for data points

  • selectedColorᅟ - Color of selected points

  • selectedPointsᅟ - Indexes of the points which are currently selected

Methods

Signals

Note

This documentation may contain snippets that were automatically translated from C++ to Python. We always welcome contributions to the snippet translation. If you see an issue with the translation, you can also let us know by creating a ticket on https:/bugreports.qt.io/projects/PYSIDE

Detailed Description

In QXYSeries , data points are defined as a list of QPointF, defining X and Y positions.

Note

Properties can be used directly when from __feature__ import true_property is used or via accessor functions otherwise.

property colorᅟ: QColor

This property holds The main color of the series. For QLineSeries this means the line color and for QScatterSeries the color of the point..

Access functions:
property countᅟ: int

This property holds Returns the number of data points in a series..

Access functions:
property draggableᅟ: bool

This property holds Controls if the series is draggable..

Controls if the series can be dragged with mouse/touch. By default, draggable is set to false.

Access functions:
property pointDelegateᅟ: QQmlComponent

This property holds A custom QML Component used as a marker for data points..

The dynamic properties available for this component are:

Type

Name

Description

bool

pointSelected

This value is true when the point is selected, meaning that the point index is in selectedPoints .

QColor

pointColor

The color of the series. This value comes either from the QGraphsTheme or from color if the QXYSeries overrides the color.

QColor

pointBorderColor

The border color of the series. This value comes from the QGraphsTheme .

QColor

pointSelectedColor

The selected color of the series. This value comes either from the QGraphsTheme or from selectedColor if the QXYSeries overrides the color.

qreal

pointBorderWidth

The border width of the series. This value comes from the QGraphsTheme .

qreal

pointValueX

The value of the QXYPoint::x at this position.

qreal

pointValueY

The value of the QXYPoint::y at this position.

int

pointIndex

The index of the point, from 0 to the amount of points - 1. [since 6.9]

To use any of these, add property with the defined name into your custom component. For example "property color pointColor" and "property real pointValueX".

Access functions:
property selectedColorᅟ: QColor

This property holds The color of selected points..

Access functions:
property selectedPointsᅟ: list of qsizetype

This property holds The indexes of the points which are currently selected..

Access functions:
append(point)
Parameters:

pointQPointF

Appends a point with the coordinates point to the series.

append(points)
Parameters:

points – .list of QPointF

Appends points with the coordinates points to the series.

Note

This is much faster than appending data points one by one. Emits pointsAdded when the points have been added.

append(x, y)
Parameters:
  • x – float

  • y – float

Appends a point with the coordinates x and y to the series.

appendNp(x, y)
Parameters:
  • xPyArrayObject

  • yPyArrayObject

Adds the list of data points specified by two one-dimensional, equally sized numpy arrays representing the x, y values, respectively.

at(index)
Parameters:

index – int

Return type:

QPointF

Returns the point at the position specified by index. Returns (0, 0) if the index is not valid.

clear()

Removes all points from the series.

clicked(point)
Parameters:

pointQPoint

color()
Return type:

QColor

See also

setColor()

Getter of property colorᅟ .

colorChanged(color)
Parameters:

colorQColor

Notification signal of property colorᅟ .

count()
Return type:

int

Getter of property countᅟ .

countChanged()

Notification signal of property countᅟ .

deselectAllPoints()

Deselects all points in the series.

deselectPoint(index)
Parameters:

index – int

Deselects point at given index.

deselectPoints(indexes)
Parameters:

indexes – .list of qsizetype

Marks multiple points passed in a indexes list as deselected.

doubleClicked(point)
Parameters:

pointQPoint

draggableChanged()

Notification signal of property draggableᅟ .

find(point)
Parameters:

pointQPointF

Return type:

int

Finds and returns the index of the first matching point found as defined by point. Returns -1 if the point is not found.

insert(index, point)
Parameters:

Inserts a point with the coordinates point to the position specified by index in the series. If the index is 0 or less than 0, the point is prepended to the list of points. If the index is equal to or greater than than the number of points in the series, the point is appended to the list of points.

isDraggable()
Return type:

bool

Getter of property draggableᅟ .

isPointSelected(index)
Parameters:

index – int

Return type:

bool

Returns true if point at given index is among selected points and false otherwise.

Note

Selected points are drawn using the selected color if it was specified.

__lshift__(point)
Parameters:

pointQPointF

Return type:

QXYSeries

__lshift__(points)
Parameters:

points – .list of QPointF

Return type:

QXYSeries

pointAdded(index)
Parameters:

index – int

pointDelegate()
Return type:

QQmlComponent

Getter of property pointDelegateᅟ .

pointDelegateChanged()

Notification signal of property pointDelegateᅟ .

pointRemoved(index)
Parameters:

index – int

pointReplaced(index)
Parameters:

index – int

This signal is emitted when a point is replaced at the position specified by index.

See also

replace()

points()
Return type:

.list of QPointF

Returns the points in the series.

pointsAdded(start, end)
Parameters:
  • start – int

  • end – int

This signal is emitted when a list of points is appended. The indexes of the new added points are between start and end.

pointsRemoved(index, count)
Parameters:
  • index – int

  • count – int

pointsReplaced()

This signal is emitted when all points are replaced.

pressed(point)
Parameters:

pointQPoint

qt_qmlMarker_uncreatable()
released(point)
Parameters:

pointQPoint

remove(point)
Parameters:

pointQPointF

Removes the point with the coordinates point from the series. Does nothing if the point does not exist.

remove(index)
Parameters:

index – int

Removes the point at the position specified by index from the series.

remove(x, y)
Parameters:
  • x – float

  • y – float

Removes the point with the coordinates x and y from the series. Does nothing if the point does not exist.

removeMultiple(index, count)
Parameters:
  • index – int

  • count – int

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

replace(points)
Parameters:

points – .list of QPointF

Replaces the current points with the points specified by 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 pointsReplaced when the points have been replaced.

replace(oldPoint, newPoint)
Parameters:

Replaces the point with the coordinates oldPoint with the point with the coordinates newPoint. Does nothing if the old point does not exist.

replace(index, newPoint)
Parameters:
  • index – int

  • newPointQPointF

Replaces the point at the position specified by index with the point that has the coordinates newPoint.

replace(index, newX, newY)
Parameters:
  • index – int

  • newX – float

  • newY – float

Replaces the point at the position specified by index with the point that has the coordinates newX and newY.

replace(oldX, oldY, newX, newY)
Parameters:
  • oldX – float

  • oldY – float

  • newX – float

  • newY – float

Replaces the point with the coordinates oldX and oldY with the point with the coordinates newX and newY. Does nothing if the old point does not exist.

replaceNp(x, y)
Parameters:
  • xPyArrayObject

  • yPyArrayObject

Replaces the current points with the points specified by two one-dimensional, equally sized numpy arrays representing the x, y values, respectively.

selectAllPoints()

Marks all points in the series as selected,

selectPoint(index)
Parameters:

index – int

Marks point at index as selected.

selectPoints(indexes)
Parameters:

indexes – .list of qsizetype

Marks multiple points passed in a indexes list as selected.

selectedColor()
Return type:

QColor

Getter of property selectedColorᅟ .

selectedColorChanged(color)
Parameters:

colorQColor

Notification signal of property selectedColorᅟ .

selectedPoints()
Return type:

.list of qsizetype

Returns a list of points indexes marked as selected. Selected points are visible regardless of points visibility.

Getter of property selectedPointsᅟ .

selectedPointsChanged()

Notification signal of property selectedPointsᅟ .

seriesUpdated()
setColor(newColor)
Parameters:

newColorQColor

See also

color()

Setter of property colorᅟ .

setDraggable(newDraggable)
Parameters:

newDraggable – bool

See also

isDraggable()

Setter of property draggableᅟ .

setPointDelegate(newPointDelegate)
Parameters:

newPointDelegateQQmlComponent

See also

pointDelegate()

Setter of property pointDelegateᅟ .

setPointSelected(index, selected)
Parameters:
  • index – int

  • selected – bool

Marks point at given index as either selected or deselected as specified by selected.

Note

Selected points are drawn using the selected color if it was specified. Emits selectedPointsChanged

setSelectedColor(color)
Parameters:

colorQColor

See also

selectedColor()

Setter of property selectedColorᅟ .

take(point)
Parameters:

pointQPointF

Return type:

bool

Takes a point, specified by point, out of the series if found. Returns true if the operation is successful.

toggleSelection(indexes)
Parameters:

indexes – .list of qsizetype

Changes selection state of points at given indexes to the opposite one.