Make `LinearRegion` link using epoch-time index
Turned out to be super simple to get the first draft to work since the fast and slow chart now use the same domain, however, it seems like maybe there's an offset issue still where the fast may be a couple minutes ahead of the slow? Need to dig in a bit..epoch_indexing_and_dataviz_layer
parent
530b2731ba
commit
edf721f755
|
@ -853,13 +853,34 @@ async def link_views_with_region(
|
||||||
hist_pi.addItem(region, ignoreBounds=True)
|
hist_pi.addItem(region, ignoreBounds=True)
|
||||||
region.setOpacity(6/16)
|
region.setOpacity(6/16)
|
||||||
|
|
||||||
viz = rt_chart._vizs[flume.symbol.fqsn]
|
viz = rt_chart.get_viz(flume.symbol.fqsn)
|
||||||
assert viz
|
assert viz
|
||||||
|
index_field = viz.index_field
|
||||||
|
|
||||||
# XXX: no idea why this doesn't work but it's causing
|
# XXX: no idea why this doesn't work but it's causing
|
||||||
# a weird placement of the region on the way-far-left..
|
# a weird placement of the region on the way-far-left..
|
||||||
# region.setClipItem(viz.graphics)
|
# region.setClipItem(viz.graphics)
|
||||||
|
|
||||||
|
if index_field == 'time':
|
||||||
|
|
||||||
|
# in the (epoch) index case we can map directly
|
||||||
|
# from the fast chart's x-domain values since they are
|
||||||
|
# on the same index as the slow chart.
|
||||||
|
|
||||||
|
def update_region_from_pi(
|
||||||
|
window,
|
||||||
|
viewRange: tuple[tuple, tuple],
|
||||||
|
is_manual: bool = True,
|
||||||
|
) -> None:
|
||||||
|
# put linear region "in front" in layer terms
|
||||||
|
region.setZValue(10)
|
||||||
|
|
||||||
|
# set the region on the history chart
|
||||||
|
# to the range currently viewed in the
|
||||||
|
# HFT/real-time chart.
|
||||||
|
region.setRegion(viewRange[0])
|
||||||
|
|
||||||
|
else:
|
||||||
# poll for datums load and timestep detection
|
# poll for datums load and timestep detection
|
||||||
for _ in range(100):
|
for _ in range(100):
|
||||||
try:
|
try:
|
||||||
|
@ -1333,12 +1354,11 @@ async def display_symbol_data(
|
||||||
)
|
)
|
||||||
godwidget.resize_all()
|
godwidget.resize_all()
|
||||||
|
|
||||||
# hist_chart.hide()
|
await link_views_with_region(
|
||||||
# await link_views_with_region(
|
rt_chart,
|
||||||
# rt_chart,
|
hist_chart,
|
||||||
# hist_chart,
|
flume,
|
||||||
# flume,
|
)
|
||||||
# )
|
|
||||||
|
|
||||||
# start graphics update loop after receiving first live quote
|
# start graphics update loop after receiving first live quote
|
||||||
ln.start_soon(
|
ln.start_soon(
|
||||||
|
|
Loading…
Reference in New Issue