Delegate `BarItems.x_uppx()` to internal ds curve
parent
91de281b7e
commit
f95d22bfd3
|
@ -318,6 +318,13 @@ class BarItems(pg.GraphicsObject):
|
||||||
|
|
||||||
return self.path
|
return self.path
|
||||||
|
|
||||||
|
|
||||||
|
def x_uppx(self) -> int:
|
||||||
|
if self._ds_line:
|
||||||
|
return self._ds_line.x_uppx()
|
||||||
|
else:
|
||||||
|
return 0
|
||||||
|
|
||||||
def update_from_array(
|
def update_from_array(
|
||||||
self,
|
self,
|
||||||
|
|
||||||
|
@ -346,6 +353,7 @@ class BarItems(pg.GraphicsObject):
|
||||||
profiler = pg.debug.Profiler(
|
profiler = pg.debug.Profiler(
|
||||||
disabled=not pg_profile_enabled(),
|
disabled=not pg_profile_enabled(),
|
||||||
gt=ms_slower_then,
|
gt=ms_slower_then,
|
||||||
|
delayed=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
# index = self.start_index
|
# index = self.start_index
|
||||||
|
@ -364,7 +372,7 @@ class BarItems(pg.GraphicsObject):
|
||||||
|
|
||||||
flip_cache = False
|
flip_cache = False
|
||||||
|
|
||||||
x_gt = 8
|
x_gt = 16
|
||||||
if self._ds_line:
|
if self._ds_line:
|
||||||
uppx = self._ds_line.x_uppx()
|
uppx = self._ds_line.x_uppx()
|
||||||
else:
|
else:
|
||||||
|
@ -383,6 +391,8 @@ class BarItems(pg.GraphicsObject):
|
||||||
):
|
):
|
||||||
should_line = True
|
should_line = True
|
||||||
|
|
||||||
|
profiler('ds logic complete')
|
||||||
|
|
||||||
if (
|
if (
|
||||||
should_line
|
should_line
|
||||||
):
|
):
|
||||||
|
@ -391,6 +401,7 @@ class BarItems(pg.GraphicsObject):
|
||||||
x, y = self._ds_line_xy = ohlc_flatten(ohlc)
|
x, y = self._ds_line_xy = ohlc_flatten(ohlc)
|
||||||
x_iv, y_iv = self._ds_line_xy = ohlc_flatten(ohlc_iv)
|
x_iv, y_iv = self._ds_line_xy = ohlc_flatten(ohlc_iv)
|
||||||
profiler('flattening bars to line')
|
profiler('flattening bars to line')
|
||||||
|
print(f'rendering linesc')
|
||||||
|
|
||||||
# TODO: we should be diffing the amount of new data which
|
# TODO: we should be diffing the amount of new data which
|
||||||
# needs to be downsampled. Ideally we actually are just
|
# needs to be downsampled. Ideally we actually are just
|
||||||
|
@ -427,6 +438,7 @@ class BarItems(pg.GraphicsObject):
|
||||||
# stop here since we don't need to update bars path any more
|
# stop here since we don't need to update bars path any more
|
||||||
# as we delegate to the downsample line with updates.
|
# as we delegate to the downsample line with updates.
|
||||||
profiler.finish()
|
profiler.finish()
|
||||||
|
print('terminating early')
|
||||||
return
|
return
|
||||||
|
|
||||||
elif (
|
elif (
|
||||||
|
@ -598,6 +610,8 @@ class BarItems(pg.GraphicsObject):
|
||||||
if flip_cache:
|
if flip_cache:
|
||||||
self.setCacheMode(QtWidgets.QGraphicsItem.DeviceCoordinateCache)
|
self.setCacheMode(QtWidgets.QGraphicsItem.DeviceCoordinateCache)
|
||||||
|
|
||||||
|
profiler.finish()
|
||||||
|
|
||||||
def boundingRect(self):
|
def boundingRect(self):
|
||||||
# Qt docs: https://doc.qt.io/qt-5/qgraphicsitem.html#boundingRect
|
# Qt docs: https://doc.qt.io/qt-5/qgraphicsitem.html#boundingRect
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue