@@ -523,6 +523,10 @@ def __eq__(self, other):
523
523
colors = colors and cycle (_as_list (colors )) or (
524
524
cycle ([next (ohlc_colors )]) if is_overlay else colorgen ())
525
525
legend_label = LegendStr (value .name )
526
+ indicator_max = value .df .max (axis = 'columns' )
527
+ indicator_min = value .df .min (axis = 'columns' )
528
+ source .add (indicator_max , f'indicator_{ i } _range_max' )
529
+ source .add (indicator_min , f'indicator_{ i } _range_min' )
526
530
for j , arr in enumerate (value , 1 ):
527
531
color = next (colors )
528
532
source_name = f'{ legend_label } _{ i } _{ j } '
@@ -584,7 +588,8 @@ def __eq__(self, other):
584
588
figs_above_ohlc .append (_plot_drawdown_section ())
585
589
586
590
if plot_pl :
587
- figs_above_ohlc .append (_plot_pl_section ())
591
+ fig_pl = _plot_pl_section ()
592
+ figs_above_ohlc .append (fig_pl )
588
593
589
594
if plot_volume :
590
595
fig_volume = _plot_volume_section ()
@@ -607,9 +612,15 @@ def __eq__(self, other):
607
612
608
613
custom_js_args = dict (ohlc_range = fig_ohlc .y_range ,
609
614
source = source )
615
+ if plot_pl :
616
+ custom_js_args .update (pl_range = fig_pl .y_range )
610
617
if plot_volume :
611
618
custom_js_args .update (volume_range = fig_volume .y_range )
612
-
619
+ indicator_ranges = {}
620
+ for idx , indicator in enumerate (indicator_figs ):
621
+ indicator_range_key = f'indicator_{ idx } _range'
622
+ indicator_ranges .update ({indicator_range_key : indicator .y_range })
623
+ custom_js_args .update ({'indicator_ranges' : indicator_ranges })
613
624
fig_ohlc .x_range .js_on_change ('end' , CustomJS (args = custom_js_args ,
614
625
code = _AUTOSCALE_JS_CALLBACK ))
615
626
0 commit comments