Use array-`int`-indexing on single feed
Might as well since it makes the chart look less gappy and we can easily flip the index switch now B) Also adds a new `'i_slow_last'` key to `DisplayState` for a singleton across all slow charts and thus no more need for special case logic in `viz.incr_info()`.multichartz_backup
parent
95e7c8648c
commit
5892c79737
|
@ -206,10 +206,12 @@ async def graphics_update_loop(
|
||||||
assert hist_chart
|
assert hist_chart
|
||||||
|
|
||||||
# per-viz-set global last index tracking for global chart
|
# per-viz-set global last index tracking for global chart
|
||||||
# view UX incrementing.
|
# view UX incrementing; these values are singleton
|
||||||
|
# per-multichart-set such that automatic x-domain shifts are only
|
||||||
|
# done once per time step update.
|
||||||
globalz = {
|
globalz = {
|
||||||
'i_last': 0,
|
'i_last': 0, # multiview-global fast (1s) step index
|
||||||
'i_last_append': 0,
|
'i_last_slow': 0, # multiview-global slow (1m) step index
|
||||||
}
|
}
|
||||||
|
|
||||||
dss: dict[str, DisplayState] = {}
|
dss: dict[str, DisplayState] = {}
|
||||||
|
@ -286,8 +288,7 @@ async def graphics_update_loop(
|
||||||
|
|
||||||
fast_chart.show()
|
fast_chart.show()
|
||||||
last_quote = time.time()
|
last_quote = time.time()
|
||||||
# global _i_last
|
i_last: float = 0
|
||||||
i_last = ohlcv.index
|
|
||||||
|
|
||||||
dss[fqsn] = ds = linked.display_state = DisplayState(**{
|
dss[fqsn] = ds = linked.display_state = DisplayState(**{
|
||||||
'godwidget': godwidget,
|
'godwidget': godwidget,
|
||||||
|
@ -369,13 +370,15 @@ async def graphics_update_loop(
|
||||||
do_append
|
do_append
|
||||||
and liv
|
and liv
|
||||||
):
|
):
|
||||||
# hist_chart.increment_view(steps=i_diff)
|
|
||||||
viz = hist_chart._vizs[fqsn]
|
viz = hist_chart._vizs[fqsn]
|
||||||
viz.plot.vb._set_yrange(
|
viz.plot.vb._set_yrange(
|
||||||
# yrange=hist_chart.maxmin(name=fqsn)
|
# yrange=hist_chart.maxmin(name=fqsn)
|
||||||
)
|
)
|
||||||
# hist_chart.view._set_yrange(yrange=hist_chart.maxmin())
|
# hist_chart.view._set_yrange(yrange=hist_chart.maxmin())
|
||||||
|
|
||||||
|
if should_incr:
|
||||||
|
hist_chart.increment_view(steps=i_diff)
|
||||||
|
|
||||||
nurse.start_soon(increment_history_view)
|
nurse.start_soon(increment_history_view)
|
||||||
|
|
||||||
# main real-time quotes update loop
|
# main real-time quotes update loop
|
||||||
|
@ -872,7 +875,18 @@ async def link_views_with_region(
|
||||||
# set the region on the history chart
|
# set the region on the history chart
|
||||||
# to the range currently viewed in the
|
# to the range currently viewed in the
|
||||||
# HFT/real-time chart.
|
# HFT/real-time chart.
|
||||||
region.setRegion(viewRange[0])
|
rng = mn, mx = viewRange[0]
|
||||||
|
|
||||||
|
# hist_viz = hist_chart.get_viz(flume.symbol.fqsn)
|
||||||
|
# hist = hist_viz.shm.array[-3:]
|
||||||
|
# print(
|
||||||
|
# f'mn: {mn}\n'
|
||||||
|
# f'mx: {mx}\n'
|
||||||
|
# f'slow last 3 epochs: {list(hist["time"])}\n'
|
||||||
|
# f'slow last 3: {hist}\n'
|
||||||
|
# )
|
||||||
|
|
||||||
|
region.setRegion(rng)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
# poll for datums load and timestep detection
|
# poll for datums load and timestep detection
|
||||||
|
@ -1107,6 +1121,12 @@ async def display_symbol_data(
|
||||||
tuple[str, Flume]
|
tuple[str, Flume]
|
||||||
] = list(feed.flumes.items())
|
] = list(feed.flumes.items())
|
||||||
|
|
||||||
|
# use array int-indexing when no aggregate feed overlays are
|
||||||
|
# loaded.
|
||||||
|
if len(fitems) == 1:
|
||||||
|
from ._dataviz import Viz
|
||||||
|
Viz._index_field = 'index'
|
||||||
|
|
||||||
# for the "first"/selected symbol we create new chart widgets
|
# for the "first"/selected symbol we create new chart widgets
|
||||||
# and sub-charts for FSPs
|
# and sub-charts for FSPs
|
||||||
fqsn, flume = fitems[0]
|
fqsn, flume = fitems[0]
|
||||||
|
|
Loading…
Reference in New Issue