openbb-charting 2.5.0__tar.gz → 3.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {openbb_charting-2.5.0 → openbb_charting-3.0.0}/PKG-INFO +30 -14
- {openbb_charting-2.5.0 → openbb_charting-3.0.0}/README.md +26 -9
- {openbb_charting-2.5.0 → openbb_charting-3.0.0}/openbb_charting/charting.py +33 -42
- {openbb_charting-2.5.0 → openbb_charting-3.0.0}/openbb_charting/charts/generic_charts.py +0 -10
- {openbb_charting-2.5.0 → openbb_charting-3.0.0}/openbb_charting/charts/price_historical.py +0 -2
- openbb_charting-3.0.0/openbb_charting/core/backend.py +482 -0
- {openbb_charting-2.5.0 → openbb_charting-3.0.0}/openbb_charting/core/chart_style.py +3 -1
- openbb_charting-3.0.0/openbb_charting/core/dummy_backend.py +31 -0
- {openbb_charting-2.5.0 → openbb_charting-3.0.0}/openbb_charting/core/openbb_figure.py +29 -114
- {openbb_charting-2.5.0 → openbb_charting-3.0.0}/openbb_charting/styles/default/dark.pltstyle.json +1 -0
- {openbb_charting-2.5.0 → openbb_charting-3.0.0}/openbb_charting/styles/default/light.pltstyle.json +1 -0
- {openbb_charting-2.5.0 → openbb_charting-3.0.0}/pyproject.toml +4 -5
- openbb_charting-2.5.0/openbb_charting/core/assets/plotly-3.1.0.min.js +0 -3882
- openbb_charting-2.5.0/openbb_charting/core/backend.py +0 -441
- openbb_charting-2.5.0/openbb_charting/core/dummy_backend.py +0 -55
- openbb_charting-2.5.0/openbb_charting/core/plotly.html +0 -4031
- openbb_charting-2.5.0/openbb_charting/core/table.html +0 -165
- {openbb_charting-2.5.0 → openbb_charting-3.0.0}/openbb_charting/__init__.py +0 -0
- {openbb_charting-2.5.0 → openbb_charting-3.0.0}/openbb_charting/charts/__init__.py +0 -0
- {openbb_charting-2.5.0 → openbb_charting-3.0.0}/openbb_charting/charts/correlation_matrix.py +0 -0
- {openbb_charting-2.5.0 → openbb_charting-3.0.0}/openbb_charting/charts/helpers.py +0 -0
- {openbb_charting-2.5.0 → openbb_charting-3.0.0}/openbb_charting/charts/price_performance.py +0 -0
- {openbb_charting-2.5.0 → openbb_charting-3.0.0}/openbb_charting/charts/relative_rotation.py +0 -0
- {openbb_charting-2.5.0 → openbb_charting-3.0.0}/openbb_charting/core/__init__.py +0 -0
- {openbb_charting-2.5.0 → openbb_charting-3.0.0}/openbb_charting/core/assets/Terminal_icon.png +0 -0
- {openbb_charting-2.5.0 → openbb_charting-3.0.0}/openbb_charting/core/config/__init__.py +0 -0
- {openbb_charting-2.5.0 → openbb_charting-3.0.0}/openbb_charting/core/config/openbb_styles.py +0 -0
- {openbb_charting-2.5.0 → openbb_charting-3.0.0}/openbb_charting/core/plotly_ta/__init__.py +0 -0
- {openbb_charting-2.5.0 → openbb_charting-3.0.0}/openbb_charting/core/plotly_ta/base.py +0 -0
- {openbb_charting-2.5.0 → openbb_charting-3.0.0}/openbb_charting/core/plotly_ta/data_classes.py +0 -0
- {openbb_charting-2.5.0 → openbb_charting-3.0.0}/openbb_charting/core/plotly_ta/plugins/__init__.py +0 -0
- {openbb_charting-2.5.0 → openbb_charting-3.0.0}/openbb_charting/core/plotly_ta/plugins/custom_indicators_plugin.py +0 -0
- {openbb_charting-2.5.0 → openbb_charting-3.0.0}/openbb_charting/core/plotly_ta/plugins/momentum_plugin.py +0 -0
- {openbb_charting-2.5.0 → openbb_charting-3.0.0}/openbb_charting/core/plotly_ta/plugins/overlap_plugin.py +0 -0
- {openbb_charting-2.5.0 → openbb_charting-3.0.0}/openbb_charting/core/plotly_ta/plugins/trend_indicators_plugin.py +0 -0
- {openbb_charting-2.5.0 → openbb_charting-3.0.0}/openbb_charting/core/plotly_ta/plugins/volatility_plugin.py +0 -0
- {openbb_charting-2.5.0 → openbb_charting-3.0.0}/openbb_charting/core/plotly_ta/plugins/volume_plugin.py +0 -0
- {openbb_charting-2.5.0 → openbb_charting-3.0.0}/openbb_charting/core/plotly_ta/ta_class.py +0 -0
- {openbb_charting-2.5.0 → openbb_charting-3.0.0}/openbb_charting/core/plotly_ta/ta_helpers.py +0 -0
- {openbb_charting-2.5.0 → openbb_charting-3.0.0}/openbb_charting/core/to_chart.py +0 -0
- {openbb_charting-2.5.0 → openbb_charting-3.0.0}/openbb_charting/query_params.py +0 -0
- {openbb_charting-2.5.0 → openbb_charting-3.0.0}/openbb_charting/styles/__init__.py +0 -0
- {openbb_charting-2.5.0 → openbb_charting-3.0.0}/openbb_charting/styles/colors.py +0 -0
- {openbb_charting-2.5.0 → openbb_charting-3.0.0}/openbb_charting/styles/default/tables.pltstyle.json +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: openbb-charting
|
|
3
|
-
Version:
|
|
3
|
+
Version: 3.0.0
|
|
4
4
|
Summary: Charting extension for OpenBB
|
|
5
5
|
License: AGPL-3.0-only
|
|
6
6
|
Author: OpenBB Team
|
|
@@ -14,11 +14,10 @@ Classifier: Programming Language :: Python :: 3.12
|
|
|
14
14
|
Classifier: Programming Language :: Python :: 3.13
|
|
15
15
|
Classifier: Programming Language :: Python :: 3.14
|
|
16
16
|
Provides-Extra: pywry
|
|
17
|
-
Requires-Dist:
|
|
18
|
-
Requires-Dist: openbb
|
|
19
|
-
Requires-Dist: pandas-ta-openbb (>=0.4.23,<0.5.0)
|
|
17
|
+
Requires-Dist: openbb-core (>=1.6.10,<2.0.0)
|
|
18
|
+
Requires-Dist: pandas-ta-openbb (>=0.4.24,<0.5.0)
|
|
20
19
|
Requires-Dist: plotly (>=6.3.1,<7.0.0)
|
|
21
|
-
Requires-Dist: pywry (>=0.
|
|
20
|
+
Requires-Dist: pywry (>=2.0.2) ; extra == "pywry"
|
|
22
21
|
Description-Content-Type: text/markdown
|
|
23
22
|
|
|
24
23
|
# OpenBB Charting extension
|
|
@@ -42,14 +41,18 @@ To install the extension, run the following command in this folder:
|
|
|
42
41
|
pip install openbb-charting
|
|
43
42
|
```
|
|
44
43
|
|
|
45
|
-
|
|
44
|
+
To enable display in a native OS window, install the PyWry extra.
|
|
46
45
|
|
|
47
|
-
|
|
46
|
+
```bash
|
|
47
|
+
pip install "openbb-charting[pywry]"
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### PyWry dependency on Linux
|
|
48
51
|
|
|
49
52
|
When using Linux distributions, the PyWry dependency requires certain dependencies to be installed first.
|
|
50
53
|
|
|
51
54
|
- Debian-based / Ubuntu / Mint:
|
|
52
|
-
`sudo apt install libwebkit2gtk-4.
|
|
55
|
+
`sudo apt install libwebkit2gtk-4.1-dev libgtk-3-dev`
|
|
53
56
|
|
|
54
57
|
- Arch Linux / Manjaro:
|
|
55
58
|
`sudo pacman -S webkit2gtk`
|
|
@@ -76,9 +79,7 @@ In order to display the chart, you need to call the `show()` method:
|
|
|
76
79
|
equity_data.show()
|
|
77
80
|
```
|
|
78
81
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
Alternatively, you can use the fact that the `openbb-charting` is an `OBBject` extension and use its available methods.
|
|
82
|
+
Alternatively, `openbb-charting` is an `OBBject` accessor and its methods can be used directly from any instance.
|
|
82
83
|
|
|
83
84
|
```python
|
|
84
85
|
from openbb import obb
|
|
@@ -88,9 +89,24 @@ res.charting.show()
|
|
|
88
89
|
|
|
89
90
|
The above code will produce the same effect as the previous example.
|
|
90
91
|
|
|
92
|
+
## Custom Charts and Data
|
|
93
|
+
|
|
94
|
+
Various types of charts can be generated from Pandas DataFrames without needing to understand the Plotly library.
|
|
95
|
+
|
|
96
|
+
The methods are exposed as part of the `OBBject` accessor class. The `data` parameter can be passed as a list object from `OBBject.results`, or any Pandas DataFrame instance.
|
|
97
|
+
|
|
98
|
+
```python
|
|
99
|
+
res = obb.equity.price.historical("AAPL", chart=True)
|
|
100
|
+
|
|
101
|
+
surface_3d = res.charting.create_3d_surface
|
|
102
|
+
bar_chart = res.charting.create_bar_chart
|
|
103
|
+
line_chart = res.charting.create_line_chart
|
|
104
|
+
correlation_matrix = res.charting.create_correlation_matrix
|
|
105
|
+
```
|
|
106
|
+
|
|
91
107
|
### Discovering available charts
|
|
92
108
|
|
|
93
|
-
Not all the endpoints
|
|
109
|
+
Not all the endpoints have dedicated charts. To discover which endpoints are supported, you can run the following command:
|
|
94
110
|
|
|
95
111
|
```python
|
|
96
112
|
from openbb_charting import Charting
|
|
@@ -191,8 +207,8 @@ The implementation should leverage the already existing classes and methods to d
|
|
|
191
207
|
|
|
192
208
|
Note that the return of each charting function should respect the already defined return types: `Tuple[OpenBBFigure, Dict[str, Any]]`.
|
|
193
209
|
|
|
194
|
-
The returned tuple contains a `OpenBBFigure` that is an interactive
|
|
210
|
+
The returned tuple contains a `OpenBBFigure` that is an interactive Plotly figure which can be used in a Python interpreter, and a `Dict[str, Any]` that contains the raw data leveraged by the API.
|
|
195
211
|
|
|
196
212
|
After you're done implementing the charting function, you can use either the Python interface or the API to get the chart. To do so, you'll only need to set the already available `chart` argument to `True`.
|
|
197
|
-
Or accessing the `charting` attribute of
|
|
213
|
+
Or accessing the `charting` attribute of any returned `OBBject` object: `my_obbject.charting.show()`.
|
|
198
214
|
|
|
@@ -19,14 +19,18 @@ To install the extension, run the following command in this folder:
|
|
|
19
19
|
pip install openbb-charting
|
|
20
20
|
```
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
To enable display in a native OS window, install the PyWry extra.
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
```bash
|
|
25
|
+
pip install "openbb-charting[pywry]"
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
### PyWry dependency on Linux
|
|
25
29
|
|
|
26
30
|
When using Linux distributions, the PyWry dependency requires certain dependencies to be installed first.
|
|
27
31
|
|
|
28
32
|
- Debian-based / Ubuntu / Mint:
|
|
29
|
-
`sudo apt install libwebkit2gtk-4.
|
|
33
|
+
`sudo apt install libwebkit2gtk-4.1-dev libgtk-3-dev`
|
|
30
34
|
|
|
31
35
|
- Arch Linux / Manjaro:
|
|
32
36
|
`sudo pacman -S webkit2gtk`
|
|
@@ -53,9 +57,7 @@ In order to display the chart, you need to call the `show()` method:
|
|
|
53
57
|
equity_data.show()
|
|
54
58
|
```
|
|
55
59
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
Alternatively, you can use the fact that the `openbb-charting` is an `OBBject` extension and use its available methods.
|
|
60
|
+
Alternatively, `openbb-charting` is an `OBBject` accessor and its methods can be used directly from any instance.
|
|
59
61
|
|
|
60
62
|
```python
|
|
61
63
|
from openbb import obb
|
|
@@ -65,9 +67,24 @@ res.charting.show()
|
|
|
65
67
|
|
|
66
68
|
The above code will produce the same effect as the previous example.
|
|
67
69
|
|
|
70
|
+
## Custom Charts and Data
|
|
71
|
+
|
|
72
|
+
Various types of charts can be generated from Pandas DataFrames without needing to understand the Plotly library.
|
|
73
|
+
|
|
74
|
+
The methods are exposed as part of the `OBBject` accessor class. The `data` parameter can be passed as a list object from `OBBject.results`, or any Pandas DataFrame instance.
|
|
75
|
+
|
|
76
|
+
```python
|
|
77
|
+
res = obb.equity.price.historical("AAPL", chart=True)
|
|
78
|
+
|
|
79
|
+
surface_3d = res.charting.create_3d_surface
|
|
80
|
+
bar_chart = res.charting.create_bar_chart
|
|
81
|
+
line_chart = res.charting.create_line_chart
|
|
82
|
+
correlation_matrix = res.charting.create_correlation_matrix
|
|
83
|
+
```
|
|
84
|
+
|
|
68
85
|
### Discovering available charts
|
|
69
86
|
|
|
70
|
-
Not all the endpoints
|
|
87
|
+
Not all the endpoints have dedicated charts. To discover which endpoints are supported, you can run the following command:
|
|
71
88
|
|
|
72
89
|
```python
|
|
73
90
|
from openbb_charting import Charting
|
|
@@ -168,7 +185,7 @@ The implementation should leverage the already existing classes and methods to d
|
|
|
168
185
|
|
|
169
186
|
Note that the return of each charting function should respect the already defined return types: `Tuple[OpenBBFigure, Dict[str, Any]]`.
|
|
170
187
|
|
|
171
|
-
The returned tuple contains a `OpenBBFigure` that is an interactive
|
|
188
|
+
The returned tuple contains a `OpenBBFigure` that is an interactive Plotly figure which can be used in a Python interpreter, and a `Dict[str, Any]` that contains the raw data leveraged by the API.
|
|
172
189
|
|
|
173
190
|
After you're done implementing the charting function, you can use either the Python interface or the API to get the chart. To do so, you'll only need to set the already available `chart` argument to `True`.
|
|
174
|
-
Or accessing the `charting` attribute of
|
|
191
|
+
Or accessing the `charting` attribute of any returned `OBBject` object: `my_obbject.charting.show()`.
|
|
@@ -29,7 +29,6 @@ if TYPE_CHECKING:
|
|
|
29
29
|
from plotly.graph_objs import Figure
|
|
30
30
|
from openbb_charting.core.openbb_figure import OpenBBFigure
|
|
31
31
|
from openbb_charting.query_params import ChartParams
|
|
32
|
-
from openbb_charting.core.backend import Backend
|
|
33
32
|
|
|
34
33
|
|
|
35
34
|
class Charting:
|
|
@@ -70,6 +69,8 @@ class Charting:
|
|
|
70
69
|
# pylint: disable=import-outside-toplevel
|
|
71
70
|
import importlib # noqa
|
|
72
71
|
|
|
72
|
+
from openbb_charting.core.backend import Backend
|
|
73
|
+
|
|
73
74
|
charting_settings_module = importlib.import_module(
|
|
74
75
|
"openbb_core.app.model.charts.charting_settings", "ChartingSettings"
|
|
75
76
|
)
|
|
@@ -80,7 +81,7 @@ class Charting:
|
|
|
80
81
|
user_settings=self._obbject._user_settings, # type: ignore
|
|
81
82
|
system_settings=self._obbject._system_settings, # type: ignore
|
|
82
83
|
)
|
|
83
|
-
self._backend = self.
|
|
84
|
+
self._backend = Backend(self._charting_settings)
|
|
84
85
|
self._functions: dict[str, Callable] = self._get_functions()
|
|
85
86
|
|
|
86
87
|
@classmethod
|
|
@@ -111,16 +112,6 @@ class Charting:
|
|
|
111
112
|
|
|
112
113
|
return functions
|
|
113
114
|
|
|
114
|
-
def _handle_backend(self) -> "Backend":
|
|
115
|
-
"""Create and start the backend."""
|
|
116
|
-
# pylint: disable=import-outside-toplevel
|
|
117
|
-
from openbb_charting.core.backend import create_backend, get_backend
|
|
118
|
-
|
|
119
|
-
create_backend(self._charting_settings)
|
|
120
|
-
backend = get_backend()
|
|
121
|
-
backend.start(debug=self._charting_settings.debug_mode) # type: ignore
|
|
122
|
-
return backend # type: ignore
|
|
123
|
-
|
|
124
115
|
def _get_chart_function(self, route: str) -> Callable:
|
|
125
116
|
"""Given a route, it returns the chart function. The module must contain the given route."""
|
|
126
117
|
if route is None:
|
|
@@ -477,7 +468,7 @@ class Charting:
|
|
|
477
468
|
|
|
478
469
|
try:
|
|
479
470
|
charting_function = self._get_chart_function(
|
|
480
|
-
self._obbject._route # pylint: disable=protected-access
|
|
471
|
+
self._obbject._route or "" # pylint: disable=protected-access
|
|
481
472
|
)
|
|
482
473
|
kwargs["obbject_item"] = self._obbject.results
|
|
483
474
|
kwargs["charting_settings"] = self._charting_settings
|
|
@@ -495,6 +486,10 @@ class Charting:
|
|
|
495
486
|
|
|
496
487
|
kwargs["provider"] = self._obbject.provider
|
|
497
488
|
kwargs["extra"] = self._obbject.extra
|
|
489
|
+
kwargs.setdefault(
|
|
490
|
+
"command_location",
|
|
491
|
+
self._obbject._route or "", # pylint: disable=protected-access
|
|
492
|
+
)
|
|
498
493
|
|
|
499
494
|
# Handle different types of output from the charting endpoint.
|
|
500
495
|
chart_response: Any = charting_function(**kwargs)
|
|
@@ -666,21 +661,12 @@ class Charting:
|
|
|
666
661
|
|
|
667
662
|
def _set_chart_style(self, figure: "Figure"):
|
|
668
663
|
"""Set the user preference for light or dark mode."""
|
|
669
|
-
style = self._charting_settings.chart_style
|
|
670
|
-
font_color = "black" if style == "light" else "white"
|
|
671
|
-
paper_bgcolor = "white" if style == "light" else "black"
|
|
672
|
-
plot_bgcolor = "white" if style == "light" else "black"
|
|
673
|
-
figure = figure.update_layout(
|
|
674
|
-
dict(
|
|
675
|
-
font_color=font_color,
|
|
676
|
-
paper_bgcolor=paper_bgcolor,
|
|
677
|
-
plot_bgcolor=plot_bgcolor,
|
|
678
|
-
)
|
|
679
|
-
) # pylint: disable=R1735
|
|
680
664
|
return figure
|
|
681
665
|
|
|
682
666
|
def toggle_chart_style(self):
|
|
683
667
|
"""Toggle the chart style between light and dark mode."""
|
|
668
|
+
import plotly.io as pio # pylint: disable=import-outside-toplevel
|
|
669
|
+
|
|
684
670
|
if not hasattr(self._obbject.chart, "fig"):
|
|
685
671
|
raise ValueError(
|
|
686
672
|
"Error: No chart has been created. Please create a chart first."
|
|
@@ -688,10 +674,11 @@ class Charting:
|
|
|
688
674
|
current = self._charting_settings.chart_style
|
|
689
675
|
new = "light" if current == "dark" else "dark"
|
|
690
676
|
self._charting_settings.chart_style = new
|
|
677
|
+
template_name = "plotly_white" if new == "light" else "plotly_dark"
|
|
691
678
|
figure = self._obbject.chart.fig # type: ignore[union-attr]
|
|
692
|
-
|
|
693
|
-
self._obbject.chart.fig =
|
|
694
|
-
self._obbject.chart.content =
|
|
679
|
+
figure.update_layout(template=pio.templates[template_name]) # type: ignore[union-attr]
|
|
680
|
+
self._obbject.chart.fig = figure # type: ignore[union-attr]
|
|
681
|
+
self._obbject.chart.content = figure.show( # type: ignore[union-attr]
|
|
695
682
|
external=True
|
|
696
683
|
).to_plotly_json() # type: ignore[union-attr]
|
|
697
684
|
|
|
@@ -725,6 +712,7 @@ class Charting:
|
|
|
725
712
|
self,
|
|
726
713
|
data: Union["DataFrame", "Series"] | None = None,
|
|
727
714
|
title: str = "",
|
|
715
|
+
include_query_toolbar: bool = True,
|
|
728
716
|
):
|
|
729
717
|
"""Display an interactive table.
|
|
730
718
|
|
|
@@ -735,6 +723,8 @@ class Charting:
|
|
|
735
723
|
If no data is provided the OBBject results will be used.
|
|
736
724
|
title : str, optional
|
|
737
725
|
Title of the table, by default "".
|
|
726
|
+
include_query_toolbar : bool, optional
|
|
727
|
+
Whether to include the Pandas Query toolbar, by default True.
|
|
738
728
|
"""
|
|
739
729
|
# pylint: disable=import-outside-toplevel
|
|
740
730
|
from pandas import RangeIndex
|
|
@@ -746,26 +736,27 @@ class Charting:
|
|
|
746
736
|
data_as_df.reset_index(inplace=True)
|
|
747
737
|
for col in data_as_df.columns:
|
|
748
738
|
data_as_df[col] = data_as_df[col].apply(self._convert_to_string)
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
739
|
+
try:
|
|
740
|
+
send_table = getattr(self._backend, "send_table")
|
|
741
|
+
if include_query_toolbar:
|
|
742
|
+
send_table(
|
|
752
743
|
df_table=data_as_df,
|
|
753
744
|
title=title
|
|
754
|
-
or
|
|
755
|
-
or
|
|
745
|
+
or self._obbject._route # pylint: disable=protected-access
|
|
746
|
+
or "",
|
|
756
747
|
theme=self._charting_settings.table_style, # pylint: disable=protected-access
|
|
757
748
|
)
|
|
758
|
-
except Exception as e: # pylint: disable=W0718
|
|
759
|
-
warn(f"Failed to show figure with backend. {e}")
|
|
760
|
-
|
|
761
|
-
else:
|
|
762
|
-
from plotly import optional_imports
|
|
763
|
-
|
|
764
|
-
ipython_display = optional_imports.get_module("IPython.display")
|
|
765
|
-
if ipython_display:
|
|
766
|
-
ipython_display.display(ipython_display.HTML(data_as_df.to_html()))
|
|
767
749
|
else:
|
|
768
|
-
|
|
750
|
+
send_table(
|
|
751
|
+
df_table=data_as_df,
|
|
752
|
+
title=title
|
|
753
|
+
or self._obbject._route # pylint: disable=protected-access
|
|
754
|
+
or "",
|
|
755
|
+
theme=self._charting_settings.table_style, # pylint: disable=protected-access
|
|
756
|
+
include_query_toolbar=False,
|
|
757
|
+
)
|
|
758
|
+
except Exception as e: # pylint: disable=W0718
|
|
759
|
+
warn(f"Failed to show table with backend. {e}")
|
|
769
760
|
|
|
770
761
|
def url(
|
|
771
762
|
self,
|
|
@@ -124,7 +124,6 @@ def line_chart( # noqa: PLR0912
|
|
|
124
124
|
except Exception as _:
|
|
125
125
|
fig = OpenBBFigure(create_backend=True)
|
|
126
126
|
|
|
127
|
-
fig.update_layout(ChartStyle().plotly_template.get("layout", {}))
|
|
128
127
|
text_color = "white" if ChartStyle().plt_style == "dark" else "black"
|
|
129
128
|
title = f"{title}" if title else ""
|
|
130
129
|
xtitle = xtitle if xtitle else ""
|
|
@@ -245,7 +244,6 @@ def line_chart( # noqa: PLR0912
|
|
|
245
244
|
|
|
246
245
|
fig.update_layout(
|
|
247
246
|
title=dict(text=title if title else None, x=0.5, font=dict(size=16)),
|
|
248
|
-
font=dict(color=text_color),
|
|
249
247
|
legend=dict(
|
|
250
248
|
orientation="v",
|
|
251
249
|
yanchor="top",
|
|
@@ -410,7 +408,6 @@ def bar_chart( # noqa: PLR0912
|
|
|
410
408
|
specs=[[{"secondary_y": True}]],
|
|
411
409
|
)
|
|
412
410
|
|
|
413
|
-
figure.update_layout(ChartStyle().plotly_template.get("layout", {}))
|
|
414
411
|
text_color = "white" if ChartStyle().plt_style == "dark" else "black"
|
|
415
412
|
if colors is not None:
|
|
416
413
|
figure.update_layout(colorway=colors)
|
|
@@ -486,7 +483,6 @@ def bar_chart( # noqa: PLR0912
|
|
|
486
483
|
),
|
|
487
484
|
margin=dict(pad=5),
|
|
488
485
|
barmode=barmode,
|
|
489
|
-
font=dict(color=text_color),
|
|
490
486
|
)
|
|
491
487
|
if orientation == "h":
|
|
492
488
|
figure.update_layout(
|
|
@@ -567,8 +563,6 @@ def bar_increasing_decreasing( # pylint: disable=W0102
|
|
|
567
563
|
row_width=[1],
|
|
568
564
|
specs=[[{"secondary_y": True}]],
|
|
569
565
|
)
|
|
570
|
-
figure.update_layout(ChartStyle().plotly_template.get("layout", {}))
|
|
571
|
-
text_color = "white" if ChartStyle().plt_style == "dark" else "black"
|
|
572
566
|
|
|
573
567
|
try:
|
|
574
568
|
data = Series(data=values, index=keys)
|
|
@@ -625,7 +619,6 @@ def bar_increasing_decreasing( # pylint: disable=W0102
|
|
|
625
619
|
categoryorder="array" if orientation == "v" else None,
|
|
626
620
|
categoryarray=keys if orientation == "v" else None,
|
|
627
621
|
),
|
|
628
|
-
font=dict(color="white" if text_color == "white" else "black"),
|
|
629
622
|
margin=dict(pad=5),
|
|
630
623
|
)
|
|
631
624
|
|
|
@@ -696,8 +689,6 @@ def surface3d(
|
|
|
696
689
|
chart_style = ChartStyle()
|
|
697
690
|
if theme:
|
|
698
691
|
chart_style.plt_style = theme
|
|
699
|
-
fig.update_layout(chart_style.plotly_template.get("layout", {}))
|
|
700
|
-
text_color = "white" if chart_style.plt_style == "dark" else "black"
|
|
701
692
|
fig.set_title(f"{title if title and title != 'OpenBB Platform' else ''}")
|
|
702
693
|
fig_kwargs = dict(z=Z, x=X, y=Y, i=II, j=J, k=K, intensity=Z)
|
|
703
694
|
customdata = np.array([[xtitle, ytitle, ztitle]] * len(X))
|
|
@@ -784,7 +775,6 @@ def surface3d(
|
|
|
784
775
|
center=dict(x=-0.01, y=0, z=-0.3),
|
|
785
776
|
eye=dict(x=1.75, y=1.75, z=0.69),
|
|
786
777
|
),
|
|
787
|
-
font=dict(color=text_color),
|
|
788
778
|
)
|
|
789
779
|
|
|
790
780
|
fig.update_scenes(
|
|
@@ -120,7 +120,6 @@ def price_historical( # noqa: PLR0912
|
|
|
120
120
|
if _volume is True and "atr" in indicators: # type: ignore
|
|
121
121
|
fig.add_inchart_volume(data)
|
|
122
122
|
fig.update_layout(
|
|
123
|
-
font=dict(color=text_color),
|
|
124
123
|
showlegend=True,
|
|
125
124
|
legend=dict(
|
|
126
125
|
orientation="v",
|
|
@@ -206,7 +205,6 @@ def price_historical( # noqa: PLR0912
|
|
|
206
205
|
y2title = None # type: ignore
|
|
207
206
|
|
|
208
207
|
fig = OpenBBFigure()
|
|
209
|
-
fig.update_layout(ChartStyle().plotly_template.get("layout", {}))
|
|
210
208
|
text_color = "white" if ChartStyle().plt_style == "dark" else "black"
|
|
211
209
|
|
|
212
210
|
for i, col in enumerate(data.columns):
|