deno.land / x / simplestatistics@v7.8.3 / src / jenks_breaks.js

jenks_breaks.js
نووسراو ببینە
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/* * Pull Breaks Values for Jenks * * the second part of the jenks recipe: take the calculated matrices * and derive an array of n breaks. * * @private */function jenksBreaks(data, lowerClassLimits, nClasses) { let k = data.length; const kclass = []; let countNum = nClasses;
// the calculation of classes will never include the upper // bound, so we need to explicitly set it kclass[nClasses] = data[data.length - 1];
// the lowerClassLimits matrix is used as indices into itself // here: the `k` variable is reused in each iteration. while (countNum > 0) { kclass[countNum - 1] = data[lowerClassLimits[k][countNum] - 1]; k = lowerClassLimits[k][countNum] - 1; countNum--; }
return kclass;}
export default jenksBreaks;
simplestatistics

Version Info

Tagged at
a year ago