Only add plot to cursor set if not an overlay

axis_sticky_api
Tyler Goodlet 2022-11-15 15:04:28 -05:00
parent ae0f3118f4
commit 36a81cb2de
1 changed files with 25 additions and 21 deletions

View File

@ -483,7 +483,11 @@ class LinkedSplits(QWidget):
from . import _display from . import _display
ds = self.display_state ds = self.display_state
if ds: if ds:
return _display.graphics_update_cycle(ds, **kwargs) return _display.graphics_update_cycle(
ds,
ds.quotes,
**kwargs,
)
@property @property
def symbol(self) -> Symbol: def symbol(self) -> Symbol:
@ -536,7 +540,7 @@ class LinkedSplits(QWidget):
shm: ShmArray, shm: ShmArray,
sidepane: FieldsForm, sidepane: FieldsForm,
style: str = 'bar', style: str = 'ohlc_bar',
) -> ChartPlotWidget: ) -> ChartPlotWidget:
''' '''
@ -699,7 +703,7 @@ class LinkedSplits(QWidget):
anchor_at = ('top', 'left') anchor_at = ('top', 'left')
# draw curve graphics # draw curve graphics
if style == 'bar': if style == 'ohlc_bar':
graphics, data_key = cpw.draw_ohlc( graphics, data_key = cpw.draw_ohlc(
name, name,
@ -736,22 +740,25 @@ class LinkedSplits(QWidget):
else: else:
raise ValueError(f"Chart style {style} is currently unsupported") raise ValueError(f"Chart style {style} is currently unsupported")
if not _is_main: if _is_main:
assert style == 'ohlc_bar', 'main chart must be OHLC'
else:
# track by name # track by name
self.subplots[name] = cpw self.subplots[name] = cpw
if qframe is not None: if qframe is not None:
self.splitter.addWidget(qframe) self.splitter.addWidget(qframe)
else:
assert style == 'bar', 'main chart must be OHLC'
# add to cross-hair's known plots # add to cross-hair's known plots
# NOTE: add **AFTER** creating the underlying ``PlotItem``s # NOTE: add **AFTER** creating the underlying ``PlotItem``s
# since we require that global (linked charts wide) axes have # since we require that global (linked charts wide) axes have
# been created! # been created!
if self.cursor:
if (
_is_main
or style != 'ohlc_bar'
):
self.cursor.add_plot(cpw) self.cursor.add_plot(cpw)
if style != 'ohlc_bar':
if self.cursor and style != 'bar':
self.cursor.add_curve_cursor(cpw, graphics) self.cursor.add_curve_cursor(cpw, graphics)
if add_label: if add_label:
@ -1150,6 +1157,7 @@ class ChartPlotWidget(pg.PlotWidget):
}, },
default_axes=[], default_axes=[],
) )
# pi.vb.background.setOpacity(0)
yaxis.pi = pi yaxis.pi = pi
pi.chart_widget = self pi.chart_widget = self
pi.hideButtons() pi.hideButtons()
@ -1210,10 +1218,6 @@ class ChartPlotWidget(pg.PlotWidget):
''' '''
color = color or self.pen_color or 'default_light' color = color or self.pen_color or 'default_light'
# graphics_kwargs.update({
# 'color': color
# })
data_key = array_key or name data_key = array_key or name
pi = pi or self.plotItem pi = pi or self.plotItem