PySide6.QtGraphs.QXYSeries¶
- class QXYSeries¶
The
QXYSeries
class is a parent class for all x & y series classes. More…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 pointcountᅟ
- Returns the number of data points in a seriesdraggableᅟ
- Controls if the series is draggablepointDelegateᅟ
- A custom QML Component used as a marker for data pointsselectedColorᅟ
- Color of selected pointsselectedPointsᅟ
- Indexes of the points which are currently selected
Methods¶
def
append()
def
appendNp()
def
at()
def
clear()
def
color()
def
count()
def
deselectPoint()
def
deselectPoints()
def
find()
def
insert()
def
isDraggable()
def
__lshift__()
def
pointDelegate()
def
points()
def
remove()
def
removeMultiple()
def
replace()
def
replaceNp()
def
selectPoint()
def
selectPoints()
def
selectedColor()
def
selectedPoints()
def
setColor()
def
setDraggable()
def
take()
Signals¶
def
clicked()
def
colorChanged()
def
countChanged()
def
doubleClicked()
def
pointAdded()
def
pointRemoved()
def
pointReplaced()
def
pointsAdded()
def
pointsRemoved()
def
pointsReplaced()
def
pressed()
def
released()
def
seriesUpdated()
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.See also
Note
Properties can be used directly when
from __feature__ import true_property
is used or via accessor functions otherwise.This property holds The main color of the series. For
QLineSeries
this means the line color and forQScatterSeries
the color of the point..- Access functions:
Signal
colorChanged()
- property countᅟ: int¶
This property holds Returns the number of data points in a series..
- Access functions:
Signal
countChanged()
- 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 tofalse
.- 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 fromcolor
if theQXYSeries
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 fromselectedColor
if theQXYSeries
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:
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:
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
andy
to the series.- appendNp(x, y)¶
- Parameters:
x –
PyArrayObject
y –
PyArrayObject
Adds the list of data points specified by two one-dimensional, equally sized numpy arrays representing the x, y values, respectively.
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.
- color()¶
- Return type:
See also
Getter of property
colorᅟ
.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.- draggableChanged()¶
Notification signal of property
draggableᅟ
.Finds and returns the index of the first matching point found as defined by
point
. Returns -1 if the point is not found.Inserts a point with the coordinates
point
to the position specified byindex
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__(points)
- Parameters:
points – .list of QPointF
- Return type:
- pointAdded(index)¶
- Parameters:
index – int
- pointDelegate()¶
- Return type:
See also
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
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
andend
.- pointsRemoved(index, count)¶
- Parameters:
index – int
count – int
- pointsReplaced()¶
This signal is emitted when all points are replaced.
- qt_qmlMarker_uncreatable()¶
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
andy
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 byindex
.- 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.Replaces the point with the coordinates
oldPoint
with the point with the coordinatesnewPoint
. Does nothing if the old point does not exist.- replace(index, newPoint)
- Parameters:
index – int
newPoint –
QPointF
Replaces the point at the position specified by
index
with the point that has the coordinatesnewPoint
.- 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 coordinatesnewX
andnewY
.- replace(oldX, oldY, newX, newY)
- Parameters:
oldX – float
oldY – float
newX – float
newY – float
Replaces the point with the coordinates
oldX
andoldY
with the point with the coordinatesnewX
andnewY
. Does nothing if the old point does not exist.- replaceNp(x, y)¶
- Parameters:
x –
PyArrayObject
y –
PyArrayObject
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:
See also
Getter of property
selectedColorᅟ
.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.
See also
Getter of property
selectedPointsᅟ
.- selectedPointsChanged()¶
Notification signal of property
selectedPointsᅟ
.- seriesUpdated()¶
Setter of property
colorᅟ
.- setDraggable(newDraggable)¶
- Parameters:
newDraggable – bool
See also
Setter of property
draggableᅟ
.- setPointDelegate(newPointDelegate)¶
- Parameters:
newPointDelegate –
QQmlComponent
See also
Setter of property
pointDelegateᅟ
.- setPointSelected(index, selected)¶
- Parameters:
index – int
selected – bool
Marks point at given
index
as either selected or deselected as specified byselected
.Note
Selected points are drawn using the selected color if it was specified. Emits
selectedPointsChanged
Setter of property
selectedColorᅟ
.Takes a point, specified by
point
, out of the series if found. Returnstrue
if the operation is successful.- toggleSelection(indexes)¶
- Parameters:
indexes – .list of qsizetype
Changes selection state of points at given
indexes
to the opposite one.