timwis/leaflet-choropleth

add option to use Jenks natural breaks for classification

Closed this issue · 3 comments

A new addition would be to allow users to classify data using Jenks natural breaks. Tom MacWrights Simple Statistics does a nice job of making the calculation.

See my implementation here.

Also, is this "issue" the right place to submit this? More like feature wish list.

Sure it is - I was wondering about this myself. I don't fully understand the difference in the breaks, but I appreciate the article you linked - I'll check it out. The breakpoints are calculated by chroma.js, which offers equidistant, quantile, and k-means. I don't know why they don't offer jenks, but my guess is that a pull request on chroma.js would be the best way to accomplish it, rather than writing that functionality into this leaflet helper. Given your greater understanding of the difference between those breakpoint options, does that make sense to you?

Oh .... looks like he pulled the jenks anyway from the recent version, in favor of more of a k-means (not sure if it's the same algorithm chroma.js is using or not). http://simplestatistics.org/docs/#ckmeans.

But yes, probably better outside of the leaflet plugin if possible.

Okay well I'll close this issue for now then since it looks like k-means covers/improves jenks. Let me know if I've misunderstood.