geoclassify
Advanced tools
Comparing version 0.0.2 to 0.0.3
@@ -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=c-1;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'),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; |
{ | ||
"name": "geoclassify", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"description": "classify statistics", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -38,3 +38,3 @@ #### classify | ||
```javascript | ||
const Classify = require('classify') | ||
const Classify = require('geoclassify') | ||
@@ -41,0 +41,0 @@ // 1. 初始化分级的种类 和 级别数 |
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
4248