geoclassify
Advanced tools
Comparing version 0.0.3 to 0.0.4
@@ -1,1 +0,1 @@ | ||
const a=require('geostats'),b={type:'Jenks',level:5};class c{constructor(c){this.options=Object.assign(b,c||{}),this.classify=new a,this.classify.silent=!0,this.seriesArray=null}setData(a){a&&a.length&&Array.isArray(a)||console.error('classify.setData needs ds argument'),this.ds=a;let b=this.options.type;'Jenks'===b?a.length<=this.options.level&&(this.options.level=a.length-1):a.length<=this.options.level&&(this.options.level=a.length),this.classify.setSerie(a),this.setClassify()}setPattern(a){a&&a.length&&Array.isArray(a)||console.error('classify.setPattern needs pattern argument'),this.pattern=a}getPattern(a){let b=this.getIndex(a),c=this.options.level;return b>=this.pattern.length?this.pattern[this.pattern.length-1]:this.pattern[b]}getIndex(a){let b=0,c=this.seriesArray.length;for(let d=0;d<c;d++){if(a===this.seriesArray[c-1]){b=1===c?c-1:c-2;break}if(this.seriesArray[d]<=a&&a<this.seriesArray[d+1]){b=d;break}}return b}setClassify(){let a=this.options,b=a.type,c=a.level;switch(b){case'EqInterval':this.seriesArray=this.classify.getEqInterval(c);break;case'StdDeviation':this.seriesArray=this.classify.getStdDeviation(c);break;case'Arithmetic':this.seriesArray=this.classify.getArithmeticProgression(c);break;case'Geometric':this.seriesArray=this.classify.getGeometricProgression(c);break;case'Quantile':this.seriesArray=this.classify.getQuantile(c);break;case'Jenks':this.seriesArray=this.classify.getJenks(c);break;case'UniqueValues':this.seriesArray=this.classify.getUniqueValues(c);break;default:this.seriesArray=this.classify.getJenks(c);}}setLevel(a){this.options.level=a,this.ds&&this.setData(this.ds)}setPrecision(a){this.classify.setPrecisiond(a)}getEqInterval(){this.options.type='EqInterval',this.setClassify()}getStdDeviation(){this.options.type='StdDeviation',this.setClassify()}getArithmeticProgression(){this.options.type='Arithmetic',this.setClassify()}getGeometricProgression(){this.options.type='Geometric',this.setClassify()}getQuantile(){this.options.type='Quantile',this.setClassify()}getJenks(){this.options.type='Jenks',this.setClassify()}getUniqueValues(){this.options.type='UniqueValues',this.setClassify()}}module.exports=c; | ||
const a=require('./geostats');const b={type:'Jenks',level:5};class c{constructor(c){this.options=Object.assign(b,c||{}),this.classify=new a,this.classify.silent=!0,this.seriesArray=null}setData(a){a&&a.length&&Array.isArray(a)||console.error('classify.setData needs ds argument'),this.ds=a;let b=this.options.type;b==='Jenks'?a.length<=this.options.level&&(this.options.level=a.length-1):a.length<=this.options.level&&(this.options.level=a.length),this.classify.setSerie(a),this.setClassify()}setPattern(a){a&&a.length&&Array.isArray(a)||console.error('classify.setPattern needs pattern argument'),this.pattern=a}getPattern(b){let a=this.getIndex(b);let c=this.options.level;return a>=this.pattern.length?this.pattern[this.pattern.length-1]:this.pattern[a]}getIndex(c){let b=0;let a=this.seriesArray.length;for(let d=0;d<a;d++){if(c===this.seriesArray[a-1]){a===1?b=a-1:b=a-2;break}if(this.seriesArray[d]<=c&&c<this.seriesArray[d+1]){b=d;break}}return b}setClassify(){let b=this.options;let c=b.type;let a=b.level;switch(c){case'EqInterval':this.seriesArray=this.classify.getEqInterval(a);break;case'StdDeviation':this.seriesArray=this.classify.getStdDeviation(a);break;case'Arithmetic':this.seriesArray=this.classify.getArithmeticProgression(a);break;case'Geometric':this.seriesArray=this.classify.getGeometricProgression(a);break;case'Quantile':this.seriesArray=this.classify.getQuantile(a);break;case'Jenks':this.seriesArray=this.classify.getJenks(a);break;case'UniqueValues':this.seriesArray=this.classify.getUniqueValues(a);break;default:this.seriesArray=this.classify.getJenks(a);break}}setLevel(a){this.options.level=a,this.ds&&this.setData(this.ds)}setPrecision(a){this.classify.setPrecisiond(a)}getEqInterval(){this.options.type='EqInterval',this.setClassify()}getStdDeviation(){this.options.type='StdDeviation',this.setClassify()}getArithmeticProgression(){this.options.type='Arithmetic',this.setClassify()}getGeometricProgression(){this.options.type='Geometric',this.setClassify()}getQuantile(){this.options.type='Quantile',this.setClassify()}getJenks(){this.options.type='Jenks',this.setClassify()}getUniqueValues(){this.options.type='UniqueValues',this.setClassify()}}module.exports=c |
{ | ||
"name": "geoclassify", | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"description": "classify statistics", | ||
@@ -14,6 +14,4 @@ "main": "index.js", | ||
"license": "MIT", | ||
"dependencies": { | ||
"geostats": "1.5.0" | ||
}, | ||
"dependencies": {}, | ||
"devDependencies": {} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
18446
0
6
- Removedgeostats@1.5.0
- Removedgeostats@1.5.0(transitive)