Export the current graph view as an SVG image. (demo)
The exported SVG can be saved as a PDF with svg2pdf.js libary. See an example in demo.html
Download the library:
npm install cytoscape-svg
,bower install cytoscape-svg
, orImport the library as appropriate for your project:
ES import:
import cytoscape from 'cytoscape';
import svg from 'cytoscape-svg';
cytoscape.use( svg );
CommonJS require:
let cytoscape = require('cytoscape');
let svg = require('cytoscape-svg');
cytoscape.use( svg ); // register extension
AMD:
require(['cytoscape', 'cytoscape-svg'], function( cytoscape, svg ){
svg( cytoscape ); // register extension
});
Plain HTML/JS has the extension registered for you automatically, because no require()
is needed.
cy.svg(options)
npm run test
: Run Mocha tests in ./test
npm run build
: Build ./src/**
into cytoscape-svg.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 sourceN.b. all builds use babel, so modern ES features can be used in the src
.
This project is set up to automatically be published to npm and bower. To publish:
npm run build:release
git commit -am "Build for release"
npm version major|minor|patch
git push && git push --tags
npm publish .
bower register cytoscape-svg https://github.com/kinimesi/cytoscape-svg.git