From a3bbbeda9d575cd09aed65d6a5c68db233ffee44 Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Wed, 18 Jan 2023 12:07:47 -0500 Subject: [PATCH] Drop `ChartView._maxmin()` usage in `.ui._fsp` Removes the multi-maxmin usage as well as ensures appropriate `Viz` refs are passed into the view methods now requiring it. Also drops the "back linking" of the vlm chart view to the source OHLC chart since we're going to add this as a default to the charting API. --- piker/ui/_fsp.py | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/piker/ui/_fsp.py b/piker/ui/_fsp.py index 5d2c50ef..80c39b63 100644 --- a/piker/ui/_fsp.py +++ b/piker/ui/_fsp.py @@ -282,9 +282,10 @@ async def run_fsp_ui( # profiler(f'fsp:{name} chart created') # first UI update, usually from shm pushed history + viz = chart.get_viz(array_key) update_fsp_chart( chart, - chart.get_viz(array_key), + viz, name, array_key=array_key, ) @@ -311,7 +312,7 @@ async def run_fsp_ui( # level_line(chart, 70, orient_v='bottom') # level_line(chart, 80, orient_v='top') - chart.view._set_yrange() + chart.view._set_yrange(viz=viz) # done() # status updates # profiler(f'fsp:{func_name} starting update loop') @@ -665,7 +666,7 @@ 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 + # ohlc_chart = linked.chart vlm_chart = linked.add_plot( name='volume', @@ -683,13 +684,10 @@ async def open_vlm_displays( # the curve item internals are pretty convoluted. style='step', ) - vlm_chart.view.enable_auto_yrange() - - # back-link the volume chart to trigger y-autoranging - # in the ohlc (parent) chart. - ohlc_chart.view.enable_auto_yrange( - src_vb=vlm_chart.view, - ) + vlm_viz = vlm_chart._vizs['volume'] + # vlm_chart.view.enable_auto_yrange( + # viz=vlm_viz, + # ) # force 0 to always be in view def multi_maxmin( @@ -741,7 +739,9 @@ async def open_vlm_displays( ) # size view to data once at outset - vlm_chart.view._set_yrange() + vlm_chart.view._set_yrange( + viz=vlm_viz + ) # add axis title axis = vlm_chart.getAxis('right') @@ -827,7 +827,7 @@ async def open_vlm_displays( ) # add custom auto range handler - dvlm_pi.vb._maxmin = group_mxmn + # dvlm_pi.vb._maxmin = group_mxmn # add dvlm (step) curves to common view def chart_curves( @@ -926,11 +926,11 @@ async def open_vlm_displays( ) # add custom auto range handler - tr_pi.vb.maxmin = partial( - multi_maxmin, - # keep both regular and dark vlm in view - names=trade_rate_fields, - ) + # tr_pi.vb.maxmin = partial( + # multi_maxmin, + # # keep both regular and dark vlm in view + # names=trade_rate_fields, + # ) tr_pi.hideAxis('bottom') chart_curves(