Only draw last uppx cols worth if xy cached on fmtr

multichartz
Tyler Goodlet 2023-02-02 18:16:17 -05:00
parent c2bc01e1ac
commit ff58421565
1 changed files with 24 additions and 22 deletions

View File

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