Facepalm, align overlay plot view exactly to parent

Previously we were aligning the child's `PlotItem` to the "root" (top
most) overlays `ViewBox`..smh. This is why there was a weird gap on the
LHS next to the 'left' price axes: something weird in the implied axes
offsets was getting jammed in that rect.

Also comments out "the-skipping-of" moving axes from the overlay's
`PlotItem.layout` to the root's linear layout(s) when an overlay's axis
is read as not visible; this isn't really necessary nor useful and if we
want to remove the axes entirely we should do it explicitly and/or
provide a way through the `ComposeGridLayout` API.
log_linearized_curve_overlays
Tyler Goodlet 2023-02-11 15:36:02 -05:00
parent 3dc1f66ff6
commit a6d1053c50
1 changed files with 14 additions and 13 deletions

View File

@ -201,18 +201,19 @@ class ComposedGridLayout:
axis_view = axis.linkedView()
assert axis_view is plotitem.vb
if (
not axis.isVisible()
# if (
# not axis.isVisible()
# XXX: we never skip moving the axes for the *root*
# plotitem inserted (even if not shown) since we need to
# move all the hidden axes into linear sub-layouts for
# that "central" plot in the overlay. Also if we don't
# do it there's weird geomoetry calc offsets that make
# view coords slightly off somehow .. smh
and not len(self.pitems) == 0
):
continue
# # XXX: we never skip moving the axes for the *root*
# # plotitem inserted (even if not shown) since we need to
# # move all the hidden axes into linear sub-layouts for
# # that "central" plot in the overlay. Also if we don't
# # do it there's weird geomoetry calc offsets that make
# # view coords slightly off somehow .. smh
# and not len(self.pitems) == 0
# ):
# print(f'SKIPPING MOVE: {plotitem.name}:{name} -> {axis}')
# continue
# invert insert index for layouts which are
# not-left-to-right, top-to-bottom insert oriented
@ -498,10 +499,10 @@ class PlotItemOverlay:
else:
insert_index, axes = self.layout.insert_plotitem(index, plotitem)
plotitem.setGeometry(root.vb.sceneBoundingRect())
plotitem.vb.setGeometry(root.vb.sceneBoundingRect())
def size_to_viewbox(vb: 'ViewBox'):
plotitem.setGeometry(vb.sceneBoundingRect())
plotitem.vb.setGeometry(root.vb.sceneBoundingRect())
root.vb.sigResized.connect(size_to_viewbox)