Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

getRangeNum() method integrated from caseypt

  • Loading branch information...
commit 7e0e25b980f1e9915f071453c14a18b1224e9c75 1 parent 60ae8ce
@simogeo authored
Showing with 14 additions and 0 deletions.
  1. +14 −0 lib/geostats.js
View
14 lib/geostats.js
@@ -450,6 +450,20 @@ var geostats = function(a) {
return this.ranges;
};
+
+ /*
+ * Returns the number/index of this.ranges that value falls into
+ */
+ this.getRangeNum = function(value) {
+ var bounds, i;
+
+ for (i = 0; i < this.ranges.length; i++) {
+ bounds = this.ranges[i].split(/ - /);
+ if (value <= parseFloat(bounds[1])) {
+ return i;
+ }
+ }
+ }
/**
* Return an html legend
Please sign in to comment.
Something went wrong with that request. Please try again.