classybrew icon indicating copy to clipboard operation
classybrew copied to clipboard

Bug when one of breaks is exactly equal to zero

Open aparshin opened this issue 9 years ago • 2 comments

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?

aparshin avatar Sep 29 '16 12:09 aparshin

I've add a comment to your commit - could you check it, please...

aparshin avatar Sep 30 '16 18:09 aparshin

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

aparshin avatar Oct 11 '16 10:10 aparshin