Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 44a0200

Browse files
authoredJun 13, 2021
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

Lines changed: 8 additions & 0 deletions
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)
Please sign in to comment.