From 25a75e5bec280435e87594ba5f08bf4c5a3d5c26 Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Wed, 30 Nov 2022 10:23:21 -0500 Subject: [PATCH] Fix `.default_view()` to view-left-of-data --- piker/ui/_chart.py | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/piker/ui/_chart.py b/piker/ui/_chart.py index 1db354bf..61946873 100644 --- a/piker/ui/_chart.py +++ b/piker/ui/_chart.py @@ -1028,6 +1028,12 @@ class ChartPlotWidget(pg.PlotWidget): if index_field == 'time': vr = viz.plot.viewRect() + vtl, vtr = vr.left(), vr.right() + + if vtl < datum_start: + vtl = datum_start + vtr = datum_stop + ( abs_slc, read_slc, @@ -1035,11 +1041,14 @@ class ChartPlotWidget(pg.PlotWidget): ) = viz.flume.slice_from_time( array, - start_t=vr.left(), - stop_t=vr.right(), + start_t=vtl, + stop_t=vtr, ) - iv_arr = array[mask] - index = iv_arr['index'] + iv_arr = array + if mask is not None: + iv_arr = array[mask] + + index = iv_arr['time'] else: index = array['index'] @@ -1358,8 +1367,8 @@ class ChartPlotWidget(pg.PlotWidget): Update the named internal graphics from ``array``. ''' - flow = self._vizs[array_key or graphics_name] - return flow.update_graphics( + viz = self._vizs[array_key or graphics_name] + return viz.update_graphics( array_key=array_key, **kwargs, )