diff options
author | teh_coderer <me@tehcoderer.com> | 2023-05-04 11:39:06 -0400 |
---|---|---|
committer | teh_coderer <me@tehcoderer.com> | 2023-05-04 11:39:06 -0400 |
commit | 61093518b37e649cd43b2f56dbce0648d9ee4e6e (patch) | |
tree | f8372b297e70bcd1b1c65bcdbb61cbddf4e7aacc | |
parent | 53ba74974381ebde564587aac3c6400ba1f0c049 (diff) |
Update plotly_helper.py
-rw-r--r-- | openbb_terminal/core/plots/plotly_helper.py | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/openbb_terminal/core/plots/plotly_helper.py b/openbb_terminal/core/plots/plotly_helper.py index 21c48e72d68..a74589d5a7f 100644 --- a/openbb_terminal/core/plots/plotly_helper.py +++ b/openbb_terminal/core/plots/plotly_helper.py @@ -78,6 +78,12 @@ class TerminalStyle: line_width: float = 1.5 + def __new__(cls, *args, **kwargs): # pylint: disable=W0613 + """Create a singleton.""" + if not hasattr(cls, "instance"): + cls.instance = super().__new__(cls) # pylint: disable=E1120 + return cls.instance + def __init__( self, plt_style: Optional[str] = "", @@ -247,8 +253,9 @@ class TerminalStyle: list List of colors e.g. ["#00ACFF", "#FF0000"] """ - self.apply_style() - colors = self.plotly_template.get("layout", {}).get("colorway", PLT_COLORWAY) + colors = ( + self.plotly_template.get("layout", {}).get("colorway", PLT_COLORWAY).copy() + ) if reverse: colors.reverse() return colors |