ngraph.svg
v0.1.0
Published
Svg based graph rendering
Downloads
197
Readme
ngraph.svg
Svg based graph rendering
install
With npm do:
npm install ngraph.svgdev/build
This repo now uses native ES modules and Vite for development and library build:
- Start examples:
npm run dev(opens/example/basic/index.html). - Build library:
npm run build. - Preview build:
npm run preview.
Basic ESM usage:
import createGraph from 'ngraph.graph';
import createRenderer from 'ngraph.svg';
const graph = createGraph();
graph.addLink('a', 'b');
const renderer = createRenderer(graph);
renderer.run();Standalone browser build
If you prefer a single script without bundlers, build the standalone bundle and include it directly in the browser. It exposes a global ngraphSvg.
<!-- After running: npm run build:standalone -->
<script src="./dist/ngraph.svg.standalone.js"></script>
<script type="module">
import createGraph from 'https://unpkg.com/ngraph.graph@20?module';
const graph = createGraph();
graph.addLink('a', 'b');
const renderer = ngraphSvg(graph);
renderer.run();
<\/script>Note: The standalone build bundles this library's dependencies, but you still need to provide a graph instance (e.g. from ngraph.graph).
license
MIT
