classybrew
classybrew copied to clipboard
Bug when one of breaks is exactly equal to zero
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?
I've add a comment to your commit - could you check it, please...
Test case:
var brew = new classyBrew();
brew.setSeries([10, 15, 20]);
brew.setNumClasses(3);
brew.setColorCode('BuGn');
brew.classify('equal_interval');
console.log(brew.getColorInRange(9)); //returns false - that's right
console.log(brew.getColorInRange(21)); //returns undefined - is this a bug? should return false too