Only update x-axis cursor if chart has a 'bottom' axis

plotitem_overlays
Tyler Goodlet 2022-01-24 15:14:06 -05:00
parent 9e18afe0d7
commit 1ccff37677
1 changed files with 20 additions and 16 deletions

View File

@ -418,6 +418,9 @@ class Cursor(pg.GraphicsObject):
# keep x-axis right below main chart
plot_index = -1 if _xaxis_at == 'bottom' else 0
# ONLY create an x-axis label for the cursor
# if this plot owns the 'bottom' axis.
if 'bottom' in plot.plotItem.axes:
self.xaxis_label = XAxisLabel(
parent=self.plots[plot_index].getAxis('bottom'),
opacity=_ch_label_opac,
@ -526,6 +529,7 @@ class Cursor(pg.GraphicsObject):
cursor.setIndex(ix)
# update the label on the bottom of the crosshair
if 'bottom' in plot.plotItem.axes:
self.xaxis_label.update_label(
# XXX: requires: