Iterate all charts (widgets) when only one overlay

The reason (fsp) subcharts were not linked-updating correctly was
because of the early termination of the interact update loop when only
one "overlay" (aka no other overlays then the main curve) is detected.
Obviously in this case we still need to iterate all linked charts in the
set (presuming the user doesn't disable this).

Also tweaks a few internals:
- rename `start_datums: dict` -> `overlay_table`.
- compact all "single curve" checks to one logic block.
- don't collect curve info into the `overlay_table: dict` when
  `do_overlay_scaling=True`.
log_linearized_curve_overlays
Tyler Goodlet 2023-02-06 16:52:27 -05:00
parent 25cf8df367
commit 6ea64a7d2e
1 changed files with 27 additions and 14 deletions

View File

@ -951,7 +951,7 @@ class ChartView(ViewBox):
def interact_graphics_cycle( def interact_graphics_cycle(
self, self,
*args, # capture signal-handler related shit *args, # capture Qt signal (slot) inputs
debug_print: bool = False, debug_print: bool = False,
do_overlay_scaling: bool = True, do_overlay_scaling: bool = True,
@ -1017,7 +1017,7 @@ class ChartView(ViewBox):
# determine auto-ranging input for `._set_yrange()`. # determine auto-ranging input for `._set_yrange()`.
# this is primarly used for our so called "log-linearized # this is primarly used for our so called "log-linearized
# multi-plot" overlay technique. # multi-plot" overlay technique.
start_datums: dict[ overlay_table: dict[
ViewBox, ViewBox,
tuple[ tuple[
Viz, Viz,
@ -1032,6 +1032,10 @@ class ChartView(ViewBox):
major_in_view: np.ndarray = None major_in_view: np.ndarray = None
for name, viz in chart._vizs.items(): for name, viz in chart._vizs.items():
if debug_print:
print(
f'UX GRAPHICS CYCLE: {viz.name}@{chart_name}'
)
if not viz.render: if not viz.render:
# print(f'skipping {flow.name}') # print(f'skipping {flow.name}')
@ -1087,12 +1091,15 @@ class ChartView(ViewBox):
ymn, ymx = yrange ymn, ymx = yrange
# print(f'adding {viz.name} to overlay') # print(f'adding {viz.name} to overlay')
if not do_overlay_scaling:
continue
# determine start datum in view # determine start datum in view
arr = viz.shm.array arr = viz.shm.array
in_view = arr[read_slc] in_view = arr[read_slc]
if not in_view.size: if not in_view.size:
log.warning(f'{viz.name} not in view?') log.warning(f'{viz.name} not in view?')
return continue
row_start = arr[read_slc.start - 1] row_start = arr[read_slc.start - 1]
@ -1103,7 +1110,7 @@ class ChartView(ViewBox):
profiler(f'{viz.name}@{chart_name} MINOR curve median') profiler(f'{viz.name}@{chart_name} MINOR curve median')
start_datums[viz.plot.vb] = ( overlay_table[viz.plot.vb] = (
viz, viz,
y_start, y_start,
ymn, ymn,
@ -1152,16 +1159,20 @@ class ChartView(ViewBox):
f'{viz.name}@{chart_name} simple std `._set_yrange()`' f'{viz.name}@{chart_name} simple std `._set_yrange()`'
) )
profiler(f'<{chart_name}>.interact_graphics_cycle({name})') # NOTE: if no overlay group scaling is wanted by caller, or
if not start_datums: # there were no overlay charts detected/collected, (could be
return # either no group detected or chart with a single symbol,
# thus a single viz/overlay) then we ONLY set the lone
# if no overlays, set lone chart's yrange and short circuit # chart's (viz) yrange and short circuit to the next chart
# in the linked charts sequence.
if ( if (
len(start_datums) < 2 not do_overlay_scaling
or not do_overlay_scaling or len(overlay_table) < 2
or not overlay_table
): ):
# print(f'ONLY ranging major: {viz.name}') if debug_print:
print(f'ONLY ranging major: {viz.name}')
if not major_viz: if not major_viz:
major_viz = viz major_viz = viz
@ -1169,7 +1180,9 @@ class ChartView(ViewBox):
yrange=yrange, yrange=yrange,
) )
profiler(f'{viz.name}@{chart_name} single curve yrange') profiler(f'{viz.name}@{chart_name} single curve yrange')
return continue
profiler(f'<{chart_name}>.interact_graphics_cycle({name})')
# conduct "log-linearized multi-plot" scalings for all groups # conduct "log-linearized multi-plot" scalings for all groups
for ( for (
@ -1183,7 +1196,7 @@ class ChartView(ViewBox):
read_slc, read_slc,
minor_in_view, minor_in_view,
) )
) in start_datums.items(): ) in overlay_table.items():
# we use the ymn/mx verbatim from the major curve # we use the ymn/mx verbatim from the major curve
# (i.e. the curve measured to have the highest # (i.e. the curve measured to have the highest