Whenever there is overlays, set a title on main chart price-y axis!
parent
106ebe94bf
commit
d027ad5a4f
|
@ -215,13 +215,17 @@ class PriceAxis(Axis):
|
||||||
# self.setLabel(title)
|
# self.setLabel(title)
|
||||||
# self.showLabel()
|
# self.showLabel()
|
||||||
|
|
||||||
label = self.title = Label(
|
label: Label | None = self.title
|
||||||
view=view or self.linkedView(),
|
if label is None:
|
||||||
fmt_str=title,
|
label = self.title = Label(
|
||||||
color=color or self.text_color,
|
view=view or self.linkedView(),
|
||||||
parent=self,
|
fmt_str=title,
|
||||||
# update_on_range_change=False,
|
color=color or self.text_color,
|
||||||
)
|
parent=self,
|
||||||
|
# update_on_range_change=False,
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
label.fmt_str: str = title
|
||||||
|
|
||||||
def below_axis() -> QPointF:
|
def below_axis() -> QPointF:
|
||||||
return QPointF(
|
return QPointF(
|
||||||
|
|
|
@ -1121,8 +1121,23 @@ class ChartPlotWidget(pg.PlotWidget):
|
||||||
# add axis title
|
# add axis title
|
||||||
# TODO: do we want this API to still work?
|
# TODO: do we want this API to still work?
|
||||||
# raxis = pi.getAxis('right')
|
# raxis = pi.getAxis('right')
|
||||||
axis = self.pi_overlay.get_axis(pi, axis_side)
|
overlay: PlotItemOverlay = self.pi_overlay
|
||||||
axis.set_title(axis_title or name, view=pi.getViewBox())
|
|
||||||
|
# Whenever overlays exist always add a y-axis label to the
|
||||||
|
# main axis as well!
|
||||||
|
for name, axis_info in self.plotItem.axes.items():
|
||||||
|
axis = axis_info['item']
|
||||||
|
if isinstance(axis, PriceAxis):
|
||||||
|
axis.set_title(self.linked.mkt.pair())
|
||||||
|
|
||||||
|
axis: PriceAxis = overlay.get_axis(
|
||||||
|
pi,
|
||||||
|
axis_side,
|
||||||
|
)
|
||||||
|
axis.set_title(
|
||||||
|
axis_title or name,
|
||||||
|
view=pi.getViewBox(),
|
||||||
|
)
|
||||||
|
|
||||||
return pi
|
return pi
|
||||||
|
|
||||||
|
@ -1213,11 +1228,13 @@ class ChartPlotWidget(pg.PlotWidget):
|
||||||
|
|
||||||
if add_sticky:
|
if add_sticky:
|
||||||
|
|
||||||
if pi is not self.plotItem:
|
main_pi: pgo.PlotItem = self.plotItem
|
||||||
|
if pi is not main_pi:
|
||||||
# overlay = self.pi_overlay
|
# overlay = self.pi_overlay
|
||||||
# assert pi in overlay.overlays
|
# assert pi in overlay.overlays
|
||||||
overlay = self.pi_overlay
|
overlay = self.pi_overlay
|
||||||
assert pi in overlay.overlays
|
assert pi in overlay.overlays
|
||||||
|
assert main_pi is overlay.root_plotitem
|
||||||
axis = overlay.get_axis(
|
axis = overlay.get_axis(
|
||||||
pi,
|
pi,
|
||||||
add_sticky,
|
add_sticky,
|
||||||
|
|
|
@ -1289,7 +1289,7 @@ async def display_symbol_data(
|
||||||
hist_ohlcv: ShmArray = flume.hist_shm
|
hist_ohlcv: ShmArray = flume.hist_shm
|
||||||
|
|
||||||
mkt: MktPair = flume.mkt
|
mkt: MktPair = flume.mkt
|
||||||
fqme = mkt.fqme
|
fqme: str = mkt.fqme
|
||||||
|
|
||||||
hist_chart = hist_linked.plot_ohlc_main(
|
hist_chart = hist_linked.plot_ohlc_main(
|
||||||
mkt,
|
mkt,
|
||||||
|
@ -1386,7 +1386,7 @@ async def display_symbol_data(
|
||||||
|
|
||||||
hist_pi = hist_chart.overlay_plotitem(
|
hist_pi = hist_chart.overlay_plotitem(
|
||||||
name=fqme,
|
name=fqme,
|
||||||
axis_title=fqme,
|
axis_title=flume.mkt.pair(),
|
||||||
)
|
)
|
||||||
|
|
||||||
hist_viz = hist_chart.draw_curve(
|
hist_viz = hist_chart.draw_curve(
|
||||||
|
@ -1416,7 +1416,7 @@ async def display_symbol_data(
|
||||||
|
|
||||||
rt_pi = rt_chart.overlay_plotitem(
|
rt_pi = rt_chart.overlay_plotitem(
|
||||||
name=fqme,
|
name=fqme,
|
||||||
axis_title=fqme,
|
axis_title=flume.mkt.pair(),
|
||||||
)
|
)
|
||||||
|
|
||||||
rt_viz = rt_chart.draw_curve(
|
rt_viz = rt_chart.draw_curve(
|
||||||
|
|
Loading…
Reference in New Issue