Adjust remaining chart internals to pg extensions
Mainly this involves instantiating our overriden `PlotItem` in a few places and tweaking type annots. A further detail is that inside the fsp sub-chart creation code we hide some axes for overlays in the flows subchart; these were previously somehow hidden implicitly?pg_exts_fork
parent
b524ea5c22
commit
be24473fb4
|
@ -78,6 +78,8 @@ async def _async_main(
|
|||
|
||||
"""
|
||||
from . import _display
|
||||
from ._pg_overrides import _do_overrides
|
||||
_do_overrides()
|
||||
|
||||
godwidget = main_widget
|
||||
|
||||
|
|
|
@ -73,6 +73,8 @@ from .._profile import pg_profile_enabled, ms_slower_then
|
|||
from ._overlay import PlotItemOverlay
|
||||
from ._flows import Flow
|
||||
from ._search import SearchWidget
|
||||
from . import _pg_overrides as pgo
|
||||
from .._profile import Profiler
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from ._display import DisplayState
|
||||
|
@ -831,6 +833,7 @@ class ChartPlotWidget(pg.PlotWidget):
|
|||
|
||||
static_yrange: Optional[tuple[float, float]] = None,
|
||||
|
||||
parent=None,
|
||||
**kwargs,
|
||||
):
|
||||
'''
|
||||
|
@ -848,12 +851,15 @@ class ChartPlotWidget(pg.PlotWidget):
|
|||
# source of our custom interactions
|
||||
self.cv = cv = self.mk_vb(name)
|
||||
|
||||
pi = pgo.PlotItem(viewBox=cv, **kwargs)
|
||||
super().__init__(
|
||||
background=hcolor(view_color),
|
||||
viewBox=cv,
|
||||
# parent=None,
|
||||
# plotItem=None,
|
||||
# antialias=True,
|
||||
parent=parent,
|
||||
plotItem=pi,
|
||||
**kwargs
|
||||
)
|
||||
# give viewbox as reference to chart
|
||||
|
@ -1144,7 +1150,7 @@ class ChartPlotWidget(pg.PlotWidget):
|
|||
axis_side: str = 'right',
|
||||
axis_kwargs: dict = {},
|
||||
|
||||
) -> pg.PlotItem:
|
||||
) -> pgo.PlotItem:
|
||||
|
||||
# Custom viewbox impl
|
||||
cv = self.mk_vb(name)
|
||||
|
@ -1153,13 +1159,14 @@ class ChartPlotWidget(pg.PlotWidget):
|
|||
allowed_sides = {'left', 'right'}
|
||||
if axis_side not in allowed_sides:
|
||||
raise ValueError(f'``axis_side``` must be in {allowed_sides}')
|
||||
|
||||
yaxis = PriceAxis(
|
||||
orientation=axis_side,
|
||||
linkedsplits=self.linked,
|
||||
**axis_kwargs,
|
||||
)
|
||||
|
||||
pi = pg.PlotItem(
|
||||
pi = pgo.PlotItem(
|
||||
parent=self.plotItem,
|
||||
name=name,
|
||||
enableMenu=False,
|
||||
|
@ -1246,7 +1253,7 @@ class ChartPlotWidget(pg.PlotWidget):
|
|||
|
||||
# TODO: this probably needs its own method?
|
||||
if overlay:
|
||||
if isinstance(overlay, pg.PlotItem):
|
||||
if isinstance(overlay, pgo.PlotItem):
|
||||
if overlay not in self.pi_overlay.overlays:
|
||||
raise RuntimeError(
|
||||
f'{overlay} must be from `.plotitem_overlay()`'
|
||||
|
@ -1405,7 +1412,7 @@ class ChartPlotWidget(pg.PlotWidget):
|
|||
If ``bars_range`` is provided use that range.
|
||||
|
||||
'''
|
||||
profiler = pg.debug.Profiler(
|
||||
profiler = Profiler(
|
||||
msg=f'`{str(self)}.maxmin(name={name})`: `{self.name}`',
|
||||
disabled=not pg_profile_enabled(),
|
||||
ms_threshold=ms_slower_then,
|
||||
|
|
|
@ -59,6 +59,7 @@ from ..fsp._volume import (
|
|||
flow_rates,
|
||||
)
|
||||
from ..log import get_logger
|
||||
from .._profile import Profiler
|
||||
|
||||
log = get_logger(__name__)
|
||||
|
||||
|
@ -190,7 +191,7 @@ async def open_fsp_actor_cluster(
|
|||
|
||||
from tractor._clustering import open_actor_cluster
|
||||
|
||||
# profiler = pg.debug.Profiler(
|
||||
# profiler = Profiler(
|
||||
# delayed=False,
|
||||
# disabled=False
|
||||
# )
|
||||
|
@ -212,7 +213,7 @@ async def run_fsp_ui(
|
|||
target: Fsp,
|
||||
conf: dict[str, dict],
|
||||
loglevel: str,
|
||||
# profiler: pg.debug.Profiler,
|
||||
# profiler: Profiler,
|
||||
# _quote_throttle_rate: int = 58,
|
||||
|
||||
) -> None:
|
||||
|
@ -746,6 +747,8 @@ async def open_vlm_displays(
|
|||
},
|
||||
)
|
||||
|
||||
dvlm_pi.hideAxis('left')
|
||||
dvlm_pi.hideAxis('bottom')
|
||||
# all to be overlayed curve names
|
||||
fields = [
|
||||
'dolla_vlm',
|
||||
|
@ -878,6 +881,7 @@ async def open_vlm_displays(
|
|||
# keep both regular and dark vlm in view
|
||||
names=trade_rate_fields,
|
||||
)
|
||||
tr_pi.hideAxis('bottom')
|
||||
|
||||
chart_curves(
|
||||
trade_rate_fields,
|
||||
|
@ -951,7 +955,7 @@ async def start_fsp_displays(
|
|||
# },
|
||||
# },
|
||||
}
|
||||
profiler = pg.debug.Profiler(
|
||||
profiler = Profiler(
|
||||
delayed=False,
|
||||
disabled=False
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue