Adjust x-axis label from summed left axes widths

windows_fixes_yo
Tyler Goodlet 2022-02-06 12:19:05 -05:00
parent 0271841412
commit 2f2aef28dd
1 changed files with 11 additions and 8 deletions

View File

@ -253,7 +253,7 @@ class ContentsLabels:
and index < array[-1]['index'] and index < array[-1]['index']
): ):
# out of range # out of range
print('out of range?') print('WTF out of range?')
continue continue
# array = chart._arrays[name] # array = chart._arrays[name]
@ -550,17 +550,20 @@ class Cursor(pg.GraphicsObject):
for cursor in opts.get('cursors', ()): for cursor in opts.get('cursors', ()):
cursor.setIndex(ix) cursor.setIndex(ix)
# update the label on the bottom of the crosshair # Update the label on the bottom of the crosshair.
axes = plot.plotItem.axes
# TODO: make this an up-front calc that we update # TODO: make this an up-front calc that we update
# on axis-widget resize events. # on axis-widget resize events instead of on every mouse
# update cylce.
# left axis offset width for calcuating # left axis offset width for calcuating
# absolute x-axis label placement. # absolute x-axis label placement.
left_axis_width = 0 left_axis_width = 0
left = axes.get('left') if len(plot.pi_overlay.overlays):
if left: # breakpoint()
left_axis_width = left['item'].width() lefts = plot.pi_overlay.get_axes('left')
if lefts:
for left in lefts:
left_axis_width += left.width()
# map back to abs (label-local) coordinates # map back to abs (label-local) coordinates
self.xaxis_label.update_label( self.xaxis_label.update_label(