classybrew
classybrew lets you choose from several statistical algorithms (Jenks Natural Breaks, Quantile, Equal Interval) to generate class breaks based on your data. classybrew has colorbrewer color palettes built in to quickly generate choropleth maps, graphics, tables, etc. with ease.
Created By: tannergeo
Using classybrew
Basics - Setup
var brew = ;brew;brew;brew;
Basics - Classify
brew; // returns [7.17,14.9,19.3,22.71,26.9,31.26]
Basics - Retrieval
var breaks = brew; // returns [7.17,14.9,19.3,22.71,26.9,31.26]var colors = brew; // returns [rgb(237,248,251),rgb(178,226,226),rgb(102,194,164),rgb(44,162,95),rgb(0,109,44)]brew; // returns rgb(237,248,251)
All classybrew Methods
//constructorvar brew = ; //_____setters______////__________________// // classificationbrew; // define array of data to classifybrew; // number of classes or breaks//@Methods: equal_interval, quantile, jenksbrew; // returns classified data. Defaults to natural breaks methods // color theorybrew; // color ramp code... see below //_____getters______////__________________// // classificationbrew; // returns Array of original databrew; // returns set number of classesbrew; // will call classify but for performance returns pointer if classify has already been calledbrew; // returns available classification methods to pass to classify() //color theorybrew; // returns array of all available color codesbrew; // returns object of color codes by type (diverging, sequential, qualitative)brew; // returns set color codebrew; // returns array of colors specific to your databrew; // returns appropriate color for given number
Color Theory
The colors generated using classybrew are based on Cynthia Brewer's sequential color ramps. Below are the possible codes you can use when generating your color ramp with your data. BuGn -> Blue to Green
var brew = ;brew; // returns/*["OrRd", "PuBu", "BuPu", "Oranges", "BuGn", "YlOrBr", "YlGn", "Reds", "RdPu", "Greens", "YlGnBu", "Purples", "GnBu", "Greys", "YlOrRd", "PuRd", "Blues", "PuBuGn", "Spectral", "RdYlGn", "RdBu", "PiYG", "PRGn", "RdYlBu", "BrBG", "RdGy", "PuOr", "Set2", "Accent", "Set1", "Set3", "Dark2", "Paired", "Pastel2", "Pastel1"];*/
You can also view the simple test file (./test/index.html) to better understand how to use the library and visualize the color palettes.
This tool was built with inspiration from two outstanding open source repositories.
- axismaps/colorbrewer - Cynthia Brewers Color Theory
- simogeo/geostats