Add draft but commented "scale-to-fast-chart" logic

history_view
Tyler Goodlet 2022-09-14 10:11:43 -04:00
parent 286f620f8e
commit a61a11f86b
1 changed files with 22 additions and 3 deletions

View File

@ -910,7 +910,7 @@ async def display_symbol_data(
pen=pg.mkPen(hcolor('gunmetal')), pen=pg.mkPen(hcolor('gunmetal')),
brush=pg.mkBrush(hcolor('default_darkest')), brush=pg.mkBrush(hcolor('default_darkest')),
) )
region.setZValue(10) region.setZValue(10) # put linear region "in front" in layer terms
hist_pi.addItem(region, ignoreBounds=True) hist_pi.addItem(region, ignoreBounds=True)
flow = chart._flows[hist_chart.name] flow = chart._flows[hist_chart.name]
assert flow assert flow
@ -948,6 +948,7 @@ async def display_symbol_data(
window, window,
viewRange: tuple[tuple, tuple], viewRange: tuple[tuple, tuple],
is_manual: bool = True, is_manual: bool = True,
) -> None: ) -> None:
# 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
@ -959,11 +960,29 @@ async def display_symbol_data(
# f'rt_view_range: {(mn, mx)}\n' # f'rt_view_range: {(mn, mx)}\n'
# f'ds_mn, ds_mx: {(ds_mn, ds_mx)}\n' # f'ds_mn, ds_mx: {(ds_mn, ds_mx)}\n'
# ) # )
lhmn = ds_mn + end_index
lhmx = ds_mx + end_index
region.setRegion(( region.setRegion((
ds_mn + end_index, lhmn,
ds_mx + end_index, lhmx,
)) ))
# TODO: if we want to have the slow chart adjust range to
# match the fast chart's selection -> results in the
# linear region expansion never can go "outside of view".
# hmn, hmx = hvr = hist_chart.view.state['viewRange'][0]
# print((hmn, hmx))
# if (
# hvr
# and (lhmn < hmn or lhmx > hmx)
# ):
# hist_pi.setXRange(
# lhmn,
# lhmx,
# padding=0,
# )
# hist_linked.graphics_cycle()
# connect region to be updated on plotitem interaction. # connect region to be updated on plotitem interaction.
rt_pi.sigRangeChanged.connect(update_region_from_pi) rt_pi.sigRangeChanged.connect(update_region_from_pi)