Add `.x_last()` meth to flow graphics
							parent
							
								
									14bcba367e
								
							
						
					
					
						commit
						aaa1bccd60
					
				| 
						 | 
				
			
			@ -133,7 +133,7 @@ class Curve(pg.GraphicsObject):
 | 
			
		|||
        # self.last_step_pen = pg.mkPen(hcolor(color), 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
 | 
			
		||||
        # self._step_mode: bool = step_mode
 | 
			
		||||
| 
						 | 
				
			
			@ -182,6 +182,13 @@ class Curve(pg.GraphicsObject):
 | 
			
		|||
        else:
 | 
			
		||||
            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:
 | 
			
		||||
 | 
			
		||||
        vb = self.getViewBox()
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -114,12 +114,20 @@ class BarItems(pg.GraphicsObject):
 | 
			
		|||
 | 
			
		||||
        self.setCacheMode(QtWidgets.QGraphicsItem.DeviceCoordinateCache)
 | 
			
		||||
        self.path = QPainterPath()
 | 
			
		||||
        self._last_bar_lines: Optional[tuple[QLineF, ...]] = None
 | 
			
		||||
 | 
			
		||||
        self._last_bar_lines: tuple[QLineF, ...] | None = None
 | 
			
		||||
 | 
			
		||||
    def x_uppx(self) -> int:
 | 
			
		||||
        # we expect the downsample curve report this.
 | 
			
		||||
        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
 | 
			
		||||
    def boundingRect(self):
 | 
			
		||||
        # profiler = Profiler(
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue