From 30ca6c69e0e552f4fefe2a563d5e35f13aabd52a Mon Sep 17 00:00:00 2001 From: teh_coderer Date: Wed, 29 Mar 2023 12:51:02 -0500 Subject: [PATCH] Hotfix/options plot-smile (#4613) * init * Update style.css * oops was stashed * Update popups.js * bump plotly.js version * fix disappearing modebar --- openbb_terminal/core/plots/backend.py | 10 ++- openbb_terminal/core/plots/plotly.html | 15 +++-- openbb_terminal/core/plots/plotly_helper.py | 2 +- openbb_terminal/core/plots/web/bar_menus.js | 2 +- openbb_terminal/core/plots/web/css/style.css | 26 ++++--- openbb_terminal/core/plots/web/main.js | 67 ++++++++++++------- openbb_terminal/core/plots/web/popups.js | 2 +- .../stocks/options/yfinance_view.py | 50 ++++++++++---- 8 files changed, 114 insertions(+), 60 deletions(-) diff --git a/openbb_terminal/core/plots/backend.py b/openbb_terminal/core/plots/backend.py index bff1f179570..79d70ee4f81 100644 --- a/openbb_terminal/core/plots/backend.py +++ b/openbb_terminal/core/plots/backend.py @@ -48,7 +48,7 @@ else: JUPYTER_NOTEBOOK = True PLOTS_CORE_PATH = Path(__file__).parent.resolve() -PLOTLYJS_PATH = PLOTS_CORE_PATH / "assets" / "plotly-2.18.2.min.js" +PLOTLYJS_PATH = PLOTS_CORE_PATH / "assets" / "plotly-2.20.0.min.js" BACKEND = None @@ -93,7 +93,9 @@ class Backend(PyWry): try: with open(PLOTS_CORE_PATH / "plotly.html", encoding="utf-8") as file: # type: ignore html = file.read() - html = html.replace("{{MAIN_PATH}}", str(PLOTS_CORE_PATH.as_uri())) + html = html.replace( + "{{MAIN_PATH}}", str(PLOTS_CORE_PATH.as_uri()) + ).replace("{{PLOTLYJS_PATH}}", str(PLOTLYJS_PATH.as_uri())) # We create a temporary file to inject the path to the script tag # This is so we don't have to modify the original file @@ -374,7 +376,9 @@ async def download_plotly_js(): try: # we use aiohttp to download plotly.js # this is so we don't have to block the main thread - async with aiohttp.ClientSession() as session: + async with aiohttp.ClientSession( + connector=aiohttp.TCPConnector(verify_ssl=False) + ) as session: async with session.get(f"https://cdn.plot.ly/{js_filename}") as resp: with open(str(PLOTLYJS_PATH), "wb") as f: while True: diff --git a/openbb_terminal/core/plots/plotly.html b/openbb_terminal/core/plots/plotly.html index 84ac4327807..fe5b3e268db 100644 --- a/openbb_terminal/core/plots/plotly.html +++ b/openbb_terminal/core/plots/plotly.html @@ -12,7 +12,7 @@