diff --git a/piker/ui/_dataviz.py b/piker/ui/_dataviz.py index 3bdfbe1e..55d2ff91 100644 --- a/piker/ui/_dataviz.py +++ b/piker/ui/_dataviz.py @@ -934,16 +934,17 @@ class Viz(msgspec.Struct): # , frozen=True): # the most recent datum is being drawn. uppx = ceil(gfx.x_uppx()) + alt_renderer = self._alt_r + if alt_renderer: + renderer, gfx = alt_renderer + else: + renderer = self._src_r + if ( (self._in_ds or only_last_uppx) and uppx > 0 + and renderer is not None ): - alt_renderer = self._alt_r - if alt_renderer: - renderer, gfx = alt_renderer - else: - renderer = self._src_r - fmtr = renderer.fmtr x = fmtr.x_1d y = fmtr.y_1d @@ -952,23 +953,24 @@ class Viz(msgspec.Struct): # , frozen=True): if alt_renderer: iuppx = ceil(uppx / fmtr.flat_index_ratio) - y = y[-iuppx:] - ymn, ymx = y.min(), y.max() - try: - x_start = x[-iuppx] - except IndexError: - # we're less then an x-px wide so just grab the start - # datum index. - x_start = x[0] + if y is not None: + y = y[-iuppx:] + ymn, ymx = y.min(), y.max() + try: + x_start = x[-iuppx] + except IndexError: + # we're less then an x-px wide so just grab the start + # datum index. + x_start = x[0] - gfx._last_line = QLineF( - x_start, ymn, - x[-1], ymx, - ) - # print( - # f'updating DS curve {self.name}@{time_step}s\n' - # f'drawing uppx={uppx} mxmn line: {ymn}, {ymx}' - # ) + gfx._last_line = QLineF( + x_start, ymn, + x[-1], ymx, + ) + # print( + # f'updating DS curve {self.name}@{time_step}s\n' + # f'drawing uppx={uppx} mxmn line: {ymn}, {ymx}' + # ) else: x, y = gfx.draw_last_datum(