openbb-charting 2.2.2__tar.gz → 2.2.3__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.
Files changed (41) hide show
  1. {openbb_charting-2.2.2 → openbb_charting-2.2.3}/PKG-INFO +2 -2
  2. {openbb_charting-2.2.2 → openbb_charting-2.2.3}/openbb_charting/charts/generic_charts.py +61 -22
  3. {openbb_charting-2.2.2 → openbb_charting-2.2.3}/openbb_charting/charts/price_historical.py +23 -7
  4. {openbb_charting-2.2.2 → openbb_charting-2.2.3}/openbb_charting/core/openbb_figure.py +0 -13
  5. {openbb_charting-2.2.2 → openbb_charting-2.2.3}/pyproject.toml +2 -2
  6. {openbb_charting-2.2.2 → openbb_charting-2.2.3}/README.md +0 -0
  7. {openbb_charting-2.2.2 → openbb_charting-2.2.3}/openbb_charting/__init__.py +0 -0
  8. {openbb_charting-2.2.2 → openbb_charting-2.2.3}/openbb_charting/charting.py +0 -0
  9. {openbb_charting-2.2.2 → openbb_charting-2.2.3}/openbb_charting/charts/__init__.py +0 -0
  10. {openbb_charting-2.2.2 → openbb_charting-2.2.3}/openbb_charting/charts/helpers.py +0 -0
  11. {openbb_charting-2.2.2 → openbb_charting-2.2.3}/openbb_charting/charts/price_performance.py +0 -0
  12. {openbb_charting-2.2.2 → openbb_charting-2.2.3}/openbb_charting/charts/relative_rotation.py +0 -0
  13. {openbb_charting-2.2.2 → openbb_charting-2.2.3}/openbb_charting/core/__init__.py +0 -0
  14. {openbb_charting-2.2.2 → openbb_charting-2.2.3}/openbb_charting/core/assets/Terminal_icon.png +0 -0
  15. {openbb_charting-2.2.2 → openbb_charting-2.2.3}/openbb_charting/core/assets/plotly-2.32.0.min.js +0 -0
  16. {openbb_charting-2.2.2 → openbb_charting-2.2.3}/openbb_charting/core/backend.py +0 -0
  17. {openbb_charting-2.2.2 → openbb_charting-2.2.3}/openbb_charting/core/chart_style.py +0 -0
  18. {openbb_charting-2.2.2 → openbb_charting-2.2.3}/openbb_charting/core/config/__init__.py +0 -0
  19. {openbb_charting-2.2.2 → openbb_charting-2.2.3}/openbb_charting/core/config/openbb_styles.py +0 -0
  20. {openbb_charting-2.2.2 → openbb_charting-2.2.3}/openbb_charting/core/dummy_backend.py +0 -0
  21. {openbb_charting-2.2.2 → openbb_charting-2.2.3}/openbb_charting/core/plotly.html +0 -0
  22. {openbb_charting-2.2.2 → openbb_charting-2.2.3}/openbb_charting/core/plotly_ta/__init__.py +0 -0
  23. {openbb_charting-2.2.2 → openbb_charting-2.2.3}/openbb_charting/core/plotly_ta/base.py +0 -0
  24. {openbb_charting-2.2.2 → openbb_charting-2.2.3}/openbb_charting/core/plotly_ta/data_classes.py +0 -0
  25. {openbb_charting-2.2.2 → openbb_charting-2.2.3}/openbb_charting/core/plotly_ta/plugins/__init__.py +0 -0
  26. {openbb_charting-2.2.2 → openbb_charting-2.2.3}/openbb_charting/core/plotly_ta/plugins/custom_indicators_plugin.py +0 -0
  27. {openbb_charting-2.2.2 → openbb_charting-2.2.3}/openbb_charting/core/plotly_ta/plugins/momentum_plugin.py +0 -0
  28. {openbb_charting-2.2.2 → openbb_charting-2.2.3}/openbb_charting/core/plotly_ta/plugins/overlap_plugin.py +0 -0
  29. {openbb_charting-2.2.2 → openbb_charting-2.2.3}/openbb_charting/core/plotly_ta/plugins/trend_indicators_plugin.py +0 -0
  30. {openbb_charting-2.2.2 → openbb_charting-2.2.3}/openbb_charting/core/plotly_ta/plugins/volatility_plugin.py +0 -0
  31. {openbb_charting-2.2.2 → openbb_charting-2.2.3}/openbb_charting/core/plotly_ta/plugins/volume_plugin.py +0 -0
  32. {openbb_charting-2.2.2 → openbb_charting-2.2.3}/openbb_charting/core/plotly_ta/ta_class.py +0 -0
  33. {openbb_charting-2.2.2 → openbb_charting-2.2.3}/openbb_charting/core/plotly_ta/ta_helpers.py +0 -0
  34. {openbb_charting-2.2.2 → openbb_charting-2.2.3}/openbb_charting/core/table.html +0 -0
  35. {openbb_charting-2.2.2 → openbb_charting-2.2.3}/openbb_charting/core/to_chart.py +0 -0
  36. {openbb_charting-2.2.2 → openbb_charting-2.2.3}/openbb_charting/query_params.py +0 -0
  37. {openbb_charting-2.2.2 → openbb_charting-2.2.3}/openbb_charting/styles/__init__.py +0 -0
  38. {openbb_charting-2.2.2 → openbb_charting-2.2.3}/openbb_charting/styles/colors.py +0 -0
  39. {openbb_charting-2.2.2 → openbb_charting-2.2.3}/openbb_charting/styles/default/dark.pltstyle.json +0 -0
  40. {openbb_charting-2.2.2 → openbb_charting-2.2.3}/openbb_charting/styles/default/light.pltstyle.json +0 -0
  41. {openbb_charting-2.2.2 → openbb_charting-2.2.3}/openbb_charting/styles/default/tables.pltstyle.json +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: openbb-charting
3
- Version: 2.2.2
3
+ Version: 2.2.3
4
4
  Summary: Charting extension for OpenBB
5
5
  License: AGPL-3.0-only
6
6
  Author: OpenBB Team
@@ -15,7 +15,7 @@ Classifier: Programming Language :: Python :: 3.12
15
15
  Provides-Extra: pywry
16
16
  Requires-Dist: nbformat (>=5.9.2,<6.0.0)
17
17
  Requires-Dist: numpy (>=1,<2)
18
- Requires-Dist: openbb-core (>=1.3.2,<2.0.0)
18
+ Requires-Dist: openbb-core (>=1.3.3,<2.0.0)
19
19
  Requires-Dist: pandas-ta (>=0.3.14b,<0.4.0)
20
20
  Requires-Dist: plotly (>=5.17.0,<6.0.0)
21
21
  Requires-Dist: pywry (>=0.6.1,<0.7.0) ; extra == "pywry"
@@ -52,7 +52,7 @@ def line_chart( # noqa: PLR0912
52
52
  """Create a line chart."""
53
53
  # pylint: disable=import-outside-toplevel
54
54
  from pandas import DataFrame, Series, to_datetime # noqa
55
- from openbb_charting.core.openbb_figure import OpenBBFigure # noqa
55
+ from openbb_charting.core.openbb_figure import OpenBBFigure
56
56
 
57
57
  if data is None:
58
58
  raise ValueError("Error: Data is a required field.")
@@ -122,6 +122,8 @@ def line_chart( # noqa: PLR0912
122
122
  except Exception as _:
123
123
  fig = OpenBBFigure(create_backend=True)
124
124
 
125
+ fig.update_layout(ChartStyle().plotly_template.get("layout", {}))
126
+ text_color = "white" if ChartStyle().plt_style == "dark" else "black"
125
127
  title = f"{title}" if title else ""
126
128
  xtitle = xtitle if xtitle else ""
127
129
  y1title = ytitle if ytitle else ""
@@ -242,15 +244,24 @@ def line_chart( # noqa: PLR0912
242
244
 
243
245
  fig.update_layout(
244
246
  title=dict(text=title if title else None, x=0.5, font=dict(size=16)),
245
- paper_bgcolor="rgba(0,0,0,0)",
246
- plot_bgcolor="rgba(0,0,0,0)",
247
+ font=dict(color=text_color),
248
+ paper_bgcolor=(
249
+ "rgba(0,0,0,0)" if text_color == "white" else "rgba(255,255,255,0)"
250
+ ),
251
+ plot_bgcolor=(
252
+ "rgba(0,0,0,0)" if text_color == "white" else "rgba(255,255,255,0)"
253
+ ),
247
254
  legend=dict(
248
- orientation="h",
249
- yanchor="bottom",
255
+ orientation="v",
256
+ yanchor="top",
250
257
  xanchor="right",
251
- y=1.02,
252
- x=0.95,
253
- bgcolor="rgba(0,0,0,0)",
258
+ y=0.95,
259
+ x=-0.01,
260
+ xref="paper",
261
+ font=dict(size=12),
262
+ bgcolor=(
263
+ "rgba(0,0,0,0)" if text_color == "white" else "rgba(255,255,255,0)"
264
+ ),
254
265
  ),
255
266
  yaxis=(
256
267
  dict(
@@ -405,6 +416,7 @@ def bar_chart( # noqa: PLR0912
405
416
  )
406
417
 
407
418
  figure.update_layout(ChartStyle().plotly_template.get("layout", {}))
419
+ text_color = "white" if ChartStyle().plt_style == "dark" else "black"
408
420
  if colors is not None:
409
421
  figure.update_layout(colorway=colors)
410
422
  if bar_kwargs is None:
@@ -414,7 +426,8 @@ def bar_chart( # noqa: PLR0912
414
426
 
415
427
  bar_df = data.copy().set_index(x) # type: ignore
416
428
  y = y.split(",") if isinstance(y, str) else y
417
-
429
+ hovertemplate = bar_kwargs.pop("hovertemplate", None)
430
+ width = bar_kwargs.pop("width", None)
418
431
  for item in y:
419
432
  figure.add_bar(
420
433
  x=bar_df.index if orientation == "v" else bar_df[item],
@@ -424,25 +437,41 @@ def bar_chart( # noqa: PLR0912
424
437
  legendgroup=bar_df[item].name,
425
438
  orientation=orientation,
426
439
  hovertemplate=(
427
- "%{fullData.name}:%{y}<extra></extra>"
428
- if orientation == "v"
429
- else "%{fullData.name}:%{x}<extra></extra>"
440
+ hovertemplate
441
+ if hovertemplate
442
+ else (
443
+ "%{fullData.name}:%{y}<extra></extra>"
444
+ if orientation == "v"
445
+ else "%{fullData.name}:%{x}<extra></extra>"
446
+ )
447
+ ),
448
+ width=(
449
+ width
450
+ if width
451
+ else 0.95 / len(y) * 0.75 if barmode == "group" and len(y) > 1 else 0.95
430
452
  ),
431
- width=0.95 / len(y) * 0.75 if barmode == "group" and len(y) > 1 else 0.95,
432
453
  **bar_kwargs,
433
454
  )
434
455
 
435
456
  figure.update_layout(
436
457
  title=dict(text=title if title else None, x=0.5, font=dict(size=16)),
437
- paper_bgcolor="rgba(0,0,0,0)",
438
- plot_bgcolor="rgba(0,0,0,0)",
458
+ paper_bgcolor=(
459
+ "rgba(0,0,0,0)" if text_color == "white" else "rgba(255,255,255,0)"
460
+ ),
461
+ plot_bgcolor=(
462
+ "rgba(0,0,0,0)" if text_color == "white" else "rbga(255,255,255,0)"
463
+ ),
439
464
  legend=dict(
440
- orientation="h",
441
- yanchor="bottom",
465
+ orientation="v",
466
+ yanchor="top",
442
467
  xanchor="right",
443
- y=1.02,
444
- x=0.98,
445
- bgcolor="rgba(0,0,0,0)",
468
+ y=0.95,
469
+ x=-0.01 if orientation == "v" else 1.01,
470
+ xref="paper",
471
+ font=dict(size=12),
472
+ bgcolor=(
473
+ "rgba(0,0,0,0)" if text_color == "white" else "rgba(255,255,255,0)"
474
+ ),
446
475
  ),
447
476
  xaxis=dict(
448
477
  type=xtype,
@@ -469,6 +498,7 @@ def bar_chart( # noqa: PLR0912
469
498
  ),
470
499
  margin=dict(pad=5),
471
500
  barmode=barmode,
501
+ font=dict(color=text_color),
472
502
  )
473
503
  if orientation == "h":
474
504
  figure.update_layout(
@@ -483,6 +513,7 @@ def bar_chart( # noqa: PLR0912
483
513
  hoverlabel=dict(
484
514
  font=dict(size=12),
485
515
  ),
516
+ hovermode="y unified",
486
517
  )
487
518
  if layout_kwargs:
488
519
  figure.update_layout(
@@ -532,7 +563,7 @@ def bar_increasing_decreasing( # pylint: disable=W0102
532
563
  """
533
564
  # pylint: disable=import-outside-toplevel
534
565
  from openbb_charting.core.openbb_figure import OpenBBFigure # noqa
535
- from pandas import Series # noqa
566
+ from pandas import Series
536
567
 
537
568
  try:
538
569
  figure = OpenBBFigure()
@@ -548,7 +579,8 @@ def bar_increasing_decreasing( # pylint: disable=W0102
548
579
  row_width=[1],
549
580
  specs=[[{"secondary_y": True}]],
550
581
  )
551
- # figure.update_layout(ChartStyle().plotly_template.get("layout", {}))
582
+ figure.update_layout(ChartStyle().plotly_template.get("layout", {}))
583
+ text_color = "white" if ChartStyle().plt_style == "dark" else "black"
552
584
 
553
585
  try:
554
586
  data = Series(data=values, index=keys)
@@ -605,6 +637,13 @@ def bar_increasing_decreasing( # pylint: disable=W0102
605
637
  categoryorder="array" if orientation == "v" else None,
606
638
  categoryarray=keys if orientation == "v" else None,
607
639
  ),
640
+ paper_bgcolor=(
641
+ "rgba(0,0,0,0)" if text_color == "white" else "rgba(255,255,255,0)"
642
+ ),
643
+ plot_bgcolor=(
644
+ "rgba(0,0,0,0)" if text_color == "white" else "rgba(255,255,255,0)"
645
+ ),
646
+ font=dict(color="white" if text_color == "white" else "black"),
608
647
  margin=dict(pad=5),
609
648
  )
610
649
 
@@ -120,8 +120,12 @@ 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
- paper_bgcolor="rgba(0,0,0,0)",
124
- plot_bgcolor="rgba(0,0,0,0)",
123
+ paper_bgcolor=(
124
+ "rgba(0,0,0,0)" if text_color == "white" else "rgba(255,255,255,0)"
125
+ ),
126
+ plot_bgcolor=(
127
+ "rgba(0,0,0,0)" if text_color == "white" else "rgba(255,255,255,0)"
128
+ ),
125
129
  font=dict(color=text_color),
126
130
  showlegend=True,
127
131
  legend=dict(
@@ -132,7 +136,9 @@ def price_historical( # noqa: PLR0912
132
136
  x=-0.01,
133
137
  xref="paper",
134
138
  font=dict(size=12),
135
- bgcolor="rgba(0,0,0,0)",
139
+ bgcolor=(
140
+ "rgba(0,0,0,0)" if text_color == "white" else "rgba(255,255,255,0)"
141
+ ),
136
142
  ),
137
143
  xaxis=dict(
138
144
  ticklen=0,
@@ -207,6 +213,8 @@ def price_historical( # noqa: PLR0912
207
213
  y2title = None # type: ignore
208
214
 
209
215
  fig = OpenBBFigure()
216
+ fig.update_layout(ChartStyle().plotly_template.get("layout", {}))
217
+ text_color = "white" if ChartStyle().plt_style == "dark" else "black"
210
218
 
211
219
  for i, col in enumerate(data.columns):
212
220
 
@@ -248,8 +256,12 @@ def price_historical( # noqa: PLR0912
248
256
  y2title = None # type: ignore
249
257
 
250
258
  fig.update_layout(
251
- paper_bgcolor="rgba(0,0,0,0)",
252
- plot_bgcolor="rgba(0,0,0,0)",
259
+ paper_bgcolor=(
260
+ "rgba(0,0,0,0)" if text_color == "white" else "rgba(255,255,255,0)"
261
+ ),
262
+ plot_bgcolor=(
263
+ "rgba(0,0,0,0)" if text_color == "white" else "rgba(255,255,255,0)"
264
+ ),
253
265
  legend=(
254
266
  dict(
255
267
  orientation="v",
@@ -257,7 +269,9 @@ def price_historical( # noqa: PLR0912
257
269
  xanchor="right",
258
270
  y=0.95,
259
271
  x=-0.01,
260
- bgcolor="rgba(0,0,0,0)",
272
+ bgcolor=(
273
+ "rgba(0,0,0,0)" if text_color == "white" else "rgba(255,255,255,0)"
274
+ ),
261
275
  )
262
276
  if len(data.columns) > 2
263
277
  else dict(
@@ -266,7 +280,9 @@ def price_historical( # noqa: PLR0912
266
280
  xanchor="right",
267
281
  y=1.02,
268
282
  x=0.98,
269
- bgcolor="rgba(0,0,0,0)",
283
+ bgcolor=(
284
+ "rgba(0,0,0,0)" if text_color == "white" else "rgba(255,255,255,0)"
285
+ ),
270
286
  )
271
287
  ),
272
288
  yaxis1=(
@@ -925,19 +925,6 @@ class OpenBBFigure(go.Figure):
925
925
  if data.get("layout", {}):
926
926
  pio.show(data, *args, **kwargs)
927
927
 
928
- self.update_layout(
929
- legend=dict(
930
- orientation=(
931
- "v"
932
- if not self.layout.legend.orientation
933
- else self.layout.legend.orientation
934
- ),
935
- ),
936
- barmode="overlay",
937
- bargap=0,
938
- bargroupgap=0,
939
- )
940
-
941
928
  return pio.show(self, *args, **kwargs)
942
929
 
943
930
  def _xaxis_tickformatstops(self) -> None:
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "openbb-charting"
3
- version = "2.2.2"
3
+ version = "2.2.3"
4
4
  description = "Charting extension for OpenBB"
5
5
  authors = ["OpenBB Team <hello@openbb.co>"]
6
6
  license = "AGPL-3.0-only"
@@ -15,7 +15,7 @@ statsmodels = "^0.14.0"
15
15
  pywry = { version = "^0.6.1", optional = true }
16
16
  nbformat = "^5.9.2"
17
17
  pandas-ta = "^0.3.14b"
18
- openbb-core = "^1.3.2"
18
+ openbb-core = "^1.3.3"
19
19
  numpy = "^1"
20
20
 
21
21
  [tool.poetry.extras]