Add back linked plots/views y-range autoscaling
parent
8ce7e99210
commit
42572d3808
|
@ -570,6 +570,13 @@ class ChartView(ViewBox):
|
||||||
self._resetTarget()
|
self._resetTarget()
|
||||||
self.scaleBy(s, focal)
|
self.scaleBy(s, focal)
|
||||||
|
|
||||||
|
# XXX: the order of the next 2 lines i'm pretty sure
|
||||||
|
# matters, we want the resize to trigger before the graphics
|
||||||
|
# update, but i gotta feelin that because this one is signal
|
||||||
|
# based (and thus not necessarily sync invoked right away)
|
||||||
|
# that calling the resize method manually might work better.
|
||||||
|
self.sigRangeChangedManually.emit(mask)
|
||||||
|
|
||||||
# XXX: without this is seems as though sometimes
|
# XXX: without this is seems as though sometimes
|
||||||
# when zooming in from far out (and maybe vice versa?)
|
# when zooming in from far out (and maybe vice versa?)
|
||||||
# the signal isn't being fired enough since if you pan
|
# the signal isn't being fired enough since if you pan
|
||||||
|
@ -580,12 +587,6 @@ class ChartView(ViewBox):
|
||||||
# fires don't happen?
|
# fires don't happen?
|
||||||
self.maybe_downsample_graphics()
|
self.maybe_downsample_graphics()
|
||||||
|
|
||||||
self.sigRangeChangedManually.emit(mask)
|
|
||||||
|
|
||||||
# self._ic.set()
|
|
||||||
# self._ic = None
|
|
||||||
# self.chart.resume_all_feeds()
|
|
||||||
|
|
||||||
ev.accept()
|
ev.accept()
|
||||||
|
|
||||||
def mouseDragEvent(
|
def mouseDragEvent(
|
||||||
|
@ -746,7 +747,7 @@ class ChartView(ViewBox):
|
||||||
|
|
||||||
# flag to prevent triggering sibling charts from the same linked
|
# flag to prevent triggering sibling charts from the same linked
|
||||||
# set from recursion errors.
|
# set from recursion errors.
|
||||||
autoscale_linked_plots: bool = False,
|
autoscale_linked_plots: bool = True,
|
||||||
name: Optional[str] = None,
|
name: Optional[str] = None,
|
||||||
# autoscale_overlays: bool = False,
|
# autoscale_overlays: bool = False,
|
||||||
|
|
||||||
|
@ -759,6 +760,7 @@ class ChartView(ViewBox):
|
||||||
data set.
|
data set.
|
||||||
|
|
||||||
'''
|
'''
|
||||||
|
# print(f'YRANGE ON {self.name}')
|
||||||
profiler = pg.debug.Profiler(
|
profiler = pg.debug.Profiler(
|
||||||
msg=f'`ChartView._set_yrange()`: `{self.name}`',
|
msg=f'`ChartView._set_yrange()`: `{self.name}`',
|
||||||
disabled=not pg_profile_enabled(),
|
disabled=not pg_profile_enabled(),
|
||||||
|
@ -788,42 +790,11 @@ class ChartView(ViewBox):
|
||||||
elif yrange is not None:
|
elif yrange is not None:
|
||||||
ylow, yhigh = yrange
|
ylow, yhigh = yrange
|
||||||
|
|
||||||
# calculate max, min y values in viewable x-range from data.
|
|
||||||
# Make sure min bars/datums on screen is adhered.
|
|
||||||
# else:
|
|
||||||
# TODO: eventually we should point to the
|
|
||||||
# ``FlowsTable`` (or wtv) which should perform
|
|
||||||
# the group operations?
|
|
||||||
|
|
||||||
# flow = chart._flows[name or chart.name]
|
|
||||||
# br = bars_range or chart.bars_range()
|
|
||||||
# br = bars_range or chart.bars_range()
|
|
||||||
# profiler(f'got bars range: {br}')
|
|
||||||
|
|
||||||
# TODO: maybe should be a method on the
|
|
||||||
# chart widget/item?
|
|
||||||
# if False:
|
|
||||||
# if autoscale_linked_plots:
|
|
||||||
# # avoid recursion by sibling plots
|
|
||||||
# linked = self.linkedsplits
|
|
||||||
# plots = list(linked.subplots.copy().values())
|
|
||||||
# main = linked.chart
|
|
||||||
# if main:
|
|
||||||
# plots.append(main)
|
|
||||||
|
|
||||||
# for chart in plots:
|
|
||||||
# if chart and not chart._static_yrange:
|
|
||||||
# chart.cv._set_yrange(
|
|
||||||
# # bars_range=br,
|
|
||||||
# autoscale_linked_plots=False,
|
|
||||||
# )
|
|
||||||
# profiler('autoscaled linked plots')
|
|
||||||
|
|
||||||
if set_range:
|
if set_range:
|
||||||
|
|
||||||
if not yrange:
|
|
||||||
# XXX: only compute the mxmn range
|
# XXX: only compute the mxmn range
|
||||||
# if none is provided as input!
|
# if none is provided as input!
|
||||||
|
if not yrange:
|
||||||
yrange = self._maxmin()
|
yrange = self._maxmin()
|
||||||
|
|
||||||
if yrange is None:
|
if yrange is None:
|
||||||
|
@ -850,6 +821,25 @@ class ChartView(ViewBox):
|
||||||
self.setYRange(ylow, yhigh)
|
self.setYRange(ylow, yhigh)
|
||||||
profiler(f'set limits: {(ylow, yhigh)}')
|
profiler(f'set limits: {(ylow, yhigh)}')
|
||||||
|
|
||||||
|
# TODO: maybe should be a method on the
|
||||||
|
# chart widget/item?
|
||||||
|
if autoscale_linked_plots:
|
||||||
|
# avoid recursion by sibling plots
|
||||||
|
linked = self.linkedsplits
|
||||||
|
plots = list(linked.subplots.copy().values())
|
||||||
|
main = linked.chart
|
||||||
|
if main:
|
||||||
|
plots.append(main)
|
||||||
|
|
||||||
|
# print(f'autoscaling linked: {plots}')
|
||||||
|
for chart in plots:
|
||||||
|
if chart and not chart._static_yrange:
|
||||||
|
chart.cv._set_yrange(
|
||||||
|
# bars_range=br,
|
||||||
|
autoscale_linked_plots=False,
|
||||||
|
)
|
||||||
|
profiler('autoscaled linked plots')
|
||||||
|
|
||||||
profiler.finish()
|
profiler.finish()
|
||||||
|
|
||||||
def enable_auto_yrange(
|
def enable_auto_yrange(
|
||||||
|
|
Loading…
Reference in New Issue