From 68faa0e99bf4f4f6a78bde9b2d20bc0a9c7f34fd Mon Sep 17 00:00:00 2001 From: "Eugeniy E. Mikhailov" Date: Fri, 17 Dec 2021 12:58:43 -0500 Subject: better plot updates --- qolab/gui/web.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'qolab/gui/web.py') diff --git a/qolab/gui/web.py b/qolab/gui/web.py index 612f72a..88f17f2 100644 --- a/qolab/gui/web.py +++ b/qolab/gui/web.py @@ -88,10 +88,18 @@ class QOLTimeLog(jp.Div): log.clear_data() self.plot() - def _replot(self, msg): + async def _replot(self, msg): self.plot() + await self.update() - async def plot(self): + async def update_loop(self, wait_time=4): + wait_time=5 + while True: + print('updating chart') + await self.update() + await asyncio.sleep(wait_time) + + def plot(self): log = self.log f = plt.figure() if log is None: @@ -100,7 +108,6 @@ class QOLTimeLog(jp.Div): log.plot() self.chart.set_figure(f) plt.close(f) - jp.run_task(self.update()) class QOLSaveControls(jp.Div): -- cgit v1.2.3