Skip to content

Commit a4b8038

Browse files
committed
Fix max stack limitation with Math.min.apply
Cannot use for too large arrays
1 parent de52c28 commit a4b8038

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

modules/tree.mjs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1015,8 +1015,11 @@ class TDrawSelector extends TSelector {
10151015
res.max = this.hist_args[axisid * 3 + 2];
10161016
} else {
10171017

1018-
res.min = Math.min.apply(null, arr);
1019-
res.max = Math.max.apply(null, arr);
1018+
res.min = res.max = arr[0];
1019+
for (let i = 1; i < arr.length; ++i) {
1020+
res.min = Math.min(res.min, arr[i]);
1021+
res.max = Math.max(res.max, arr[i]);
1022+
}
10201023

10211024
if (this.hist_nbins)
10221025
nbins = res.nbins = this.hist_nbins;

0 commit comments

Comments
 (0)