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.
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(