Fix `.default_view()` to view-left-of-data

multichartz_backup
Tyler Goodlet 2022-11-30 10:23:21 -05:00
parent 4f0ba84d50
commit 3689929d2e
1 changed files with 15 additions and 6 deletions

View File

@ -1028,6 +1028,12 @@ class ChartPlotWidget(pg.PlotWidget):
if index_field == 'time': if index_field == 'time':
vr = viz.plot.viewRect() vr = viz.plot.viewRect()
vtl, vtr = vr.left(), vr.right()
if vtl < datum_start:
vtl = datum_start
vtr = datum_stop
( (
abs_slc, abs_slc,
read_slc, read_slc,
@ -1035,11 +1041,14 @@ class ChartPlotWidget(pg.PlotWidget):
) = viz.flume.slice_from_time( ) = viz.flume.slice_from_time(
array, array,
start_t=vr.left(), start_t=vtl,
stop_t=vr.right(), stop_t=vtr,
) )
iv_arr = array
if mask is not None:
iv_arr = array[mask] iv_arr = array[mask]
index = iv_arr['index']
index = iv_arr['time']
else: else:
index = array['index'] index = array['index']
@ -1358,8 +1367,8 @@ class ChartPlotWidget(pg.PlotWidget):
Update the named internal graphics from ``array``. Update the named internal graphics from ``array``.
''' '''
flow = self._vizs[array_key or graphics_name] viz = self._vizs[array_key or graphics_name]
return flow.update_graphics( return viz.update_graphics(
array_key=array_key, array_key=array_key,
**kwargs, **kwargs,
) )