Skip to content

Commit

Permalink
Try to hide all axes even when removed
Browse files Browse the repository at this point in the history
  • Loading branch information
goodboy committed Feb 13, 2023
1 parent 878ff06 commit e36b491
Showing 1 changed file with 19 additions and 20 deletions.
39 changes: 19 additions & 20 deletions piker/ui/_chart.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,14 +116,6 @@ def __init__(

self.hbox.addLayout(self.vbox)

# self.toolbar_layout = QHBoxLayout()
# self.toolbar_layout.setContentsMargins(0, 0, 0, 0)
# self.vbox.addLayout(self.toolbar_layout)

# self.init_timeframes_ui()
# self.init_strategy_ui()
# self.vbox.addLayout(self.hbox)

self._chart_cache: dict[
str,
tuple[LinkedSplits, LinkedSplits],
Expand All @@ -143,15 +135,18 @@ def __init__(
# and the window does not? Never right?!
# self.reg_for_resize(self)

@property
def linkedsplits(self) -> LinkedSplits:
return self.rt_linked

# XXX: strat loader/saver that we don't need yet.
# TODO: strat loader/saver that we don't need yet.
# def init_strategy_ui(self):
# self.toolbar_layout = QHBoxLayout()
# self.toolbar_layout.setContentsMargins(0, 0, 0, 0)
# self.vbox.addLayout(self.toolbar_layout)
# self.strategy_box = StrategyBoxWidget(self)
# self.toolbar_layout.addWidget(self.strategy_box)

@property
def linkedsplits(self) -> LinkedSplits:
return self.rt_linked

def set_chart_symbols(
self,
group_key: tuple[str], # of form <fqsn>.<providername>
Expand Down Expand Up @@ -432,7 +427,7 @@ def __init__(

self.godwidget = godwidget
self.chart: ChartPlotWidget = None # main (ohlc) chart
self.subplots: dict[tuple[str, ...], ChartPlotWidget] = {}
self.subplots: dict[str, ChartPlotWidget] = {}

self.godwidget = godwidget
# placeholder for last appended ``PlotItem``'s bottom axis.
Expand Down Expand Up @@ -1058,6 +1053,7 @@ def increment_view(
# breakpoint()
return

# should trigger broadcast on all overlays right?
view.setXRange(
min=l + x_shift,
max=r + x_shift,
Expand Down Expand Up @@ -1107,12 +1103,6 @@ def overlay_plotitem(
pi.chart_widget = self
pi.hideButtons()

# hide all axes not named by ``axis_side``
for axname in (
({'bottom'} | allowed_sides) - {axis_side}
):
pi.hideAxis(axname)

# compose this new plot's graphics with the current chart's
# existing one but with separate axes as neede and specified.
self.pi_overlay.add_plotitem(
Expand All @@ -1126,6 +1116,15 @@ def overlay_plotitem(
link_axes=(0,),
)

# hide all axes not named by ``axis_side``
for axname in (
({'bottom'} | allowed_sides) - {axis_side}
):
try:
pi.hideAxis(axname)
except Exception:
pass

# add axis title
# TODO: do we want this API to still work?
# raxis = pi.getAxis('right')
Expand Down

0 comments on commit e36b491

Please sign in to comment.