tannerjt / classybrew Goto Github PK
View Code? Open in Web Editor NEWClassybrew is a utility for generating statistical class breaks in your data and applying colorbrewer theory to you color palette.
License: MIT License
Classybrew is a utility for generating statistical class breaks in your data and applying colorbrewer theory to you color palette.
License: MIT License
When the evaluation of the values array finds fewer ranges than the number of classes specified, the range array is filled at the lower end with zeroes. This causes the getColorInRange function to return erroneous results ("undefined" and "false") when the value of the num provided to it is zero. This is because the test for this.range[i + 1] (to see if it exists) produces false because the value in this.range[i + 1] is zero, which is the same as false. Correcting the test to this.range[i + 1] !== "undefined" fixes the problem, but still causes num of zero to select something other than the very first color.
Example:
numClasses = 6
brew.classify() = [0, 0, 0, 5859, 102141, 198942, 378736]
brew.getColors() = [color1, color2, color3, color4, color5, color6]
brew.getColorInRange(0) = color3
Webpack can't find classybrew
module in my project. Looks like the problem is missing definition of an entry point of your module in package.json
:
...
"main": "build/classybrew.min.js",
...
By the way, repository
attribute is incorrect, too.
In this line in the second condition you want to check that i+1 < length
. But if one of breaks is exactly equal to zero, this check will fail (and lalse
will be returned).
Maybe, just check i+1 < this.range.length
?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.