Skip to content

equalIntervalBreaks

equalIntervalBreaks(x, nClasses): number[]

Defined in: src/equal_interval_breaks.js:17

Given an array of x, this will find the extent of the x and return an array of breaks that can be used to categorize the x into a number of classes. The returned array will always be 1 longer than the number of classes because it includes the minimum value.

number[]

an array of number values

number

number of desired classes

number[]

array of class break positions

equalIntervalBreaks([1, 2, 3, 4, 5, 6], 4); // => [1, 2.25, 3.5, 4.75, 6]