Make `.increment_view()` take in a `datums: int` and always scale it by sample step size
parent
06f1b94147
commit
b6521498f4
|
@ -951,10 +951,6 @@ class ChartPlotWidget(pg.PlotWidget):
|
||||||
def focus(self) -> None:
|
def focus(self) -> None:
|
||||||
self.view.setFocus()
|
self.view.setFocus()
|
||||||
|
|
||||||
def view_range(self) -> tuple[int, int]:
|
|
||||||
vr = self.viewRect()
|
|
||||||
return int(vr.left()), int(vr.right())
|
|
||||||
|
|
||||||
def pre_l1_xs(self) -> tuple[float, float]:
|
def pre_l1_xs(self) -> tuple[float, float]:
|
||||||
'''
|
'''
|
||||||
Return the view x-coord for the value just before
|
Return the view x-coord for the value just before
|
||||||
|
@ -1034,25 +1030,28 @@ class ChartPlotWidget(pg.PlotWidget):
|
||||||
|
|
||||||
def increment_view(
|
def increment_view(
|
||||||
self,
|
self,
|
||||||
steps: int = 1,
|
datums: int = 1,
|
||||||
vb: Optional[ChartView] = None,
|
vb: Optional[ChartView] = None,
|
||||||
|
|
||||||
) -> None:
|
) -> None:
|
||||||
"""
|
'''
|
||||||
Increment the data view one step to the right thus "following"
|
Increment the data view ``datums``` steps toward y-axis thus
|
||||||
the current time slot/step/bar.
|
"following" the current time slot/step/bar.
|
||||||
|
|
||||||
"""
|
'''
|
||||||
l, r = self.view_range()
|
|
||||||
view = vb or self.view
|
view = vb or self.view
|
||||||
if steps >= 300:
|
viz = self.main_viz
|
||||||
|
l, r = viz.view_range()
|
||||||
|
x_shift = viz.index_step() * datums
|
||||||
|
|
||||||
|
if datums >= 300:
|
||||||
print("FUCKING FIX THE GLOBAL STEP BULLSHIT")
|
print("FUCKING FIX THE GLOBAL STEP BULLSHIT")
|
||||||
# breakpoint()
|
# breakpoint()
|
||||||
return
|
return
|
||||||
|
|
||||||
view.setXRange(
|
view.setXRange(
|
||||||
min=l + steps,
|
min=l + x_shift,
|
||||||
max=r + steps,
|
max=r + x_shift,
|
||||||
|
|
||||||
# TODO: holy shit, wtf dude... why tf would this not be 0 by
|
# TODO: holy shit, wtf dude... why tf would this not be 0 by
|
||||||
# default... speechless.
|
# default... speechless.
|
||||||
|
|
Loading…
Reference in New Issue