Don't scale overlays on linked from display loop

In the (incrementally updated) display loop we have range logic that is
incrementally updated in real-time by streams, as such we don't really
need to update all linked chart's (for any given, currently updated
chart) y-ranges on calls of each separate (sub-)chart's
`ChartView.interact_graphics_cycle()`. In practise there are plenty of
cases where resizing in one chart (say the vlm fsps sub-plot) requires
a y-range re-calc but not in the OHLC price chart. Therefore
we always avoid doing more resizing then necessary despite it resulting
in potentially more method call overhead (which will later be justified
by better leveraging incrementally updated `Viz.maxmin()` and
`media_from_range()` calcs).
multichartz
Tyler Goodlet 2023-01-24 12:46:09 -05:00
parent a7b3b1722e
commit 6f60f60c67
1 changed files with 15 additions and 12 deletions

View File

@ -255,8 +255,8 @@ async def increment_history_view(
profiler('`hist Viz.update_graphics()` call') profiler('`hist Viz.update_graphics()` call')
if liv: if liv:
# hist_viz.plot.vb._set_yrange(viz=hist_viz)
hist_viz.plot.vb.interact_graphics_cycle( hist_viz.plot.vb.interact_graphics_cycle(
do_linked_charts=False,
# do_overlay_scaling=False, # do_overlay_scaling=False,
) )
profiler('hist chart yrange view') profiler('hist chart yrange view')
@ -580,7 +580,6 @@ def graphics_update_cycle(
or trigger_all or trigger_all
): ):
chart.increment_view(datums=append_diff) chart.increment_view(datums=append_diff)
# main_viz.plot.vb._set_yrange(viz=main_viz)
# NOTE: since vlm and ohlc charts are axis linked now we don't # NOTE: since vlm and ohlc charts are axis linked now we don't
# need the double increment request? # need the double increment request?
@ -716,16 +715,14 @@ def graphics_update_cycle(
# yr = (mn, mx) # yr = (mn, mx)
main_vb.interact_graphics_cycle( main_vb.interact_graphics_cycle(
# do_overlay_scaling=False, # do_overlay_scaling=False,
do_linked_charts=False,
) )
# TODO: we should probably scale # TODO: we should probably scale
# the view margin based on the size # the view margin based on the size
# of the true range? This way you can # of the true range? This way you can
# slap in orders outside the current # slap in orders outside the current
# L1 (only) book range. # L1 (only) book range.
# main_vb._set_yrange(
# yrange=yr
# # range_margin=0.1,
# )
profiler('main vb y-autorange') profiler('main vb y-autorange')
# SLOW CHART resize case # SLOW CHART resize case
@ -848,9 +845,15 @@ def graphics_update_cycle(
mx_vlm_in_view != varz['last_mx_vlm'] mx_vlm_in_view != varz['last_mx_vlm']
): ):
varz['last_mx_vlm'] = mx_vlm_in_view varz['last_mx_vlm'] = mx_vlm_in_view
# TODO: incr maxmin update as pass into below..
# vlm_yr = (0, mx_vlm_in_view * 1.375) # vlm_yr = (0, mx_vlm_in_view * 1.375)
# vlm_chart.view._set_yrange(yrange=vlm_yr)
# profiler('`vlm_chart.view._set_yrange()`') main_vlm_viz.plot.vb.interact_graphics_cycle(
# do_overlay_scaling=False,
do_linked_charts=False,
)
profiler('`vlm_chart.view.interact_graphics_cycle()`')
# update all downstream FSPs # update all downstream FSPs
for curve_name, viz in vlm_vizs.items(): for curve_name, viz in vlm_vizs.items():
@ -878,10 +881,10 @@ def graphics_update_cycle(
# resizing from last quote?) # resizing from last quote?)
# XXX: without this we get completely # XXX: without this we get completely
# mangled/empty vlm display subchart.. # mangled/empty vlm display subchart..
# fvb = viz.plot.vb fvb = viz.plot.vb
# fvb._set_yrange( fvb.interact_graphics_cycle(
# viz=viz, do_linked_charts=False,
# ) )
profiler(f'vlm `Viz[{viz.name}].plot.vb._set_yrange()`') profiler(f'vlm `Viz[{viz.name}].plot.vb._set_yrange()`')
# even if we're downsampled bigly # even if we're downsampled bigly