Skip to content

XYSeriesMixin

Base classes

Name Children Inherits
AbstractSeriesMixin
prettyqt.charts.abstractseries

Subclasses

Class Module Description
XYSeries prettyqt.charts.xyseries
ScatterSeries prettyqt.charts.scatterseries
LineSeries prettyqt.charts.lineseries

⋔ Inheritance diagram

graph TD
  1473367681024["charts.XYSeriesMixin"]
  1473367658576["charts.AbstractSeriesMixin"]
  1473299815024["core.ObjectMixin"]
  140713234304496["builtins.object"]
  1473367658576 --> 1473367681024
  1473299815024 --> 1473367658576
  140713234304496 --> 1473299815024

🛈 DocStrings

Bases: AbstractSeriesMixin

Source code in prettyqt\charts\xyseries.py
class XYSeriesMixin(charts.AbstractSeriesMixin):
    def __setitem__(self, index: int, val: datatypes.PointFType):
        """Set point at given index to value."""
        self.replace(index, datatypes.to_pointf(val))

    def __delitem__(self, index: int):
        """Remove point with given index."""
        self.remove(index)

    # def __setstate__(self, state):
    #     self.append(state["points"])

    # def __reduce__(self):
    #     return type(self), (), self.__getstate__()

    def __add__(self, other: datatypes.PointFType) -> XYSeries:
        """Append a point to the Series."""
        self.append(datatypes.to_pointf(other))
        return self

    def get_points(self) -> list[core.QPoint]:
        if prettyqt.qt.API == "pyqt6":
            return [self.at(i) for i in range(self.count())]
        else:
            return self.points()

    def get_pen(self) -> gui.Pen:
        return gui.Pen(self.pen())

    def get_brush(self) -> gui.Brush:
        return gui.Brush(self.brush())

__add__(other: datatypes.PointFType) -> XYSeries

Append a point to the Series.

Source code in prettyqt\charts\xyseries.py
def __add__(self, other: datatypes.PointFType) -> XYSeries:
    """Append a point to the Series."""
    self.append(datatypes.to_pointf(other))
    return self

__delitem__(index: int)

Remove point with given index.

Source code in prettyqt\charts\xyseries.py
def __delitem__(self, index: int):
    """Remove point with given index."""
    self.remove(index)

__setitem__(index: int, val: datatypes.PointFType)

Set point at given index to value.

Source code in prettyqt\charts\xyseries.py
def __setitem__(self, index: int, val: datatypes.PointFType):
    """Set point at given index to value."""
    self.replace(index, datatypes.to_pointf(val))