cytoscape-d3-force
Description
Dependencies
Usage instructions
Download the library:
- via npm:
npm install cytoscape-deep-d3-force
, - via bower:
bower install cytoscape-deep-d3-force
, or - via direct download in the repository (probably from a tag).
Import the library as appropriate for your project:
ES import:
import cytoscape from 'cytoscape';
import d3Force from 'cytoscape-deep-d3-force';
cytoscape.use( d3Force );
CommonJS require:
let cytoscape = require('cytoscape');
let d3Force = require('cytoscape-deep-d3-force');
cytoscape.use( d3Force );
AMD:
require(['cytoscape', 'cytoscape-deep-d3-force'], function( cytoscape, d3Force ){
d3Force( cytoscape );
});
Plain HTML/JS has the extension registered for you automatically, because no require()
is needed.
API
{
animate: true,
maxIterations: 0,
maxSimulationTime: 0,
ungrabifyWhileSimulating: false,
fixedAfterDragging: false,
fit: false,
padding: 30,
boundingBox: undefined,
alpha: 1,
alphaMin: 0.001,
alphaDecay: 1 - Math.pow(0.001, 1 / 300),
alphaTarget: 0,
velocityDecay: 0.4,
collideRadius: 1,
collideStrength: 0.7,
collideIterations: 1,
linkId: function id(d) {
return d.index;
},
linkDistance: 30,
linkStrength: function strength(link) {
return 1 / Math.min(count(link.source), count(link.target));
},
linkIterations: 1,
manyBodyStrength: -30,
manyBodyTheta: 0.9,
manyBodyDistanceMin: 1,
manyBodyDistanceMax: Infinity,
xStrength: 0.1,
xX: 0,
yStrength: 0.1,
yY: 0,
radialStrength: 0.1,
radialRadius: [radius]
radialX: 0,
radialY: 0,
ready: function(){},
stop: function(){},
tick: function(progress) {},
randomize: false,
infinite: false
}
Build targets
npm run test
: Run Mocha tests in ./test
npm run build
: Build ./src/**
into cytoscape-d3-force.js
npm run watch
: Automatically build on changes with live reloading (N.b. you must already have an HTTP server running)npm run dev
: Automatically build on changes with live reloading with webpack dev servernpm run lint
: Run eslint on the source
N.b. all builds use babel, so modern ES features can be used in the src
.
Publishing instructions
This project is set up to automatically be published to npm and bower. To publish:
- Build the extension :
npm run build:release
- Commit the build :
git commit -am "Build for release"
- Bump the version number and tag:
npm version major|minor|patch
- Push to origin:
git push && git push --tags
- Publish to npm:
npm publish .
- If publishing to bower for the first time, you'll need to run
bower register cytoscape-d3-force https://github.com/shichuanpo/cytoscape.js-d3-force.git
- Make a new release for Zenodo.