Skip to content

judy-zz/jenks

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Jenks

Implementation of Jenks' Natural Breaks Algorithm in Ruby. I converted it from Tom MacWright's original Javascript into Ruby, and then optimized it for Ruby's strengths.

Installation

Add this line to your application's Gemfile:

gem 'jenks'

And then execute:

$ bundle

Or install it yourself as:

$ gem install jenks

Usage

Jenks adds a single method, #jenks to the Array class.

data = (1..20).to_a + (41..60).to_a + (81..100).to_a # Three distinct sets in one array
data.jenks(3) # [1,20,60,100]

Contributing

  1. Fork it ( https://github.com/judy/jenks/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Install development gems (bundle install)
  4. Benchmark with ruby benchmarks/array_benchmark.rb
  5. Fix bugs or add a feature.
  6. Verify everything passes (rspec)
  7. Benchmark again, leave the code as fast or faster than when you forked.
  8. Commit your changes (git commit -am 'Add some feature')
  9. Push to the branch (git push origin my-new-feature)
  10. Create a new pull request.

About

A Ruby implementation of Jenks Natural Breaks algorithm.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages