From a39c980266f50ce7ea3546e3af6dbd749771fee2 Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Mon, 14 Nov 2022 16:52:48 -0500 Subject: [PATCH] Allocate our internal `Axis` subtype in our `PlotItem` override --- piker/ui/_pg_overrides.py | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/piker/ui/_pg_overrides.py b/piker/ui/_pg_overrides.py index a961e567..397954fd 100644 --- a/piker/ui/_pg_overrides.py +++ b/piker/ui/_pg_overrides.py @@ -26,6 +26,8 @@ from typing import Optional import pyqtgraph as pg +from ._axes import Axis + def invertQTransform(tr): """Return a QTransform that is the inverse of *tr*. @@ -62,6 +64,20 @@ class PlotItem(pg.PlotItem): Overrides for the core plot object mostly pertaining to overlayed multi-view management as it relates to multi-axis managment. + This object is the combination of a ``ViewBox`` and multiple + ``AxisItem``s and so far we've added additional functionality and + APIs for: + - removal of axes + + --- + + From ``pyqtgraph`` super type docs: + - Manage placement of ViewBox, AxisItems, and LabelItems + - Create and manage a list of PlotDataItems displayed inside the + ViewBox + - Implement a context menu with commonly used display and analysis + options + ''' def __init__( self, @@ -86,6 +102,8 @@ class PlotItem(pg.PlotItem): enableMenu=enableMenu, kargs=kargs, ) + self.name = name + self.chart_widget = None # self.setAxisItems( # axisItems, # default_axes=default_axes, @@ -209,7 +227,12 @@ class PlotItem(pg.PlotItem): # adding this is without it there's some weird # ``ViewBox`` geometry bug.. where a gap for the # 'bottom' axis is somehow left in? - axis = pg.AxisItem(orientation=name, parent=self) + # axis = pg.AxisItem(orientation=name, parent=self) + axis = Axis( + self, + orientation=name, + parent=self, + ) axis.linkToView(self.vb)