How to use the simple-statistics.jenks function in simple-statistics

To help you get started, we’ve selected a few simple-statistics examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github morganherlocker / geocolor / lib / geocolor.js View on Github external
jenks: function(fc, z, numBreaks, colors, style){
    var vals = _.chain(fc.features)
      .pluck('properties')
      .pluck(z)
      .value()
      
    var breaks = ss.jenks(vals, numBreaks)
    var normals = normalize(breaks.length)
    fc = colorize(fc, z, colors, breaks, normals)
    fc = setLegend(fc, z, colors, breaks, normals)
    fc = applyStyle(fc, style)
    return fc
  },
github Turfjs / turf / lib / jenks.js View on Github external
module.exports = function(fc, field, num, done){
  var vals = []
  var breaks = []

  done = done || function () {};

  _.each(fc.features, function(feature){
    if(!(feature.properties[field]===undefined)){
      vals.push(feature.properties[field])
    }
  })
  breaks = ss.jenks(vals, num)

  done(null, breaks)
  return breaks;
}
github Turfjs / turf / packages / turf-jenks / index.js View on Github external
module.exports = function (fc, field, num) {
    var vals = [];
    var breaks = [];

    fc.features.forEach(function (feature) {
        if (feature.properties[field] !== undefined) {
            vals.push(feature.properties[field]);
        }
    });
    breaks = ss.jenks(vals, num);

    return breaks;
};