Skip to content

Commit b56d178

Browse files
committed
Try to hide all axes even when removed
1 parent b9cc3d4 commit b56d178

File tree

1 file changed

+19
-20
lines changed

1 file changed

+19
-20
lines changed

piker/ui/_chart.py

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -116,14 +116,6 @@ def __init__(
116116

117117
self.hbox.addLayout(self.vbox)
118118

119-
# self.toolbar_layout = QHBoxLayout()
120-
# self.toolbar_layout.setContentsMargins(0, 0, 0, 0)
121-
# self.vbox.addLayout(self.toolbar_layout)
122-
123-
# self.init_timeframes_ui()
124-
# self.init_strategy_ui()
125-
# self.vbox.addLayout(self.hbox)
126-
127119
self._chart_cache: dict[
128120
str,
129121
tuple[LinkedSplits, LinkedSplits],
@@ -143,15 +135,18 @@ def __init__(
143135
# and the window does not? Never right?!
144136
# self.reg_for_resize(self)
145137

146-
@property
147-
def linkedsplits(self) -> LinkedSplits:
148-
return self.rt_linked
149-
150-
# XXX: strat loader/saver that we don't need yet.
138+
# TODO: strat loader/saver that we don't need yet.
151139
# def init_strategy_ui(self):
140+
# self.toolbar_layout = QHBoxLayout()
141+
# self.toolbar_layout.setContentsMargins(0, 0, 0, 0)
142+
# self.vbox.addLayout(self.toolbar_layout)
152143
# self.strategy_box = StrategyBoxWidget(self)
153144
# self.toolbar_layout.addWidget(self.strategy_box)
154145

146+
@property
147+
def linkedsplits(self) -> LinkedSplits:
148+
return self.rt_linked
149+
155150
def set_chart_symbols(
156151
self,
157152
group_key: tuple[str], # of form <fqsn>.<providername>
@@ -432,7 +427,7 @@ def __init__(
432427

433428
self.godwidget = godwidget
434429
self.chart: ChartPlotWidget = None # main (ohlc) chart
435-
self.subplots: dict[tuple[str, ...], ChartPlotWidget] = {}
430+
self.subplots: dict[str, ChartPlotWidget] = {}
436431

437432
self.godwidget = godwidget
438433
# placeholder for last appended ``PlotItem``'s bottom axis.
@@ -1058,6 +1053,7 @@ def increment_view(
10581053
# breakpoint()
10591054
return
10601055

1056+
# should trigger broadcast on all overlays right?
10611057
view.setXRange(
10621058
min=l + x_shift,
10631059
max=r + x_shift,
@@ -1107,12 +1103,6 @@ def overlay_plotitem(
11071103
pi.chart_widget = self
11081104
pi.hideButtons()
11091105

1110-
# hide all axes not named by ``axis_side``
1111-
for axname in (
1112-
({'bottom'} | allowed_sides) - {axis_side}
1113-
):
1114-
pi.hideAxis(axname)
1115-
11161106
# compose this new plot's graphics with the current chart's
11171107
# existing one but with separate axes as neede and specified.
11181108
self.pi_overlay.add_plotitem(
@@ -1126,6 +1116,15 @@ def overlay_plotitem(
11261116
link_axes=(0,),
11271117
)
11281118

1119+
# hide all axes not named by ``axis_side``
1120+
for axname in (
1121+
({'bottom'} | allowed_sides) - {axis_side}
1122+
):
1123+
try:
1124+
pi.hideAxis(axname)
1125+
except Exception:
1126+
pass
1127+
11291128
# add axis title
11301129
# TODO: do we want this API to still work?
11311130
# raxis = pi.getAxis('right')

0 commit comments

Comments
 (0)