Skip to content

Commit 44a0200

Browse files
authored
Add auto scaling of y-axis for PL chart kernc#356
1 parent ab17cbf commit 44a0200

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

backtesting/autoscale_cb.js

+8
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,14 @@ window._bt_autoscale_timeout = setTimeout(function () {
2727
min = Math.min.apply(null, source.data['ohlc_low'].slice(i, j));
2828
_bt_scale_range(ohlc_range, min, max, true);
2929

30+
if (pl_range) {
31+
max = Math.max.apply(null, source.data['return_pct'].slice(i, j));
32+
min = Math.min.apply(null, source.data['return_pct'].slice(i, j));
33+
if(min && max){
34+
_bt_scale_range(pl_range, min, max, true);
35+
}
36+
}
37+
3038
if (volume_range) {
3139
max = Math.max.apply(null, source.data['Volume'].slice(i, j));
3240
_bt_scale_range(volume_range, 0, max * 1.03, false);

0 commit comments

Comments
 (0)