diff --git a/openbb_terminal/common/behavioural_analysis/reddit_view.py b/openbb_terminal/common/behavioural_analysis/reddit_view.py index 7af722d49ea..291a2a22f5b 100644 --- a/openbb_terminal/common/behavioural_analysis/reddit_view.py +++ b/openbb_terminal/common/behavioural_analysis/reddit_view.py @@ -3,6 +3,7 @@ __docformat__ = "numpy" import logging import os +import textwrap from datetime import datetime from typing import Dict, Optional, Union @@ -24,9 +25,6 @@ from openbb_terminal.rich_config import console logger = logging.getLogger(__name__) -# TODO: Test OpenBBFigure conversion - - @log_start_end(log=logger) @check_api_key(reddit_requirements) def print_and_record_reddit_post( @@ -313,11 +311,19 @@ def display_redditsent( console.print(f"Sentiment Analysis for {symbol} is {avg_polarity}\n") if graphic: + df["Title"] = df["Title"].apply( + lambda x: "
".join(textwrap.wrap(str(x), 50)) + ) fig = OpenBBFigure( title=f"Sentiment Score of {symbol}", xaxis_title="Sentiment Score", ) - fig.add_bar(x=polarity_scores) + fig.add_bar( + x=polarity_scores, + customdata=df["Title"], + hovertemplate="%{customdata}", + ) + fig.update_layout(hovermode="y") # remove y ticks of graph object because number based index doesn't make sense here fig.layout.yaxis.tickvals = [] diff --git a/openbb_terminal/core/plots/plotly.html b/openbb_terminal/core/plots/plotly.html index 484a442f61b..39e1c8a4be2 100644 --- a/openbb_terminal/core/plots/plotly.html +++ b/openbb_terminal/core/plots/plotly.html @@ -56,7 +56,7 @@
@@ -71,37 +71,42 @@