d3-force-cluster
Advanced tools
Comparing version 0.1.1 to 0.1.2
@@ -39,3 +39,3 @@ (function (global, factory) { | ||
if (l != r) { | ||
if (l && l != r) { | ||
l = (l - r) / l * alpha; | ||
@@ -42,0 +42,0 @@ d.x -= x *= l; |
@@ -1,1 +0,1 @@ | ||
!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(n.d3=n.d3||{})}(this,function(n){"use strict";function t(n){function t(n){n*=r*n;var t=void 0,e=void 0,f=void 0,c=void 0,d=void 0;i.forEach(function(i,r){t=o[r],t&&t!==i&&(e=i.x-t.x,f=i.y-t.y,c=Math.sqrt(e*e+f*f),d=i.radius+(t.radius||0),c!=d&&(c=(c-d)/c*n,i.x-=e*=c,i.y-=f*=c,t.x+=(1-u)*e,t.y+=(1-u)*f))})}function e(){if(i){var t=void 0,e=i.length;for(o=new Array(e),t=0;t<e;t++)o[t]=n(i[t],t,i)}}var i=void 0,o=[],r=.1,u=0;return"function"!=typeof n&&(n=function(){return n}),t.initialize=function(n){i=n,e()},t.centers=function(i){return null==i?n:(n="function"==typeof i?i:function(n,t){return i[t]},e(),t)},t.strength=function(n){return null==n?r:(r=+n,t)},t.centerInertia=function(n){return null==n?u:(u=+n,t)},t}n.forceCluster=t,Object.defineProperty(n,"__esModule",{value:!0})}); | ||
!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(n.d3=n.d3||{})}(this,function(n){"use strict";function t(n){function t(n){n*=r*n;var t=void 0,e=void 0,f=void 0,c=void 0,d=void 0;i.forEach(function(i,r){t=o[r],t&&t!==i&&(e=i.x-t.x,f=i.y-t.y,c=Math.sqrt(e*e+f*f),d=i.radius+(t.radius||0),c&&c!=d&&(c=(c-d)/c*n,i.x-=e*=c,i.y-=f*=c,t.x+=(1-u)*e,t.y+=(1-u)*f))})}function e(){if(i){var t=void 0,e=i.length;for(o=new Array(e),t=0;t<e;t++)o[t]=n(i[t],t,i)}}var i=void 0,o=[],r=.1,u=0;return"function"!=typeof n&&(n=function(){return n}),t.initialize=function(n){i=n,e()},t.centers=function(i){return null==i?n:(n="function"==typeof i?i:function(n,t){return i[t]},e(),t)},t.strength=function(n){return null==n?r:(r=+n,t)},t.centerInertia=function(n){return null==n?u:(u=+n,t)},t}n.forceCluster=t,Object.defineProperty(n,"__esModule",{value:!0})}); |
@@ -30,3 +30,3 @@ /** | ||
if (l != r) { | ||
if (l && l != r) { | ||
l = (l - r) / l * alpha; | ||
@@ -33,0 +33,0 @@ d.x -= x *= l; |
{ | ||
"name": "d3-force-cluster", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"description": "Clustering force for d3.forceSimulation.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -18,5 +18,5 @@ # d3-force-cluster | ||
#### CDN, via `<script>` | ||
#### CDN ([UNPKG](https://unpkg.com/)), via `<script>` | ||
`<script src="https://wzrd.in/standalone/d3-force-cluster@latest"></script>` | ||
`<script src="https://unpkg.com/d3-force-cluster@latest"></script>` | ||
@@ -29,7 +29,3 @@ #### Local, via `<script>` | ||
#### [UNPKG](https://unpkg.com/) | ||
`<script src="https://unpkg.com/d3-force-cluster@latest"></script>` | ||
## Usage | ||
@@ -52,3 +48,3 @@ | ||
#### via `<script>`, [UNPKG](https://unpkg.com/) | ||
#### via `<script>` or CDN ([UNPKG](https://unpkg.com/)) | ||
@@ -62,11 +58,2 @@ The `forceCluster()` method is available in the global `d3` namespace. | ||
#### [Browserify CDN](http://wzrd.in/]) | ||
The Browserify CDN camelCases the package name (`d3-force-cluster` becomes `d3ForceCluster`), and uses it as a global namespace, and hangs the `forceCluster()` method off of it: | ||
``` | ||
d3.forceSimulation | ||
.force('cluster', d3ForceCluster.forceCluster()); | ||
``` | ||
### Using the module | ||
@@ -87,6 +74,8 @@ | ||
More detailed examples: | ||
- [Simple cluster layout](http://bl.ocks.org) | ||
- [Centered cluster layout](http://bl.ocks.org) | ||
- [Simple cluster layout<br>![Simple cluster layout](http://bl.ocks.org/ericsoco/raw/4e1b7b628771ae77753842e6dabfcef3/thumbnail.png)](http://bl.ocks.org/ericsoco/4e1b7b628771ae77753842e6dabfcef3) | ||
- [Centered cluster layout<br>![Centered cluster layout](http://bl.ocks.org/ericsoco/raw/d2d49d95d2f75552ac64f0125440b35e/thumbnail.png)](http://bl.ocks.org/ericsoco/d2d49d95d2f75552ac64f0125440b35e) | ||
- [Mouse following cluster layout<br>![Mouse following cluster layout](http://bl.ocks.org/ericsoco/raw/11d5013dee991b219b205a4ecd558d7c/thumbnail.png)](http://bl.ocks.org/ericsoco/11d5013dee991b219b205a4ecd558d7c) | ||
## API | ||
@@ -93,0 +82,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
27474
116