diff --git a/piker/ui/_cursor.py b/piker/ui/_cursor.py index d8aa2cf7..83986762 100644 --- a/piker/ui/_cursor.py +++ b/piker/ui/_cursor.py @@ -363,7 +363,8 @@ class Cursor(pg.GraphicsObject): # value used for rounding y-axis discreet tick steps # computing once, up front, here cuz why not - self._y_incr_mult = float(1 / self.linked._symbol.tick_size) + mkt = self.linked._symbol + self._y_tick_mult = 1/float(mkt.price_tick) # line width in view coordinates self._lw = self.pixelWidth() * self.lines_pen.width() @@ -571,9 +572,15 @@ class Cursor(pg.GraphicsObject): line_offset = self._lw / 2 # round y value to nearest tick step - m = self._y_incr_mult + m = self._y_tick_mult iy = round(y * m) / m vl_y = iy - line_offset + # print( + # f'tick: {self._y_tick}\n' + # f'y: {y}\n' + # f'iy: {iy}\n' + # f'vl_y: {vl_y}\n' + # ) # update y-range items if iy != last_iy: diff --git a/piker/ui/_lines.py b/piker/ui/_lines.py index 4469a673..59796d4f 100644 --- a/piker/ui/_lines.py +++ b/piker/ui/_lines.py @@ -126,7 +126,7 @@ class LevelLine(pg.InfiniteLine): self._on_drag_start = lambda l: None self._on_drag_end = lambda l: None - self._y_incr_mult = 1 / chart.linked.symbol.tick_size + self._y_incr_mult = float(1 / chart.linked.symbol.size_tick) self._right_end_sc: float = 0 # use px caching