d3-scale-cluster
Advanced tools
Comparing version 1.1.5 to 1.1.6
# Changelog | ||
### 1.1.6 | ||
* Add support for RequireJS/AMD (thanks @kimxogus) | ||
### 1.1.0 | ||
@@ -4,0 +8,0 @@ |
@@ -1,1 +0,1 @@ | ||
!function(r){function n(e){if(t[e])return t[e].exports;var a=t[e]={exports:{},id:e,loaded:!1};return r[e].call(a.exports,a,a.exports,n),a.loaded=!0,a.exports}var t={};return n.m=r,n.c=t,n.p="",n(0)}([function(r,n,t){function e(){function r(){if(!(o.length<=2)){n=a(t,Math.min(t.length,o.length)),u=[];for(var r=0;r<n.length;r++)u.push(n[r][0])}}var n=[],t=[],o=[],u=[],f=function(r){if(0!==n.length){for(var t=u.length-1;t>=0;t--)if(r>=u[t])return o[t];return o[0]}};return f.domain=function(){return arguments.length?(t=arguments[0],r(),f):t},f.range=function(){if(arguments.length){var n=arguments[0],t=n.length!==o.length;return o=n,t&&r(),f}return o},f.invertExtent=function(r){for(var n=NaN,t=NaN,e=0;e<o.length;e++)if(o[e]===r){n=u[e],t=e+1<o.length?u[e+1]:NaN;break}return[n,t]},f.clusters=function(){return u.slice(1)},f.copy=function(){return e().domain(t).range(o)},f}var a=t(1);"object"==typeof d3&&(d3.scaleCluster=e),r.exports=e},function(r,n){function t(r){return r.slice().sort(function(r,n){return r-n})}function e(r){for(var n,t=0,e=0;e<r.length;e++)0!==e&&r[e]===n||(n=r[e],t++);return t}function a(r,n){for(var t=[],e=0;e<r;e++){for(var a=[],o=0;o<n;o++)a.push(0);t.push(a)}return t}function o(r,n,t,e){var a;if(r>0){var o=(t[n]-t[r-1])/(n-r+1);a=e[n]-e[r-1]-(n-r+1)*o*o}else a=e[n]-t[n]*t[n]/(n+1);return a<0?0:a}function u(r,n,t,e,a,f,i){if(!(r>n)){var l=Math.floor((r+n)/2);e[t][l]=e[t-1][l-1],a[t][l]=l;var h=t;r>t&&(h=Math.max(h,a[t][r-1]||0)),h=Math.max(h,a[t-1][l]||0);var c=l-1;n<e.length-1&&(c=Math.min(c,a[t][n+1]||0));for(var v,g,s,p,d=c;d>=h&&(v=o(d,l,f,i),!(v+e[t-1][h-1]>=e[t][l]));--d)g=o(h,l,f,i),s=g+e[t-1][h-1],s<e[t][l]&&(e[t][l]=s,a[t][l]=h),h++,p=v+e[t-1][d-1],p<e[t][l]&&(e[t][l]=p,a[t][l]=d);u(r,l-1,t,e,a,f,i),u(l+1,n,t,e,a,f,i)}}function f(r,n,t){for(var e=n[0].length,a=new Array(e),f=new Array(e),i=r[Math.floor(e/2)],l=0;l<e;++l)0===l?(a[0]=r[0]-i,f[0]=(r[0]-i)*(r[0]-i)):(a[l]=a[l-1]+r[l]-i,f[l]=f[l-1]+(r[l]-i)*(r[l]-i)),n[0][l]=o(0,l,a,f),t[0][l]=0;for(var h,c=1;c<n.length;++c)h=c<n.length-1?c:e-1,u(h,e-1,c,n,t,a,f)}function i(r,n){if(n>r.length)throw new Error("Cannot generate more classes than there are data values");var o=r.length,u=t(r),i=e(u);if(1===i)return[u];n=Math.min(i,n);var l=a(n,o),h=a(n,o);f(u,l,h);for(var c=[],v=h[0].length-1,g=h.length-1;g>=0;g--){var s=h[g][v];c[g]=u.slice(s,v+1),g>0&&(v=s-1)}return c}r.exports=i}]); | ||
!function(r,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("d3scaleCluster",[],t):"object"==typeof exports?exports.d3scaleCluster=t():r.d3scaleCluster=t()}(this,function(){return function(r){function t(e){if(n[e])return n[e].exports;var o=n[e]={exports:{},id:e,loaded:!1};return r[e].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var n={};return t.m=r,t.c=n,t.p="",t(0)}([function(r,t,n){function e(){function r(){if(!(a.length<=2)){t=o(n,Math.min(n.length,a.length)),u=[];for(var r=0;r<t.length;r++)u.push(t[r][0])}}var t=[],n=[],a=[],u=[],f=function(r){if(0!==t.length){for(var n=u.length-1;n>=0;n--)if(r>=u[n])return a[n];return a[0]}};return f.domain=function(){return arguments.length?(n=arguments[0],r(),f):n},f.range=function(){if(arguments.length){var t=arguments[0],n=t.length!==a.length;return a=t,n&&r(),f}return a},f.invertExtent=function(r){for(var t=NaN,n=NaN,e=0;e<a.length;e++)if(a[e]===r){t=u[e],n=e+1<a.length?u[e+1]:NaN;break}return[t,n]},f.clusters=function(){return u.slice(1)},f.copy=function(){return e().domain(n).range(a)},f}var o=n(1);"object"==typeof d3&&(d3.scaleCluster=e),r.exports=e},function(r,t){function n(r){return r.slice().sort(function(r,t){return r-t})}function e(r){for(var t,n=0,e=0;e<r.length;e++)0!==e&&r[e]===t||(t=r[e],n++);return n}function o(r,t){for(var n=[],e=0;e<r;e++){for(var o=[],a=0;a<t;a++)o.push(0);n.push(o)}return n}function a(r,t,n,e){var o;if(r>0){var a=(n[t]-n[r-1])/(t-r+1);o=e[t]-e[r-1]-(t-r+1)*a*a}else o=e[t]-n[t]*n[t]/(t+1);return o<0?0:o}function u(r,t,n,e,o,f,i){if(!(r>t)){var l=Math.floor((r+t)/2);e[n][l]=e[n-1][l-1],o[n][l]=l;var c=n;r>n&&(c=Math.max(c,o[n][r-1]||0)),c=Math.max(c,o[n-1][l]||0);var h=l-1;t<e.length-1&&(h=Math.min(h,o[n][t+1]||0));for(var s,v,g,p,d=h;d>=c&&(s=a(d,l,f,i),!(s+e[n-1][c-1]>=e[n][l]));--d)v=a(c,l,f,i),g=v+e[n-1][c-1],g<e[n][l]&&(e[n][l]=g,o[n][l]=c),c++,p=s+e[n-1][d-1],p<e[n][l]&&(e[n][l]=p,o[n][l]=d);u(r,l-1,n,e,o,f,i),u(l+1,t,n,e,o,f,i)}}function f(r,t,n){for(var e=t[0].length,o=new Array(e),f=new Array(e),i=r[Math.floor(e/2)],l=0;l<e;++l)0===l?(o[0]=r[0]-i,f[0]=(r[0]-i)*(r[0]-i)):(o[l]=o[l-1]+r[l]-i,f[l]=f[l-1]+(r[l]-i)*(r[l]-i)),t[0][l]=a(0,l,o,f),n[0][l]=0;for(var c,h=1;h<t.length;++h)c=h<t.length-1?h:e-1,u(c,e-1,h,t,n,o,f)}function i(r,t){if(t>r.length)throw new Error("Cannot generate more classes than there are data values");var a=r.length,u=n(r),i=e(u);if(1===i)return[u];t=Math.min(i,t);var l=o(t,a),c=o(t,a);f(u,l,c);for(var h=[],s=c[0].length-1,v=c.length-1;v>=0;v--){var g=c[v][s];h[v]=u.slice(g,s+1),v>0&&(s=g-1)}return h}r.exports=i}])}); |
{ | ||
"name": "d3-scale-cluster", | ||
"version": "1.1.5", | ||
"version": "1.1.6", | ||
"description": "D3 scale that clusters data into discrete groups", | ||
@@ -9,3 +9,3 @@ "repository": "schnerd/d3-scale-cluster", | ||
"test": "node spec/index.js", | ||
"build": "./node_modules/.bin/webpack --optimize-minimize src/index.js dist/d3-scale-cluster.min.js" | ||
"build": "webpack" | ||
}, | ||
@@ -12,0 +12,0 @@ "author": "David Schnurr", |
@@ -80,6 +80,6 @@ var ckmeans = require('./ckmeans.js'); | ||
return scale; | ||
}; | ||
} | ||
if (typeof d3 === 'object') { | ||
d3.scaleCluster = d3scaleCluster; | ||
d3.scaleCluster = d3scaleCluster; | ||
} | ||
@@ -86,0 +86,0 @@ |
Sorry, the diff of this file is not supported yet
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
22746
12
396