From d57bc6c6d90496836896218f2b03f3aa9d5cb7a7 Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Tue, 31 Jan 2023 15:15:56 -0500 Subject: [PATCH] Adjust to using `PlotItem`s for axis sticky mgmt --- piker/ui/_display.py | 15 +++++++++------ piker/ui/_fsp.py | 6 ++++-- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/piker/ui/_display.py b/piker/ui/_display.py index c7ed9299..babbfa7a 100644 --- a/piker/ui/_display.py +++ b/piker/ui/_display.py @@ -260,12 +260,14 @@ async def graphics_update_loop( hist_ohlcv = flume.hist_shm # update last price sticky - last_price_sticky = fast_chart._ysticks[fast_chart.name] + last_price_sticky = fast_chart.plotItem.getAxis( + 'right')._stickies.get(fast_chart.name) last_price_sticky.update_from_data( *ohlcv.array[-1][['index', 'close']] ) - hist_last_price_sticky = hist_chart._ysticks[hist_chart.name] + hist_last_price_sticky = hist_chart.plotItem.getAxis( + 'right')._stickies.get(hist_chart.name) hist_last_price_sticky.update_from_data( *hist_ohlcv.array[-1][['index', 'close']] ) @@ -289,7 +291,7 @@ async def graphics_update_loop( symbol = fast_chart.linked.symbol l1 = L1Labels( - fast_chart, + fast_chart.plotItem, # determine precision/decimal lengths digits=symbol.tick_size_digits, size_digits=symbol.lot_size_digits, @@ -333,7 +335,8 @@ async def graphics_update_loop( }) if vlm_chart: - vlm_sticky = vlm_chart._ysticks['volume'] + vlm_sticky = vlm_chart.plotItem.getAxis( + 'right')._stickies.get('volume') ds.vlm_chart = vlm_chart ds.vlm_sticky = vlm_sticky @@ -947,7 +950,6 @@ async def link_views_with_region( async def display_symbol_data( godwidget: GodWidget, - provider: str, fqsns: list[str], loglevel: str, order_mode_started: trio.Event, @@ -999,6 +1001,7 @@ async def display_symbol_data( symbol = flume.symbol fqsn = symbol.fqsn + brokername = symbol.brokers[0] step_size_s = 1 tf_key = tf_in_1s[step_size_s] @@ -1082,7 +1085,7 @@ async def display_symbol_data( # if available load volume related built-in display(s) if ( - not symbol.broker_info[provider].get('no_vlm', False) + not symbol.broker_info[brokername].get('no_vlm', False) and has_vlm(ohlcv) ): vlm_chart = await ln.start( diff --git a/piker/ui/_fsp.py b/piker/ui/_fsp.py index 9e05f545..8c2e64a1 100644 --- a/piker/ui/_fsp.py +++ b/piker/ui/_fsp.py @@ -110,7 +110,8 @@ def update_fsp_chart( # sub-charts reference it under different 'named charts'. # read from last calculated value and update any label - last_val_sticky = chart._ysticks.get(graphics_name) + last_val_sticky = chart.plotItem.getAxis( + 'right')._stickies.get(chart.name) if last_val_sticky: last = last_row[array_key] last_val_sticky.update_from_data(-1, last) @@ -685,7 +686,8 @@ async def open_vlm_displays( assert chart.name != linked.chart.name # sticky only on sub-charts atm - last_val_sticky = chart._ysticks[chart.name] + last_val_sticky = chart.plotItem.getAxis( + 'right')._stickies.get(chart.name) # read from last calculated value value = shm.array['volume'][-1]