From 885116ae466dc7570740b4f3c94ca5c8ebe15f3c Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Tue, 12 Apr 2022 11:40:48 -0400 Subject: [PATCH] Only update y-range from L1 mxmn when last index in view We still have to always keep track of the last max and min though. --- piker/ui/_display.py | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/piker/ui/_display.py b/piker/ui/_display.py index 27fcc02e..82f12196 100644 --- a/piker/ui/_display.py +++ b/piker/ui/_display.py @@ -382,6 +382,7 @@ def graphics_update_cycle( i_diff > 0 # no new sample step and xpx < 4 # chart is zoomed out very far and r >= i_step # the last datum isn't in view + and liv ) or trigger_all ): @@ -399,7 +400,7 @@ def graphics_update_cycle( if ( (xpx < update_uppx or i_diff > 0) or trigger_all - and r >= i_step + and liv ): # TODO: make it so this doesn't have to be called # once the $vlm is up? @@ -549,7 +550,10 @@ def graphics_update_cycle( l1.bid_label.fields['level']: l1.bid_label, }.get(price) - if label is not None: + if ( + label is not None + # and liv + ): label.update_fields( {'level': price, 'size': size} ) @@ -558,19 +562,27 @@ def graphics_update_cycle( # the relevant L1 queue? # label.size -= size - # elif ticktype in ('ask', 'asize'): - elif typ in _tick_groups['asks']: + elif ( + typ in _tick_groups['asks'] + # TODO: instead we could check if the price is in the + # y-view-range? + # and liv + ): l1.ask_label.update_fields({'level': price, 'size': size}) - # elif ticktype in ('bid', 'bsize'): - elif typ in _tick_groups['bids']: + elif ( + typ in _tick_groups['bids'] + # TODO: instead we could check if the price is in the + # y-view-range? + # and liv + ): l1.bid_label.update_fields({'level': price, 'size': size}) # check for y-range re-size if ( (mx > vars['last_mx']) or (mn < vars['last_mn']) and not chart._static_yrange == 'axis' - and r > i_step # the last datum is in view + and liv ): main_vb = chart.view if (