Skip to content

Commit 26289c5

Browse files
committed
feat: thresholds.length = bins + 1; bins = i
1 parent 5cad183 commit 26289c5

File tree

1 file changed

+4
-4
lines changed
  • packages/vdataset/src/transform

1 file changed

+4
-4
lines changed

packages/vdataset/src/transform/bin.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -247,8 +247,8 @@ export const bin: Transform = (data: Array<object>, options?: IBinOptions) => {
247247
for (let i = 0; i <= bins; i++) {
248248
thresholds[i] = start + stepSizeInt * i;
249249
if (thresholds[i] > max) {
250-
bins = i + 1;
251-
thresholds.length = bins;
250+
bins = i;
251+
thresholds.length = bins + 1;
252252
break;
253253
}
254254
}
@@ -258,8 +258,8 @@ export const bin: Transform = (data: Array<object>, options?: IBinOptions) => {
258258
for (let i = 0; i <= bins; i++) {
259259
thresholds[i] = min + stepSize * i;
260260
if (thresholds[i] > max) {
261-
bins = i + 1;
262-
thresholds.length = bins;
261+
bins = i;
262+
thresholds.length = bins + 1;
263263
break;
264264
}
265265
}

0 commit comments

Comments
 (0)