Skip to content

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.

number[]

input data, as an array of number values

number

number of desired classes

number[]

array of class break positions, or null when nClasses is greater than the number of data points

// split data into 3 break points
jenks([1, 2, 4, 5, 7, 9, 10, 20], 3) // = [1, 7, 20, 20]