From 2a086db30e33a166cc266e2afe6c9e23b92d6e46 Mon Sep 17 00:00:00 2001 From: tehcoderer Date: Fri, 21 Jul 2023 20:45:07 -0400 Subject: [PATCH] limit rangebreaks --- openbb_terminal/core/plots/plotly_helper.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/openbb_terminal/core/plots/plotly_helper.py b/openbb_terminal/core/plots/plotly_helper.py index 0fa0d73cae6..a28b47975f1 100644 --- a/openbb_terminal/core/plots/plotly_helper.py +++ b/openbb_terminal/core/plots/plotly_helper.py @@ -1300,10 +1300,9 @@ class OpenBBFigure(go.Figure): "col": col, "secondary_y": secondary_y, } - if trace.type != "scatter": - self._subplot_xdates.setdefault(row, {}).setdefault( - col, [] - ).append(trace.x) + self._subplot_xdates.setdefault(row, {}).setdefault( + col, [] + ).append(trace.x) # We convert the dateindex to a list of datetime objects if it's a numpy array if output is not None and isinstance(output[0], np.datetime64): @@ -1332,6 +1331,7 @@ class OpenBBFigure(go.Figure): """ # We get the min and max dates dt_start, dt_end = df_data.index.min(), df_data.index.max() + rangebreaks: List[Dict[str, Any]] = [] # if weekly or monthly data, we don't need to hide gaps # this prevents distortions in the plot @@ -1348,7 +1348,8 @@ class OpenBBFigure(go.Figure): ) dt_missing_days = pd.to_datetime(dt_missing_days) - rangebreaks: List[Dict[str, Any]] = [dict(values=dt_missing_days)] + if len(dt_missing_days) < 2_000: + rangebreaks: List[Dict[str, Any]] = [dict(values=dt_missing_days)] # We get the frequency of the data to hide intra-day gaps if df_data.index[-1].time() != df_data.index[-2].time():