jenks
jenks(
data,nClasses):number[]
Defined in: src/jenks.js:22
The jenks natural breaks optimization is an algorithm commonly used in cartography and visualization to decide upon groupings of data values that minimize variance within themselves and maximize variation between themselves.
For instance, cartographers often use jenks in order to choose which values are assigned to which colors in a choropleth map.
Parameters
Section titled “Parameters”number[]
input data, as an array of number values
nClasses
Section titled “nClasses”number
number of desired classes
Returns
Section titled “Returns”number[]
array of class break positions, or null when nClasses is greater than the number of data points
Example
Section titled “Example”// split data into 3 break pointsjenks([1, 2, 4, 5, 7, 9, 10, 20], 3) // = [1, 7, 20, 20]