diff --git a/piker/ui/_chart.py b/piker/ui/_chart.py index f9aa4bec..bb2d4448 100644 --- a/piker/ui/_chart.py +++ b/piker/ui/_chart.py @@ -814,7 +814,8 @@ class ChartPlotWidget(pg.PlotWidget): # a better one? def mk_vb(self, name: str) -> ChartView: cv = ChartView(name) - cv.linkedsplits = self.linked + # link new view to chart's view set + cv.linked = self.linked return cv def __init__( @@ -1179,19 +1180,27 @@ class ChartPlotWidget(pg.PlotWidget): ) pi.hideButtons() - # cv.enable_auto_yrange(self.view) - cv.enable_auto_yrange() - # compose this new plot's graphics with the current chart's # existing one but with separate axes as neede and specified. self.pi_overlay.add_plotitem( pi, index=index, - # only link x-axes, + # only link x-axes and + # don't relay any ``ViewBox`` derived event + # handlers since we only care about keeping charts + # x-synced on interaction (at least for now). link_axes=(0,), ) + # connect auto-yrange callbacks *from* this new + # view **to** this parent and likewise *from* the + # main/parent chart back *to* the created overlay. + cv.enable_auto_yrange(src_vb=self.view) + # makes it so that interaction on the new overlay will reflect + # back on the main chart (which overlay was added to). + self.view.enable_auto_yrange(src_vb=cv) + # add axis title # TODO: do we want this API to still work? # raxis = pi.getAxis('right') diff --git a/piker/ui/_fsp.py b/piker/ui/_fsp.py index 94859efa..dfbd8b9a 100644 --- a/piker/ui/_fsp.py +++ b/piker/ui/_fsp.py @@ -624,6 +624,8 @@ async def open_vlm_displays( # built-in vlm which we plot ASAP since it's # usually data provided directly with OHLC history. shm = ohlcv + ohlc_chart = linked.chart + chart = linked.add_plot( name='volume', shm=shm, @@ -639,6 +641,9 @@ async def open_vlm_displays( # the curve item internals are pretty convoluted. style='step', ) + ohlc_chart.view.enable_auto_yrange( + src_vb=chart.view, + ) # force 0 to always be in view def multi_maxmin(