You can create equal width bins with D3 like this:
const arr = [0, 0, 1, 10, 100, 102, 200, 253, 10000]
const bin_gen = d3.bin()
const bins = bin_gen(arr)
Puts the data into these bins:
[
[
0,
0,
1,
10,
100,
102,
200,
253
],
[],
[],
[],
[],
[
10000
]
]
with these thresholds:
[
[0, 2000],
[2000, 4000],
[4000, 6000],
[6000, 8000],
[8000, 10000],
[10000, 12000]
]
Instead, what I want is for there to be an approximately equal number of observations in each bin, with unequal threshold widths. Is it possible that you can only create equal width bins and not equal depth/frequency bins with D3?
If you put your data in a sorted list, then you can simply take the non-overlapping chunks.