Drop input xy from constructor, only keep state for cursor stuff..
parent
1dca7766d2
commit
1f95ba4fd8
|
@ -1075,8 +1075,6 @@ class ChartPlotWidget(pg.PlotWidget):
|
||||||
# yah, we wrote our own B)
|
# yah, we wrote our own B)
|
||||||
data = shm.array
|
data = shm.array
|
||||||
curve = FastAppendCurve(
|
curve = FastAppendCurve(
|
||||||
y=data[data_key],
|
|
||||||
x=data['index'],
|
|
||||||
# antialias=True,
|
# antialias=True,
|
||||||
name=name,
|
name=name,
|
||||||
|
|
||||||
|
|
|
@ -68,9 +68,6 @@ class FastAppendCurve(pg.GraphicsObject):
|
||||||
'''
|
'''
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
|
|
||||||
x: np.ndarray = None,
|
|
||||||
y: np.ndarray = None,
|
|
||||||
*args,
|
*args,
|
||||||
|
|
||||||
step_mode: bool = False,
|
step_mode: bool = False,
|
||||||
|
@ -85,8 +82,8 @@ class FastAppendCurve(pg.GraphicsObject):
|
||||||
) -> None:
|
) -> None:
|
||||||
|
|
||||||
# brutaaalll, see comments within..
|
# brutaaalll, see comments within..
|
||||||
self._y = self.yData = y
|
self.yData = None
|
||||||
self._x = self.xData = x
|
self.xData = None
|
||||||
self._vr: Optional[tuple] = None
|
self._vr: Optional[tuple] = None
|
||||||
self._avr: Optional[tuple] = None
|
self._avr: Optional[tuple] = None
|
||||||
self._br = None
|
self._br = None
|
||||||
|
@ -206,7 +203,7 @@ class FastAppendCurve(pg.GraphicsObject):
|
||||||
disabled=not pg_profile_enabled(),
|
disabled=not pg_profile_enabled(),
|
||||||
ms_threshold=ms_slower_then,
|
ms_threshold=ms_slower_then,
|
||||||
)
|
)
|
||||||
flip_cache = False
|
# flip_cache = False
|
||||||
|
|
||||||
if self._xrange:
|
if self._xrange:
|
||||||
istart, istop = self._xrange
|
istart, istop = self._xrange
|
||||||
|
@ -227,9 +224,8 @@ class FastAppendCurve(pg.GraphicsObject):
|
||||||
|
|
||||||
# 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..
|
||||||
# self.xData = x
|
self.xData = x
|
||||||
# self.yData = y
|
self.yData = y
|
||||||
# self._x, self._y = x, y
|
|
||||||
|
|
||||||
# downsampling incremental state checking
|
# downsampling incremental state checking
|
||||||
uppx = self.x_uppx()
|
uppx = self.x_uppx()
|
||||||
|
@ -261,7 +257,7 @@ class FastAppendCurve(pg.GraphicsObject):
|
||||||
vl, vr = view_range
|
vl, vr = view_range
|
||||||
|
|
||||||
# last_ivr = self._x_iv_range
|
# last_ivr = self._x_iv_range
|
||||||
# ix_iv, iy_iv = self._x_iv_range = (x_iv[0], x_iv[-1])
|
# ix_iv, iy_iv = self._x_iv_range = (x_iv[0], x_iv[-1])
|
||||||
|
|
||||||
zoom_or_append = False
|
zoom_or_append = False
|
||||||
last_vr = self._vr
|
last_vr = self._vr
|
||||||
|
@ -390,7 +386,9 @@ class FastAppendCurve(pg.GraphicsObject):
|
||||||
)
|
)
|
||||||
self.prepareGeometryChange()
|
self.prepareGeometryChange()
|
||||||
profiler(
|
profiler(
|
||||||
f'generated fresh path. (should_redraw: {should_redraw} should_ds: {should_ds} new_sample_rate: {new_sample_rate})'
|
'generated fresh path. '
|
||||||
|
f'(should_redraw: {should_redraw} '
|
||||||
|
f'should_ds: {should_ds} new_sample_rate: {new_sample_rate})'
|
||||||
)
|
)
|
||||||
# profiler(f'DRAW PATH IN VIEW -> {self._name}')
|
# profiler(f'DRAW PATH IN VIEW -> {self._name}')
|
||||||
|
|
||||||
|
@ -495,7 +493,6 @@ class FastAppendCurve(pg.GraphicsObject):
|
||||||
self.draw_last(x, y)
|
self.draw_last(x, y)
|
||||||
profiler('draw last segment')
|
profiler('draw last segment')
|
||||||
|
|
||||||
|
|
||||||
# if flip_cache:
|
# if flip_cache:
|
||||||
# # # XXX: seems to be needed to avoid artifacts (see above).
|
# # # XXX: seems to be needed to avoid artifacts (see above).
|
||||||
# self.setCacheMode(QGraphicsItem.DeviceCoordinateCache)
|
# self.setCacheMode(QGraphicsItem.DeviceCoordinateCache)
|
||||||
|
@ -545,7 +542,7 @@ class FastAppendCurve(pg.GraphicsObject):
|
||||||
# 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):
|
||||||
return self._x, self._y
|
return self.xData, self.yData
|
||||||
|
|
||||||
# TODO: drop the above after ``Cursor`` re-work
|
# TODO: drop the above after ``Cursor`` re-work
|
||||||
def get_arrays(self) -> tuple[np.ndarray, np.ndarray]:
|
def get_arrays(self) -> tuple[np.ndarray, np.ndarray]:
|
||||||
|
|
|
@ -187,8 +187,6 @@ class BarItems(pg.GraphicsObject):
|
||||||
# curve that does not release mem allocs:
|
# curve that does not release mem allocs:
|
||||||
# https://doc.qt.io/qt-5/qpainterpath.html#clear
|
# https://doc.qt.io/qt-5/qpainterpath.html#clear
|
||||||
curve = FastAppendCurve(
|
curve = FastAppendCurve(
|
||||||
y=y,
|
|
||||||
x=x,
|
|
||||||
name='OHLC',
|
name='OHLC',
|
||||||
color=self._color,
|
color=self._color,
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue