Adjust to using `PlotItem`s for axis sticky mgmt

axis_sticky_api
Tyler Goodlet 2023-01-31 15:15:56 -05:00
parent 58b42d629f
commit d57bc6c6d9
2 changed files with 13 additions and 8 deletions

View File

@ -260,12 +260,14 @@ async def graphics_update_loop(
hist_ohlcv = flume.hist_shm hist_ohlcv = flume.hist_shm
# update last price sticky # 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( last_price_sticky.update_from_data(
*ohlcv.array[-1][['index', 'close']] *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_last_price_sticky.update_from_data(
*hist_ohlcv.array[-1][['index', 'close']] *hist_ohlcv.array[-1][['index', 'close']]
) )
@ -289,7 +291,7 @@ async def graphics_update_loop(
symbol = fast_chart.linked.symbol symbol = fast_chart.linked.symbol
l1 = L1Labels( l1 = L1Labels(
fast_chart, fast_chart.plotItem,
# determine precision/decimal lengths # determine precision/decimal lengths
digits=symbol.tick_size_digits, digits=symbol.tick_size_digits,
size_digits=symbol.lot_size_digits, size_digits=symbol.lot_size_digits,
@ -333,7 +335,8 @@ async def graphics_update_loop(
}) })
if vlm_chart: 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_chart = vlm_chart
ds.vlm_sticky = vlm_sticky ds.vlm_sticky = vlm_sticky
@ -947,7 +950,6 @@ async def link_views_with_region(
async def display_symbol_data( async def display_symbol_data(
godwidget: GodWidget, godwidget: GodWidget,
provider: str,
fqsns: list[str], fqsns: list[str],
loglevel: str, loglevel: str,
order_mode_started: trio.Event, order_mode_started: trio.Event,
@ -999,6 +1001,7 @@ async def display_symbol_data(
symbol = flume.symbol symbol = flume.symbol
fqsn = symbol.fqsn fqsn = symbol.fqsn
brokername = symbol.brokers[0]
step_size_s = 1 step_size_s = 1
tf_key = tf_in_1s[step_size_s] 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 available load volume related built-in display(s)
if ( if (
not symbol.broker_info[provider].get('no_vlm', False) not symbol.broker_info[brokername].get('no_vlm', False)
and has_vlm(ohlcv) and has_vlm(ohlcv)
): ):
vlm_chart = await ln.start( vlm_chart = await ln.start(

View File

@ -110,7 +110,8 @@ def update_fsp_chart(
# sub-charts reference it under different 'named charts'. # sub-charts reference it under different 'named charts'.
# read from last calculated value and update any label # 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: if last_val_sticky:
last = last_row[array_key] last = last_row[array_key]
last_val_sticky.update_from_data(-1, last) last_val_sticky.update_from_data(-1, last)
@ -685,7 +686,8 @@ async def open_vlm_displays(
assert chart.name != linked.chart.name assert chart.name != linked.chart.name
# sticky only on sub-charts atm # 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 # read from last calculated value
value = shm.array['volume'][-1] value = shm.array['volume'][-1]