Add `FastAppendCurve.draw_last()`
parent
e02d6f156e
commit
a05566ab53
|
@ -337,9 +337,6 @@ class FastAppendCurve(pg.GraphicsObject):
|
||||||
else:
|
else:
|
||||||
self._xrange = x[0], x[-1]
|
self._xrange = x[0], x[-1]
|
||||||
|
|
||||||
x_last = x[-1]
|
|
||||||
y_last = y[-1]
|
|
||||||
|
|
||||||
# check for downsampling conditions
|
# check for downsampling conditions
|
||||||
if (
|
if (
|
||||||
# std m4 downsample conditions
|
# std m4 downsample conditions
|
||||||
|
@ -498,7 +495,7 @@ class FastAppendCurve(pg.GraphicsObject):
|
||||||
finiteCheck=False,
|
finiteCheck=False,
|
||||||
path=self.fast_path,
|
path=self.fast_path,
|
||||||
)
|
)
|
||||||
profiler(f'generated append qpath')
|
profiler('generated append qpath')
|
||||||
|
|
||||||
if self.use_fpath:
|
if self.use_fpath:
|
||||||
# an attempt at trying to make append-updates faster..
|
# an attempt at trying to make append-updates faster..
|
||||||
|
@ -537,6 +534,28 @@ class FastAppendCurve(pg.GraphicsObject):
|
||||||
# self.disable_cache()
|
# self.disable_cache()
|
||||||
# flip_cache = True
|
# flip_cache = True
|
||||||
|
|
||||||
|
self.draw_last(x, y)
|
||||||
|
profiler('draw last segment')
|
||||||
|
|
||||||
|
# trigger redraw of path
|
||||||
|
# do update before reverting to cache mode
|
||||||
|
# self.prepareGeometryChange()
|
||||||
|
self.update()
|
||||||
|
profiler('.update()')
|
||||||
|
|
||||||
|
# if flip_cache:
|
||||||
|
# # XXX: seems to be needed to avoid artifacts (see above).
|
||||||
|
# self.setCacheMode(QGraphicsItem.DeviceCoordinateCache)
|
||||||
|
|
||||||
|
def draw_last(
|
||||||
|
self,
|
||||||
|
x: np.ndarray,
|
||||||
|
y: np.ndarray,
|
||||||
|
|
||||||
|
) -> None:
|
||||||
|
x_last = x[-1]
|
||||||
|
y_last = y[-1]
|
||||||
|
|
||||||
# draw the "current" step graphic segment so it lines up with
|
# draw the "current" step graphic segment so it lines up with
|
||||||
# the "middle" of the current (OHLC) sample.
|
# the "middle" of the current (OHLC) sample.
|
||||||
if self._step_mode:
|
if self._step_mode:
|
||||||
|
@ -556,21 +575,9 @@ class FastAppendCurve(pg.GraphicsObject):
|
||||||
else:
|
else:
|
||||||
self._last_line = QLineF(
|
self._last_line = QLineF(
|
||||||
x[-2], y[-2],
|
x[-2], y[-2],
|
||||||
x[-1], y_last
|
x_last, y_last
|
||||||
)
|
)
|
||||||
|
|
||||||
profiler('draw last segment')
|
|
||||||
|
|
||||||
# trigger redraw of path
|
|
||||||
# do update before reverting to cache mode
|
|
||||||
# self.prepareGeometryChange()
|
|
||||||
self.update()
|
|
||||||
profiler('.update()')
|
|
||||||
|
|
||||||
# if flip_cache:
|
|
||||||
# # XXX: seems to be needed to avoid artifacts (see above).
|
|
||||||
# self.setCacheMode(QGraphicsItem.DeviceCoordinateCache)
|
|
||||||
|
|
||||||
# XXX: lol brutal, the internals of `CurvePoint` (inherited by
|
# XXX: lol brutal, the internals of `CurvePoint` (inherited by
|
||||||
# our `LineDot`) required ``.getData()`` to work..
|
# our `LineDot`) required ``.getData()`` to work..
|
||||||
def getData(self):
|
def getData(self):
|
||||||
|
|
Loading…
Reference in New Issue