Skip to content

Commit 6b1c436

Browse files
authored
Auto-scale Y-axis for indicators when zooming kernc#356
1 parent c0dcbbe commit 6b1c436

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

backtesting/_plotting.py

+4-5
Original file line numberDiff line numberDiff line change
@@ -523,8 +523,8 @@ def __eq__(self, other):
523523
colors = colors and cycle(_as_list(colors)) or (
524524
cycle([next(ohlc_colors)]) if is_overlay else colorgen())
525525
legend_label = LegendStr(value.name)
526-
indicator_max=value.df.max(axis='columns')
527-
indicator_min=value.df.min(axis='columns')
526+
indicator_max = value.df.max(axis = 'columns')
527+
indicator_min = value.df.min(axis = 'columns')
528528
source.add(indicator_max, f'indicator_{i}_range_max')
529529
source.add(indicator_min, f'indicator_{i}_range_min')
530530
for j, arr in enumerate(value, 1):
@@ -612,10 +612,9 @@ def __eq__(self, other):
612612
custom_js_args = dict(ohlc_range=fig_ohlc.y_range,
613613
source=source)
614614
if plot_volume:
615-
custom_js_args.update(volume_range=fig_volume.y_range)
616-
615+
custom_js_args.update(volume_range=fig_volume.y_range)
617616
indicator_ranges = {}
618-
for idx,indicator in enumerate(indicator_figs):
617+
for idx, indicator in enumerate(indicator_figs):
619618
indicator_range_key = f'indicator_{idx}_range'
620619
indicator_ranges.update({indicator_range_key: indicator.y_range})
621620
custom_js_args.update({'indicator_ranges': indicator_ranges})

0 commit comments

Comments
 (0)