Skip to content

Commit

Permalink
Auto-scale Y-axis for Profit/Loss chart when zooming kernc#356
Browse files Browse the repository at this point in the history
  • Loading branch information
zlpatel committed Jun 13, 2021
1 parent bf03b63 commit 5ca9a59
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion backtesting/_plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -588,7 +588,8 @@ def __eq__(self, other):
figs_above_ohlc.append(_plot_drawdown_section())

if plot_pl:
figs_above_ohlc.append(_plot_pl_section())
fig_pl = _plot_pl_section()
figs_above_ohlc.append(fig_pl)

if plot_volume:
fig_volume = _plot_volume_section()
Expand All @@ -611,6 +612,8 @@ def __eq__(self, other):

custom_js_args = dict(ohlc_range=fig_ohlc.y_range,
source=source)
if plot_pl:
custom_js_args.update(pl_range=fig_pl.y_range)
if plot_volume:
custom_js_args.update(volume_range=fig_volume.y_range)
indicator_ranges = {}
Expand Down

0 comments on commit 5ca9a59

Please sign in to comment.