diff options
author | teh_coderer <me@tehcoderer.com> | 2023-06-01 15:30:57 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-01 19:30:57 +0000 |
commit | 67e04610d88f5326890535269411cb1d40662d0b (patch) | |
tree | 99d98e20f5dbdf80a79cbe03a7abab5f3c6c53f6 | |
parent | 15397938621e55ea20aeccae506815dd891e34a3 (diff) |
Update plotly_helper.py (#5098)
-rw-r--r-- | openbb_terminal/core/plots/plotly_helper.py | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/openbb_terminal/core/plots/plotly_helper.py b/openbb_terminal/core/plots/plotly_helper.py index 0ede57301e6..89e8f6b79a6 100644 --- a/openbb_terminal/core/plots/plotly_helper.py +++ b/openbb_terminal/core/plots/plotly_helper.py @@ -1126,11 +1126,13 @@ class OpenBBFigure(go.Figure): def _xaxis_tickformatstops(self) -> None: """Set the datetickformatstops for the xaxis if the x data is datetime.""" - if (dateindex := self.get_dateindex()) is None: + if (dateindex := self.get_dateindex()) is None or list( + self.select_xaxes(lambda x: hasattr(x, "tickformat") and x.tickformat) + ): return tickformatstops = [ - dict(dtickrange=[None, 86_400_000], value="%I%p\n%b,%d"), + dict(dtickrange=[None, 86_400_000], value="%I:%M%p\n%b,%d"), dict(dtickrange=[86_400_000, 604_800_000], value="%Y-%m-%d"), ] xhoverformat = "%I:%M%p %Y-%m-%d" @@ -1149,7 +1151,9 @@ class OpenBBFigure(go.Figure): dict(dtickrange=["M1", None], value="%Y-%m-%d"), ], type="date", - selector=dict(anchor=entry["yaxis"]), + row=entry["row"], + col=entry["col"], + tick0=0.5, ) self.update_traces( xhoverformat=xhoverformat, selector=dict(name=entry["name"]) @@ -1223,6 +1227,8 @@ class OpenBBFigure(go.Figure): self._date_xaxs[trace.xaxis] = { "yaxis": trace.yaxis, "name": name, + "row": row, + "col": col, "secondary_y": secondary_y, } self._subplot_xdates.setdefault(row, {}).setdefault( |