Ensure full hist OHLC path is drawn on tread
Since we removed the `Viz.update_graphics()` call from the main rt loop we have to be sure to call it in the history chart incr-loop to avoid a gap between the last bar and prior history since startup. We only need to update on tread since that should be the only time a full redraw is ever necessary, ow only the last datum is needed. Further this moves the graphics cycle func's profiler init to the top in an effort to get more correct latency measures.multichartz
parent
ee8e27f256
commit
84c48f17e2
|
@ -138,6 +138,7 @@ class DisplayState(Struct):
|
||||||
Chart-local real-time graphics state container.
|
Chart-local real-time graphics state container.
|
||||||
|
|
||||||
'''
|
'''
|
||||||
|
fqsn: str
|
||||||
godwidget: GodWidget
|
godwidget: GodWidget
|
||||||
quotes: dict[str, Any]
|
quotes: dict[str, Any]
|
||||||
|
|
||||||
|
@ -219,16 +220,19 @@ async def increment_history_view(
|
||||||
is_1m=True,
|
is_1m=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# check if tread-in-place view x-shift is needed
|
||||||
|
if should_tread:
|
||||||
|
# ensure path graphics append is shown on treads since
|
||||||
|
# the main rt loop does not call this.
|
||||||
|
hist_viz.update_graphics()
|
||||||
|
hist_chart.increment_view(datums=append_diff)
|
||||||
|
|
||||||
if (
|
if (
|
||||||
do_px_step
|
do_px_step
|
||||||
and liv
|
and liv
|
||||||
):
|
):
|
||||||
hist_viz.plot.vb._set_yrange(viz=hist_viz)
|
hist_viz.plot.vb._set_yrange(viz=hist_viz)
|
||||||
|
|
||||||
# check if tread-in-place x-shift is needed
|
|
||||||
if should_tread:
|
|
||||||
hist_chart.increment_view(datums=append_diff)
|
|
||||||
|
|
||||||
|
|
||||||
async def graphics_update_loop(
|
async def graphics_update_loop(
|
||||||
|
|
||||||
|
@ -342,6 +346,7 @@ async def graphics_update_loop(
|
||||||
last_quote_s = time.time()
|
last_quote_s = time.time()
|
||||||
|
|
||||||
dss[fqsn] = ds = linked.display_state = DisplayState(**{
|
dss[fqsn] = ds = linked.display_state = DisplayState(**{
|
||||||
|
'fqsn': fqsn,
|
||||||
'godwidget': godwidget,
|
'godwidget': godwidget,
|
||||||
'quotes': {},
|
'quotes': {},
|
||||||
'maxmin': maxmin,
|
'maxmin': maxmin,
|
||||||
|
@ -450,6 +455,13 @@ def graphics_update_cycle(
|
||||||
|
|
||||||
) -> None:
|
) -> None:
|
||||||
|
|
||||||
|
profiler = Profiler(
|
||||||
|
msg=f'Graphics loop cycle for: `{ds.fqsn}`',
|
||||||
|
delayed=True,
|
||||||
|
disabled=not pg_profile_enabled(),
|
||||||
|
ms_threshold=ms_slower_then,
|
||||||
|
)
|
||||||
|
|
||||||
# TODO: SPEEDing this all up..
|
# TODO: SPEEDing this all up..
|
||||||
# - optimize this whole graphics stack with ``numba`` hopefully
|
# - optimize this whole graphics stack with ``numba`` hopefully
|
||||||
# or at least a little `mypyc` B)
|
# or at least a little `mypyc` B)
|
||||||
|
@ -462,17 +474,10 @@ def graphics_update_cycle(
|
||||||
flume = ds.flume
|
flume = ds.flume
|
||||||
sym = flume.symbol
|
sym = flume.symbol
|
||||||
fqsn = sym.fqsn
|
fqsn = sym.fqsn
|
||||||
main_viz = chart._vizs[fqsn]
|
main_viz = ds.viz
|
||||||
hist_viz = hist_chart._vizs[fqsn]
|
hist_viz = ds.hist_viz
|
||||||
index_field = main_viz.index_field
|
index_field = main_viz.index_field
|
||||||
|
|
||||||
profiler = Profiler(
|
|
||||||
msg=f'Graphics loop cycle for: `{chart.name}`',
|
|
||||||
delayed=True,
|
|
||||||
disabled=not pg_profile_enabled(),
|
|
||||||
ms_threshold=ms_slower_then,
|
|
||||||
)
|
|
||||||
|
|
||||||
# unpack multi-referenced components
|
# unpack multi-referenced components
|
||||||
vlm_chart = ds.vlm_chart
|
vlm_chart = ds.vlm_chart
|
||||||
|
|
||||||
|
@ -522,7 +527,7 @@ def graphics_update_cycle(
|
||||||
else:
|
else:
|
||||||
main_viz.draw_last(
|
main_viz.draw_last(
|
||||||
array_key=fqsn,
|
array_key=fqsn,
|
||||||
only_last_uppx=True,
|
# only_last_uppx=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
# don't real-time "shift" the curve to the
|
# don't real-time "shift" the curve to the
|
||||||
|
@ -823,6 +828,8 @@ def graphics_update_cycle(
|
||||||
# graphic for all vizs
|
# graphic for all vizs
|
||||||
viz.draw_last(array_key=curve_name)
|
viz.draw_last(array_key=curve_name)
|
||||||
|
|
||||||
|
profiler.finish()
|
||||||
|
|
||||||
|
|
||||||
async def link_views_with_region(
|
async def link_views_with_region(
|
||||||
rt_chart: ChartPlotWidget,
|
rt_chart: ChartPlotWidget,
|
||||||
|
@ -1249,9 +1256,7 @@ async def display_symbol_data(
|
||||||
|
|
||||||
# ensure the last datum graphic is generated
|
# ensure the last datum graphic is generated
|
||||||
# for zoom-interaction purposes.
|
# for zoom-interaction purposes.
|
||||||
viz.draw_last(
|
viz.draw_last(array_key=fqsn)
|
||||||
array_key=fqsn,
|
|
||||||
)
|
|
||||||
|
|
||||||
hist_pi.vb.maxmin = partial(
|
hist_pi.vb.maxmin = partial(
|
||||||
hist_chart.maxmin,
|
hist_chart.maxmin,
|
||||||
|
|
Loading…
Reference in New Issue