Add `.x_last()` meth to flow graphics
parent
98438e29ef
commit
e252f70253
|
@ -133,7 +133,7 @@ class Curve(pg.GraphicsObject):
|
||||||
# self.last_step_pen = pg.mkPen(hcolor(color), width=2)
|
# self.last_step_pen = pg.mkPen(hcolor(color), width=2)
|
||||||
self.last_step_pen = pg.mkPen(pen, width=2)
|
self.last_step_pen = pg.mkPen(pen, width=2)
|
||||||
|
|
||||||
self._last_line = QLineF()
|
self._last_line: QLineF = QLineF()
|
||||||
|
|
||||||
# flat-top style histogram-like discrete curve
|
# flat-top style histogram-like discrete curve
|
||||||
# self._step_mode: bool = step_mode
|
# self._step_mode: bool = step_mode
|
||||||
|
@ -182,6 +182,13 @@ class Curve(pg.GraphicsObject):
|
||||||
else:
|
else:
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
def x_last(self) -> float:
|
||||||
|
'''
|
||||||
|
Return the last most x value of the last line segment.
|
||||||
|
|
||||||
|
'''
|
||||||
|
return self._last_line.x2()
|
||||||
|
|
||||||
def px_width(self) -> float:
|
def px_width(self) -> float:
|
||||||
|
|
||||||
vb = self.getViewBox()
|
vb = self.getViewBox()
|
||||||
|
|
|
@ -114,12 +114,20 @@ class BarItems(pg.GraphicsObject):
|
||||||
|
|
||||||
self.setCacheMode(QtWidgets.QGraphicsItem.DeviceCoordinateCache)
|
self.setCacheMode(QtWidgets.QGraphicsItem.DeviceCoordinateCache)
|
||||||
self.path = QPainterPath()
|
self.path = QPainterPath()
|
||||||
self._last_bar_lines: Optional[tuple[QLineF, ...]] = None
|
|
||||||
|
self._last_bar_lines: tuple[QLineF, ...] | None = None
|
||||||
|
|
||||||
def x_uppx(self) -> int:
|
def x_uppx(self) -> int:
|
||||||
# we expect the downsample curve report this.
|
# we expect the downsample curve report this.
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
def x_last(self) -> float:
|
||||||
|
'''
|
||||||
|
Return the last most x value of the close line segment.
|
||||||
|
|
||||||
|
'''
|
||||||
|
return self._last_bar_lines[-1].x2()
|
||||||
|
|
||||||
# Qt docs: https://doc.qt.io/qt-5/qgraphicsitem.html#boundingRect
|
# Qt docs: https://doc.qt.io/qt-5/qgraphicsitem.html#boundingRect
|
||||||
def boundingRect(self):
|
def boundingRect(self):
|
||||||
# profiler = Profiler(
|
# profiler = Profiler(
|
||||||
|
|
Loading…
Reference in New Issue