Index must be int bro..
parent
5bcd6ac494
commit
49c25eeef4
|
@ -95,22 +95,24 @@ class LineDot(pg.CurvePoint):
|
||||||
|
|
||||||
def event(
|
def event(
|
||||||
self,
|
self,
|
||||||
|
|
||||||
ev: QtCore.QEvent,
|
ev: QtCore.QEvent,
|
||||||
|
|
||||||
) -> None:
|
) -> bool:
|
||||||
if not isinstance(
|
if not isinstance(
|
||||||
ev, QtCore.QDynamicPropertyChangeEvent
|
ev, QtCore.QDynamicPropertyChangeEvent
|
||||||
) or self.curve() is None:
|
) or self.curve() is None:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
# TODO: get rid of this ``.getData()`` and
|
||||||
|
# make a more pythonic api to retreive backing
|
||||||
|
# numpy arrays...
|
||||||
(x, y) = self.curve().getData()
|
(x, y) = self.curve().getData()
|
||||||
index = self.property('index')
|
index = self.property('index')
|
||||||
# first = self._plot._arrays['ohlc'][0]['index']
|
# first = self._plot._arrays['ohlc'][0]['index']
|
||||||
# first = x[0]
|
# first = x[0]
|
||||||
# i = index - first
|
# i = index - first
|
||||||
if index:
|
if index:
|
||||||
i = index - x[0]
|
i = round(index - x[0])
|
||||||
if i > 0 and i < len(y):
|
if i > 0 and i < len(y):
|
||||||
newPos = (index, y[i])
|
newPos = (index, y[i])
|
||||||
QtWidgets.QGraphicsItem.setPos(self, *newPos)
|
QtWidgets.QGraphicsItem.setPos(self, *newPos)
|
||||||
|
@ -405,6 +407,7 @@ class Cursor(pg.GraphicsObject):
|
||||||
slot=self.mouseMoved,
|
slot=self.mouseMoved,
|
||||||
delay=_debounce_delay,
|
delay=_debounce_delay,
|
||||||
)
|
)
|
||||||
|
|
||||||
px_enter = pg.SignalProxy(
|
px_enter = pg.SignalProxy(
|
||||||
plot.sig_mouse_enter,
|
plot.sig_mouse_enter,
|
||||||
rateLimit=_mouse_rate_limit,
|
rateLimit=_mouse_rate_limit,
|
||||||
|
|
Loading…
Reference in New Issue