[Mod] use partial update to improve plotting speed

This commit is contained in:
vn.py 2019-07-19 16:04:24 +08:00
parent 585dedb314
commit 6b8bf824c6
2 changed files with 5 additions and 7 deletions

View File

@ -34,6 +34,9 @@ class ChartItem(pg.GraphicsObject):
self._rect_area: Tuple[float, float] = None self._rect_area: Tuple[float, float] = None
# Very important! Only redraw the visible part and improve speed a lot.
self.setFlag(self.ItemUsesExtendedStyleOption)
@abstractmethod @abstractmethod
def _draw_bar_picture(self, ix: int, bar: BarData) -> QtGui.QPicture: def _draw_bar_picture(self, ix: int, bar: BarData) -> QtGui.QPicture:
""" """

View File

@ -397,12 +397,7 @@ class ChartCursor(QtCore.QObject):
""" """
Connect mouse move signal to update function. Connect mouse move signal to update function.
""" """
self._proxy = pg.SignalProxy( self._widget.scene().sigMouseMoved.connect(self._mouse_moved)
self._widget.scene().sigMouseMoved,
delay=0.1,
rateLimit=60,
slot=self._mouse_moved
)
def _mouse_moved(self, evt: tuple) -> None: def _mouse_moved(self, evt: tuple) -> None:
""" """
@ -412,7 +407,7 @@ class ChartCursor(QtCore.QObject):
return return
# First get current mouse point # First get current mouse point
pos = evt[0] pos = evt
for plot_name, view in self._views.items(): for plot_name, view in self._views.items():
rect = view.sceneBoundingRect() rect = view.sceneBoundingRect()