From 75798630684664ec90e3ad86fff4a188fd14c646 Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Tue, 28 Feb 2023 14:32:03 -0500 Subject: [PATCH] Skip overlay handling when `N < 2` are detected --- piker/ui/view_mode.py | 82 +++++++++++++++++++++++-------------------- 1 file changed, 44 insertions(+), 38 deletions(-) diff --git a/piker/ui/view_mode.py b/piker/ui/view_mode.py index e6d12769..cc0fa44c 100644 --- a/piker/ui/view_mode.py +++ b/piker/ui/view_mode.py @@ -201,6 +201,8 @@ def overlay_viewlists( chart: ChartPlotWidget for chart_name, chart in plots.items(): + overlay_viz_items = chart._vizs.items() + # Common `PlotItem` maxmin table; presumes that some path # graphics (and thus their backing data sets) are in the # same co-domain and view box (since the were added @@ -218,6 +220,46 @@ def overlay_viewlists( # and scale minor charts onto the major chart: the chart # with the most dispersion in the set. + # ONLY auto-yrange the viz mapped to THIS view box + if ( + not do_overlay_scaling + or len(overlay_viz_items) < 2 + ): + viz = active_viz + if debug_print: + print(f'ONLY ranging THIS viz: {viz.name}') + + out = _maybe_calc_yrange( + viz, + yrange_kwargs, + profiler, + chart_name, + ) + if out is None: + continue + + read_slc, yrange_kwargs = out + viz.plot.vb._set_yrange(**yrange_kwargs) + profiler(f'{viz.name}@{chart_name} single curve yrange') + + # don't iterate overlays, just move to next chart + continue + + if debug_print: + print( + f'BEGIN UX GRAPHICS CYCLE: @{chart_name}\n' + + + '#'*100 + + + '\n' + ) + + # create a group overlay log-linearized y-range transform to + # track and eventually inverse transform all overlay curves + # to a common target max dispersion range. + dnt = OverlayT() + upt = OverlayT() + # collect certain flows have grapics objects **in seperate # plots/viewboxes** into groups and do a common calc to # determine auto-ranging input for `._set_yrange()`. @@ -239,44 +281,8 @@ def overlay_viewlists( ], ] = {} - # ONLY auto-yrange the viz mapped to THIS view box - if not do_overlay_scaling: - viz = active_viz - if debug_print: - print(f'ONLY ranging THIS viz: {viz.name}') - - out = _maybe_calc_yrange( - viz, - yrange_kwargs, - profiler, - chart_name, - ) - if out is None: - continue - - read_slc, yrange_kwargs = out - viz.plot.vb._set_yrange(**yrange_kwargs) - profiler(f'{viz.name}@{chart_name} single curve yrange') - - # don't iterate overlays, just move to next chart - continue - - # create a group overlay log-linearized y-range transform to - # track and eventually inverse transform all overlay curves - # to a common target max dispersion range. - dnt = OverlayT() - upt = OverlayT() - - if debug_print: - print( - f'BEGIN UX GRAPHICS CYCLE: @{chart_name}\n' - + - '#'*100 - + - '\n' - ) - - for name, viz in chart._vizs.items(): + # multi-curve overlay processing stage + for name, viz in overlay_viz_items: out = _maybe_calc_yrange( viz,